Unix notes: Difference between revisions
(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 |
||
| (5 intermediate revisions by one other user not shown) | |||
| Line 1: | Line 1: | ||
=== Introduction to UNIX === | |||
UNIX refers to a family of multitasking, multi-user 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. | |||
Although UNIX may appear complex at first, it provides powerful tools for working with large datasets and automating workflows. In bioinformatics and NGS analysis, most tools run exclusively on the command line, making UNIX an essential skill. | |||
UNIX | === Accessing UNIX === | ||
There are various ways to use UNIX depending on your operating system: | |||
* '''Windows''': Download and install [https://mobaxterm.mobatek.net/ MobaXTerm]. | |||
* '''Mac''': macOS is UNIX-based; use the built-in Terminal application. | |||
* '''Linux''': Most Linux distributions are UNIX-like and include a terminal by default. | |||
Opening the terminal launches a shell where you can enter commands. | |||
=== The Shell === | |||
The shell is the interface where you input commands. The prompt indicates the shell is ready for input. Examples include: | |||
* `aix4(s010178) $` | |||
* `interaction[pws]:/home/people/pws>` | |||
* `pws@antros:~$` | |||
Different systems and shells (bash, zsh, etc.) may show different prompts. | |||
Useful shortcuts: | |||
* Press '''TAB''' to autocomplete commands and file names. | |||
* Press '''Up/Down arrows''' to scroll through command history. | |||
* Press '''Ctrl + R''' to search command history. | |||
=== File System Basics === | |||
In this guide, placeholders like `<filename>` indicate where you must substitute actual names (e.g., replace `<filename>` with `mydata.txt`). | |||
'''Naming conventions:''' | |||
* Avoid spaces and special characters in file and directory names. | |||
* Safe characters include: | |||
** `abcdefghijklmnopqrstuvwxyz` | |||
** `ABCDEFGHIJKLMNOPQRSTUVWXYZ` | |||
** `0123456789.-_` | |||
* UNIX is case-sensitive: `MyFile.txt` and `myfile.txt` are different. | |||
* File extensions are optional but recommended for clarity. | |||
Navigation commands: | |||
* `pwd` — show current directory | |||
* `ls -l` — list files with details | |||
* `cd <directory>` — change directory | |||
* `mkdir <name>` — create directory | |||
Viewing files: | |||
* `cat <file>` | |||
* `less <file>` | |||
* `head <file>` | |||
* `tail <file>` | |||
** | Be extremely careful with: | ||
* `rm` — deletes files permanently | |||
* `rm -rf` — recursively deletes directories ('''no undo!''') | |||
=== File Permissions === | |||
UNIX uses a permission system controlling access to files and directories. | |||
** | Three user categories: | ||
* '''User''' — the file's owner | |||
* '''Group''' — users in the same group | |||
* '''Others''' — everyone else | |||
Three permission types: | |||
* '''Read''' (`r`) | |||
* '''Write''' (`w`) | |||
* '''Execute''' (`x`) | |||
Example from `ls -l`: | |||
<pre> | |||
-rwxr--r-- 1 root sys 113520 Sep 5 14:15 good_program | -rwxr--r-- 1 root sys 113520 Sep 5 14:15 good_program | ||
</pre> | |||
This | This means: | ||
* User `root`: read, write, execute | |||
* Group `sys`: read | |||
* Others: read | |||
Directory example: | |||
<pre> | |||
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 | ||
</pre> | |||
Directory permissions: | |||
* '''Read (r)''' — list directory contents | |||
* '''Write (w)''' — create/delete files inside the directory | |||
* '''Execute (x)''' — enter the directory (without x, directory looks empty) | |||
` | === Common UNIX Commands === | ||
man <command> | Most commands have options. Use `man <command>` to read manual pages. | ||
Examples: | |||
* `man ls` | |||
* `man grep` | |||
* | Notes: | ||
* Press '''q''' to exit `man`, `less`, and similar programs. | |||
* Press '''Ctrl + C''' to interrupt running commands. | |||
For a | For a complete list of commands used in this course, see the | ||
[https://teaching.healthtech.dtu.dk/unix/index.php/Commands_summary UNIX Commands Summary]. | |||
This guide | This guide provides the basics; you will become more comfortable with UNIX as you use it throughout the exercises and project work. | ||
Latest revision as of 15:36, 19 November 2025
Introduction to UNIX
UNIX refers to a family of multitasking, multi-user 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.
Although UNIX may appear complex at first, it provides powerful tools for working with large datasets and automating workflows. In bioinformatics and NGS analysis, most tools run exclusively on the command line, making UNIX an essential skill.
Accessing UNIX
There are various ways to use UNIX depending on your operating system:
- Windows: Download and install MobaXTerm.
- Mac: macOS is UNIX-based; use the built-in Terminal application.
- Linux: Most Linux distributions are UNIX-like and include a terminal by default.
Opening the terminal launches a shell where you can enter commands.
The Shell
The shell is the interface where you input commands. The prompt indicates the shell is ready for input. Examples include:
- `aix4(s010178) $`
- `interaction[pws]:/home/people/pws>`
- `pws@antros:~$`
Different systems and shells (bash, zsh, etc.) may show different prompts.
Useful shortcuts:
- Press TAB to autocomplete commands and file names.
- Press Up/Down arrows to scroll through command history.
- Press Ctrl + R to search command history.
File System Basics
In this guide, placeholders like `<filename>` indicate where you must substitute actual names (e.g., replace `<filename>` with `mydata.txt`).
Naming conventions:
- Avoid spaces and special characters in file and directory names.
- Safe characters include:
- `abcdefghijklmnopqrstuvwxyz`
- `ABCDEFGHIJKLMNOPQRSTUVWXYZ`
- `0123456789.-_`
- UNIX is case-sensitive: `MyFile.txt` and `myfile.txt` are different.
- File extensions are optional but recommended for clarity.
Navigation commands:
- `pwd` — show current directory
- `ls -l` — list files with details
- `cd <directory>` — change directory
- `mkdir <name>` — create directory
Viewing files:
- `cat <file>`
- `less <file>`
- `head <file>`
- `tail <file>`
Be extremely careful with:
- `rm` — deletes files permanently
- `rm -rf` — recursively deletes directories (no undo!)
File Permissions
UNIX uses a permission system controlling access to files and directories.
Three user categories:
- User — the file's owner
- Group — users in the same group
- Others — everyone else
Three permission types:
- Read (`r`)
- Write (`w`)
- Execute (`x`)
Example from `ls -l`:
-rwxr--r-- 1 root sys 113520 Sep 5 14:15 good_program
This means:
- User `root`: read, write, execute
- Group `sys`: read
- Others: read
Directory example:
drwxr-xr-x 6 gorm user 72 Jun 26 23:50 gorm_directory
Directory permissions:
- Read (r) — list directory contents
- Write (w) — create/delete files inside the directory
- Execute (x) — enter the directory (without x, directory looks empty)
Common UNIX Commands
Most commands have options. Use `man <command>` to read manual pages.
Examples:
- `man ls`
- `man grep`
Notes:
- Press q to exit `man`, `less`, and similar programs.
- Press Ctrl + C to interrupt running commands.
For a complete list of commands used in this course, see the UNIX Commands Summary.
This guide provides the basics; you will become more comfortable with UNIX as you use it throughout the exercises and project work.