Linux CLI & Bash Cheat Sheet — Essential Terminal One-Liners

High-frequency Linux terminal commands for file management, process monitoring, disk space, pipes, and server administration.

File & Directory Navigation

ls -la

List all files including hidden dotfiles with file sizes, owners, and permissions

find . -name "*.log" -type f

Find all files ending in .log recursively from current directory

grep -rn "API_KEY" src/

Search for text recursively showing line numbers in folder src/

tar -czvf archive.tar.gz folder/

Compress folder into a gzip tarball

tar -xzvf archive.tar.gz

Extract a gzip tarball to current folder

System, Disk & Network

df -h

Show human-readable disk space usage across mounted drives

du -sh * | sort -hr

List folder sizes in current directory sorted from largest to smallest

lsof -i :3000

Identify what process or PID is listening on port 3000

kill -9 <PID>

Force terminate a process by its process ID

htop

Interactive visual process viewer and CPU/RAM monitor

Permissions & Ownership

chmod +x script.sh

Grant execute permission to script file

chmod -R 755 /var/www

Set read/write/execute for owner, read/execute for others recursively

chown -R user:group folder/

Change owner and group recursively