Linux Commands

Essential Linux/Unix commands reference. Search by command or description to find exactly what you need.

File Operations

ls -lah

List all files with details & hidden files

cp -r <src> <dest>

Copy directory recursively

mv <src> <dest>

Move or rename file/directory

rm -rf <path>

Force remove directory recursively

mkdir -p <path>

Create directory tree (if needed)

find . -name "*.log"

Find files by name recursively

chmod +x <file>

Make file executable

chown user:group <file>

Change ownership

Process Management

ps aux | grep <name>

Find running process by name

kill <pid>

Terminate process by PID

killall <name>

Terminate all processes by name

systemctl status <service>

Check service status

top

View live system processes

htop

Interactive process viewer

Networking

ping <host>

Test connectivity to host

curl -I <url>

Fetch headers from URL

wget <url>

Download file from URL

netstat -tulpn

Show all listening ports

ip addr

Show IP addresses

ssh user@host

Secure Shell remote login

Archives & Compression

tar -czvf archive.tar.gz <dir>

Compress directory to tar.gz

tar -xzvf archive.tar.gz

Extract tar.gz archive

zip -r archive.zip <dir>

Zip directory recursively

unzip archive.zip

Extract zip archive

Search & Text

grep -r "text" .

Search text in files recursively

cat <file>

Output file contents

tail -f <file>

Follow file output (live logs)

head -n 10 <file>

Show first 10 lines

sed -i "s/old/new/g" <file>

Replace text in file

System Info

uname -a

Show kernel & system info

df -h

Disk space usage (human readable)

du -sh <dir>

Directory size summary

free -h

Show memory usage

history

Show command history

# Essential Linux Commands Reference

Mastering the Linux command line is crucial for developers and system administrators. This cheat sheet covers the most frequently used commands for file management, system monitoring, networking, and more.

From simple file operations like ls and cp to powerful networking tools like netstat and curl, having these commands at your fingertips will significantly improve your productivity in Unix-based environments.

Tips

  • Use man <command> to read the full manual page for any command.
  • Most commands support the --help flag for a quick summary of options.
  • Combine commands using pipes | to build powerful workflows (e.g., ps aux | grep node).