Quick review for commands
Contents
Command Information
Command History
Navigating Directories
Creating Directories
Moving Directories
Deleting Directories
Creating Files
Standard Output, Standard Error and Standard Input
Moving Files
Deleting Files
Reading Files
Sorting Files
File Permissions
7
read, write and execute
rwx
111
6
read and write
rw-
110
5
read and execute
r-x
101
4
read only
r--
100
3
write and execute
-wx
011
2
write only
-w-
010
1
execute only
--x
001
0
none
---
000
For a directory, execute means you can enter a directory.
6
4
4
User can read and write, everyone else can read (Default file permissions)
7
5
5
User can read, write and execute, everyone else can read and execute (Default directory permissions)
u - User
g - Group
o - Others
a - All of the above
Finding Files
Find binary files for a command.
locate uses an index and is fast.
find doesn't use an index and is slow.
Find in Files
Replace in Files
File Editor
Symbolic Links
Compressing Files
zip
Compresses one or more files into *.zip files.
gzip
Compresses a single file into *.gz files.
tar -c
Compresses (optionally) and combines one or more files into a single *.tar, *.tar.gz, *.tpz or *.tgz file.
Decompressing Files
unzip
gunzip
tar -x
Packages
Install package source code
Disk Usage
Memory Usage
Shutdown and Reboot
Identifying Processes
Process Priority
Process priorities go from -20 (highest) to 19 (lowest).
Killing Processes
Date & Time
Scheduled Tasks
User Management
HTTP Requests
Network Troubleshooting
DNS
Hardware
System Information
Terminal Multiplexers
Start multiple terminal sessions. Active sessions persist reboots. tmux is more modern than screen.
Secure Shell Protocol (SSH)
Set default user and port in ~/.ssh/config, so you can just enter the name next time:
Secure Copy
Bash Profile
bash -
.bashrczsh -
.zshrc
Conditional Statements
Boolean Operators
$saman- Is true!$saman- Is false
Numeric Operators
-eq- Equals-ne- Not equals-gt- Greater than-ge- Greater than or equal to-lt- Less than-le- Less than or equal to-esaman.txt - Check file exists-zsaman - Check if variable exists
String Operators
=- Equals==- Equals-z- Is null-n- Is not null<- Is less than in ASCII alphabetical order>- Is greater than in ASCII alphabetical order
If Statements
Inline If Statements
While Loops
For Loops
Case Statements
Last updated