| Basic Commands | |
|---|---|
sudo [command] | Run a command in superuser mode |
nohup [command] | Run command immune to hangup signal |
man [command] | Display help pages of command |
[command] & | Run command and send task to background |
>> [fileA] | Append to fileA, preserving contents |
> [fileA] | Output to fileA, overwriting contents |
echo -n | Display a line of text without newline |
xargs | Build command line from previous output |
1>2& | Redirect stdout to stderr |
fg %N | Bring task N to foreground |
jobs | List background tasks |
ctrl-z | Suspend current task |
| File Permissions | |
|---|---|
chmod -c -R | Change file read/write/execute permissions |
touch -a -t | Modify (or create) file timestamp |
chown -c -R | Change file ownership |
chgrp -c -R | Change file group permission |
| Network | |
|---|---|
ping [host] | Check connectivity to a host |
ifconfig | Display network interface configuration |
netstat -tuln | Show active network connections |
curl -I [url] | Fetch HTTP headers from a URL |
scp [file] [user]@[host]:[path] | Securely copy files over SSH |
| File Management | |
|---|---|
find [path] -name [filename] | Search for a file by name |
ls -l [directory] | List contents of a directory |
rm -r -f | Remove files and directory |
locate [filename] | Quickly find a file by name |
chmod -c -R | Change file read/write/execute permissions |
touch -a -t | Modify (or create) file timestamp |
chown -c -R | Change file ownership |
chgrp -c -R | Change file group permission |
| File Compression | |
|---|---|
tar xvfz | Create or extract .tar or .tgz files |
gzip / gunzip / zcat | Create, extract or view .gz files |
uuencode / uudecode | Create or extract .Z files |
zip / unzip -v | Create or extract .ZIP files |
rpm | Create or extract .rpm files |
bzip2 / bunzip2 | Create or extract .bz2 files |
rar | Create or extract .rar files |
| Disk Utilities | |
|---|---|
df -h, -i | Show file system usage |
mkfs -t -V | Create file system |
resize2fs | Update filesystem after lvextend |
fsck -A -N | File system check & repair |
pvcreate | Create physical volume |
mount -a -t | Mount a filesystem |
fdisk -l | Edit disk partition |
lvcreate | Create a logical volume |
umount -f -v | Unmount a filesystem |
| File Utilities | |
|---|---|
tr -d | Translate or delete characters |
uniq -c -u | Report or omit repeated lines |
split -l | Split file into pieces |
wc -w | Print newline, word, and byte counts |
head -n | Output the first part of files |
cut -s | Remove section from file |
diff -q | Compare files line by line |
join -i | Join lines of two files on common field |
more / less | View file content, one page at a time |
sort -n | Sort lines in text file |
comm -3 | Compare two sorted files line by line |
cat -s | Concatenate files (suppress blank lines) |
tail -f | Output last part of file (follow) |
| Directory Utilities | |
|---|---|
mkdir | Create a directory |
rmdir | Remove a directory |
find | Search for a file |
find src/app -type f -name 'page.tsx' | Recursively lists all page.tsx files under src/app |
ls -a -C -h | List content of directory |
rm -r -f | Remove files and directory |
locate -i | Find file using updatedb database |
cp -a -R -i | Copy files or directory |
du -s | Show disk usage |
file -b -i | Identify file type |
mv -f -i | Move files or directory |
grep -i -v | Print lines matching a pattern |
| File Editors | |
|---|---|
vi | Visual editor |
nano | Pico clone (simple editor) |
view | View file only |
emacs | Extensible, customizable editor |
sublime | Text editor |
sed | Stream editor |
pico | Simple text editor |
| Memory & Processes | |
|---|---|
free -m | Display free and used memory |
killall | Stop all processes by name |
sensors | Show CPU temperature |
top | Real-time process monitoring |
kill -1 -9 | Send signal to process |
service start|stop|restart | Manage service |
ps aux | Display running processes |
dmesg -k | Display kernel messages |