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
 
(4 intermediate revisions by the same user not shown)
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 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
=== Accessing UNIX ===
There are various ways to use UNIX depending on your operating system:


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.
* '''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.


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


There are various methods to access UNIX:
=== The Shell ===


- **Windows**: Download and install [MobaXTerm](https://mobaxterm.mobatek.net/).
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:
- **Mac**: macOS is built on UNIX. Use the built-in Terminal application.
* `aix4(s010178) $`
- **Linux**: Linux distributions are UNIX-based; the terminal is readily available.
* `interaction[pws]:/home/people/pws>`
* `pws@antros:~$`


Launching the terminal opens the shell, the command-line interface awaiting your input.
Different shells and operating systems may have unique prompts and behaviors.


## The Shell
=== 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`.


The shell is the command-line interface where you input commands. The prompt, which varies across systems, indicates readiness for your input. Examples include:
'''Naming Conventions''':
* Avoid spaces and special characters in file and directory names. Use:
** `abcdefghijklmnopqrstuvwxyz`
** `ABCDEFGHIJKLMNOPQRSTUVWXYZ`
** `0123456789.-_`


- `aix4(s010178) $`
* Remember, UNIX is case-sensitive: `MyFile.txt` and `myfile.txt` are treated as distinct files.
- `interaction[pws]:/home/people/pws>`
* Although file extensions (like `.txt` or `.doc`) aren't required, using them helps identify file types.
- `pws@antros:~$`


Different shells and operating systems may present unique prompts and behaviors.
=== 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.


## The File System
For example, running `ls -l` might yield:


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`.
    -rwxr--r-- 1 root sys 113520 Sep 5 14:15 good_program


**Naming Conventions**:
This indicates that `good_program` is a file with:
 
* '''User (`root`)''': Read, write, and execute permissions.
- Avoid spaces and special characters in file and directory names. Stick to:
* '''Group (`sys`)''': Read permission only.
  - `abcdefghijklmnopqrstuvwxyz`
* '''Others''': Read permission only.
  - `ABCDEFGHIJKLMNOPQRSTUVWXYZ`
  - `0123456789.-_`
- UNIX is case-sensitive: `MyFile.txt` and `myfile.txt` are distinct files.
- While file extensions (e.g., `.doc`, `.txt`) aren't mandatory in UNIX, using them helps identify file types.
 
**File Permissions**:
 
UNIX employs a permission system to control access:
 
- Three user categories:
  - **User**: The file owner.
  - **Group**: Users in the file's group.
  - **Others**: All other users.
- Each category has three permissions:
  - **Read (`r`)**: View the file's contents.
  - **Write (`w`)**: Modify the file.
  - **Execute (`x`)**: Run the file as a program.
 
For example, the command `ls -l` might display:
 
```
-rwxr--r-- 1 root sys 113520 Sep 5 14:15 good_program
```
 
This indicates:
 
- `good_program` is a file with:
  - User (`root`): Read, write, and execute permissions.
  - Group (`sys`): Read permission.
  - Others: Read permission.


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:
This indicates that `gorm_directory` is a directory with:


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


In directories:
'''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.


- **Write (`w`)**: Allows creating or deleting files within the directory.
=== Common UNIX Commands ===
- **Execute (`x`)**: Permits listing the directory's contents. Without execute permission, the directory appears empty when listed.


## 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 [https://teaching.healthtech.dtu.dk/unix/index.php/Commands_summary UNIX 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.

Latest revision as of 15:59, 14 November 2024

Introduction to UNIX

UNIX refers to a family of multitasking, multi-user computer operating systems that originated from 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.

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.