Catalog / Unix Shell Cheatsheet
Unix Shell Cheatsheet
A comprehensive cheat sheet for navigating and manipulating the Unix shell environment, covering essential commands, shortcuts, and scripting techniques.
Navigation & File Management
Basic Commands
|
Print working directory (shows the current directory). |
|
List directory contents (files and subdirectories). |
|
Change directory. |
|
Create a new directory. |
|
Remove an empty directory. |
|
Create an empty file or update the timestamp of an existing file. |
File Operations
|
Copy files or directories. |
|
Move or rename files or directories. |
|
Remove files. |
|
Concatenate and display file contents. |
|
Display the beginning of a file. |
|
Display the end of a file. |
|
View file contents page by page. |
Working with Text
Text Manipulation
|
Search for patterns in files. |
|
Stream editor for text manipulation. |
|
Pattern scanning and processing language. |
|
Word count. |
|
Sort lines of text files. |
|
Remove duplicate lines. |
|
Cut sections from each line of files. |
Redirection and Pipes
Example: |
Example: |
Example: |
Example: |
Example: |
System Information & Processes
System Info
|
Print system information. |
|
Display disk space usage. |
|
Estimate file space usage. |
|
Display amount of free and used memory. |
|
Show how long the system has been running. |
|
Print effective user ID. |
|
Display the system’s hostname. |
Process Management
|
Display running processes. |
|
Display dynamic real-time view of running processes. |
|
Terminate a process. |
|
List active jobs. |
|
Put a job in the background. |
|
Bring a job to the foreground. |
|
Run a command immune to hangups, with output to a non-tty. |
Shell Scripting
Basic Script Structure
Shebang ( |
Variables:
|
Command Substitution:
|
Control Flow
|
|
|
|
|
|
|
|
Functions
|