Unix notes: Difference between revisions

From 22126
Jump to navigation Jump to search
(Created page with "Certainly! Here's a Markdown version of the UNIX instructions from the provided PDF: # Using UNIX UNIX primarily operates through a command-line interface, allowing users to execute commands directly. While this may initially seem less intuitive than graphical interfaces, its power becomes evident with experience. ## Obtaining UNIX There are various methods to access UNIX: - **Windows**: Download and install [MobaXTerm](https://mobaxterm.mobatek.net/). - **Mac**: ma...")
 
No edit summary
Line 1: Line 1:
Certainly! Here's a Markdown version of the UNIX instructions from the provided PDF:
=== Introduction to UNIX ===
 
UNIX refers to a family of multitasking, multi-user computer operating systems that originated from the AT&T Unix, first developed in 1969 at Bell Labs by Ken Thompson, Dennis Ritchie, and others. These systems have influenced many modern operating systems and are known for their stability, flexibility, and robust command-line interface. Despite appearing complex at first, using UNIX-based systems efficiently provides a powerful way to manage and operate computing tasks.
# Using UNIX
 
UNIX primarily operates through a command-line interface, allowing users to execute commands directly. While this may initially seem less intuitive than graphical interfaces, its power becomes evident with experience.
 
## Obtaining UNIX
 
There are various methods to access UNIX:


=== Accessing UNIX ===
There are various ways to use UNIX depending on your operating system:
- **Windows**: Download and install [MobaXTerm](https://mobaxterm.mobatek.net/).
- **Windows**: Download and install [MobaXTerm](https://mobaxterm.mobatek.net/).
- **Mac**: macOS is built on UNIX. Use the built-in Terminal application.
- **Mac**: macOS is built on a UNIX-based system, so you can use the built-in Terminal application.
- **Linux**: Linux distributions are UNIX-based; the terminal is readily available.
- **Linux**: Most Linux distributions are based on UNIX, and the terminal is readily available.


Launching the terminal opens the shell, the command-line interface awaiting your input.
Opening the terminal launches a shell where you can enter commands.
 
## The Shell
 
The shell is the command-line interface where you input commands. The prompt, which varies across systems, indicates readiness for your input. Examples include:


=== The Shell ===
The shell is the interface where you input commands. The prompt, which varies across systems, indicates that the shell is ready for your input. Examples of prompts include:
- `aix4(s010178) $`
- `aix4(s010178) $`
- `interaction[pws]:/home/people/pws>`
- `interaction[pws]:/home/people/pws>`
- `pws@antros:~$`
- `pws@antros:~$`


Different shells and operating systems may present unique prompts and behaviors.
Different shells and operating systems may have unique prompts and behaviors.


## The File System
=== File System Basics ===
 
In this guide, placeholders like `<something>` indicate where you should input specific text. For example, `<filename>` should be replaced with an actual file name, such as `MyFile.txt`.
In this guide, placeholders like `<something>` indicate where you should input specific text. For example, `<filename>` should be replaced with the actual file name, such as `MyFile.txt`.


**Naming Conventions**:
**Naming Conventions**:
 
- Avoid spaces and special characters in file and directory names. Use:
- Avoid spaces and special characters in file and directory names. Stick to:
   - `abcdefghijklmnopqrstuvwxyz`
   - `abcdefghijklmnopqrstuvwxyz`
   - `ABCDEFGHIJKLMNOPQRSTUVWXYZ`
   - `ABCDEFGHIJKLMNOPQRSTUVWXYZ`
   - `0123456789.-_`
   - `0123456789.-_`
- UNIX is case-sensitive: `MyFile.txt` and `myfile.txt` are distinct files.
- Remember, UNIX is case-sensitive: `MyFile.txt` and `myfile.txt` are treated as distinct files.
- While file extensions (e.g., `.doc`, `.txt`) aren't mandatory in UNIX, using them helps identify file types.
- Although file extensions (like `.txt` or `.doc`) aren't required, using them helps identify file types.
 
**File Permissions**:
 
UNIX employs a permission system to control access:


- Three user categories:
=== File Permissions ===
   - **User**: The file owner.
UNIX has a permission system that controls file and directory access:
- Three categories of users:
   - **User**: The file's owner.
   - **Group**: Users in the file's group.
   - **Group**: Users in the file's group.
   - **Others**: All other users.
   - **Others**: Everyone else.
- Each category has three permissions:
- Three types of permissions:
   - **Read (`r`)**: View the file's contents.
   - **Read (`r`)**: View the contents of the file.
   - **Write (`w`)**: Modify the file.
   - **Write (`w`)**: Modify the file.
   - **Execute (`x`)**: Run the file as a program.
   - **Execute (`x`)**: Run the file as a program.


For example, the command `ls -l` might display:
For example, running `ls -l` might yield:
 
```
-rwxr--r-- 1 root sys 113520 Sep 5 14:15 good_program
```


This indicates:
    -rwxr--r-- 1 root sys 113520 Sep 5 14:15 good_program


- `good_program` is a file with:
This indicates that `good_program` is a file with:
  - User (`root`): Read, write, and execute permissions.
- **User (`root`)**: Read, write, and execute permissions.
  - Group (`sys`): Read permission.
- **Group (`sys`)**: Read permission only.
  - Others: Read permission.
- **Others**: Read permission only.


For directories, a leading `d` denotes a directory:
For directories, a leading `d` denotes a directory:


```
    drwxr-xr-x 6 gorm user 72 Jun 26 23:50 gorm_directory
drwxr-xr-x 6 gorm user 72 Jun 26 23:50 gorm_directory
```
 
Here:
 
- `gorm_directory` is a directory with:
  - User (`gorm`): Read, write, and execute permissions.
  - Group (`user`): Read and execute permissions.
  - Others: Read and execute permissions.


In directories:
This indicates that `gorm_directory` is a directory with:
- **User (`gorm`)**: Read, write, and execute permissions.
- **Group (`user`)**: Read and execute permissions.
- **Others**: Read and execute permissions.


**Note on Directories**:
- **Write (`w`)**: Allows creating or deleting files within the directory.
- **Write (`w`)**: Allows creating or deleting files within the directory.
- **Execute (`x`)**: Permits listing the directory's contents. Without execute permission, the directory appears empty when listed.
- **Execute (`x`)**: Allows listing the directory's contents. If execute permission is missing, the directory will appear empty.


## Common UNIX Commands
=== Common UNIX Commands ===
Most UNIX commands come with options that modify their behavior. You can use the `man` command to read manual pages for detailed explanations:


UNIX commands often have options that modify their behavior. Use the `man` command to access manual pages for detailed information:
    man <command>


```
man <command>
```


For example, `man ls` provides details about the `ls` command.
For example, `man ls` provides detailed information about the `ls` command.


**Note**: Many commands can be terminated with `Ctrl + C`. Commands like `less` and `man` display information and await further input; press `q` to exit these commands.
**Note**:
- Many commands can be stopped with `Ctrl + C`.
- Commands like `less` and `man` display information and wait for your input. Press `q` to exit these commands.


For a comprehensive list of common UNIX commands and their descriptions, refer to the [UNIX Commands Summary](https://teaching.healthtech.dtu.dk/unix/index.php/Commands_summary).
For a summary of common UNIX commands and their usage, see the [UNIX Commands Summary](https://teaching.healthtech.dtu.dk/unix/index.php/Commands_summary).


This guide offers a foundational understanding of UNIX. As you become more familiar with the command-line interface, you'll discover its efficiency and versatility.
This guide is an introduction to the UNIX system, designed to help you understand the basics and gradually become proficient in using the command line.

Revision as of 15:50, 14 November 2024

Introduction to UNIX

UNIX refers to a family of multitasking, multi-user computer operating systems that originated from the AT&T Unix, first developed in 1969 at Bell Labs by Ken Thompson, Dennis Ritchie, and others. These systems have influenced many modern operating systems and are known for their stability, flexibility, and robust command-line interface. Despite appearing complex at first, using UNIX-based systems efficiently provides a powerful way to manage and operate computing tasks.

Accessing UNIX

There are various ways to use UNIX depending on your operating system: - **Windows**: Download and install [MobaXTerm](https://mobaxterm.mobatek.net/). - **Mac**: macOS is built on a UNIX-based system, so you can use the built-in Terminal application. - **Linux**: Most Linux distributions are based on UNIX, and the terminal is readily available.

Opening the terminal launches a shell where you can enter commands.

The Shell

The shell is the interface where you input commands. The prompt, which varies across systems, indicates that the shell is ready for your input. Examples of prompts include: - `aix4(s010178) $` - `interaction[pws]:/home/people/pws>` - `pws@antros:~$`

Different shells and operating systems may have unique prompts and behaviors.

File System Basics

In this guide, placeholders like `<something>` indicate where you should input specific text. For example, `<filename>` should be replaced with an actual file name, such as `MyFile.txt`.

    • Naming Conventions**:

- Avoid spaces and special characters in file and directory names. Use:

 - `abcdefghijklmnopqrstuvwxyz`
 - `ABCDEFGHIJKLMNOPQRSTUVWXYZ`
 - `0123456789.-_`

- Remember, UNIX is case-sensitive: `MyFile.txt` and `myfile.txt` are treated as distinct files. - Although file extensions (like `.txt` or `.doc`) aren't required, using them helps identify file types.

File Permissions

UNIX has a permission system that controls file and directory access: - Three categories of users:

 - **User**: The file's owner.
 - **Group**: Users in the file's group.
 - **Others**: Everyone else.

- Three types of permissions:

 - **Read (`r`)**: View the contents of the file.
 - **Write (`w`)**: Modify the file.
 - **Execute (`x`)**: Run the file as a program.

For example, running `ls -l` might yield:

    -rwxr--r-- 1 root sys 113520 Sep 5 14:15 good_program

This indicates that `good_program` is a file with: - **User (`root`)**: Read, write, and execute permissions. - **Group (`sys`)**: Read permission only. - **Others**: Read permission only.

For directories, a leading `d` denotes a directory:

   drwxr-xr-x 6 gorm user 72 Jun 26 23:50 gorm_directory

This indicates that `gorm_directory` is a directory with: - **User (`gorm`)**: Read, write, and execute permissions. - **Group (`user`)**: Read and execute permissions. - **Others**: Read and execute permissions.

    • Note on Directories**:

- **Write (`w`)**: Allows creating or deleting files within the directory. - **Execute (`x`)**: Allows listing the directory's contents. If execute permission is missing, the directory will appear empty.

Common UNIX Commands

Most UNIX commands come with options that modify their behavior. You can use the `man` command to read manual pages for detailed explanations:

   man <command>


For example, `man ls` provides detailed information about the `ls` command.

    • Note**:

- Many commands can be stopped with `Ctrl + C`. - Commands like `less` and `man` display information and wait for your input. Press `q` to exit these commands.

For a summary of common UNIX commands and their usage, see the [UNIX Commands Summary](https://teaching.healthtech.dtu.dk/unix/index.php/Commands_summary).

This guide is an introduction to the UNIX system, designed to help you understand the basics and gradually become proficient in using the command line.