Quick reference

Bash Commands Cheat Sheet

A practical Bash commands cheat sheet, covering file operations, system management, network tools, and more, helping developers quickly master Linux/Unix command line skills.

· Published · Updated

Scope. Bash plus external Unix utilities. Package managers and terminal tab shortcuts depend on your distribution and terminal application. jobs lists jobs managed by the current shell, not all system processes. GNU and BSD sed -i syntax differs.

This page provides a visual cheat sheet of Bash commands, including file operations, system management, network tools, and more.

File Operations

Operation Command
List files in current directory ls
Change directory cd [directory]
Create new directory mkdir [directory]
Delete file rm [file]
Move/Rename file mv [source] [destination]
Copy file cp [source] [destination]
View file content cat [file]
Find files find [path] -name [filename]

System Management

Operation Command
Show current path pwd
Show system info uname -a
Show current user whoami
Switch user su [username]
Run command as superuser sudo [command]
Install package (Debian-based) sudo apt-get install [package]
Install package (RedHat-based) sudo yum install [package]
Update package list (Debian-based) sudo apt-get update
Update package list (RedHat-based) sudo yum check-update

Network Tools

Operation Command
View network config ifconfig
Test network connectivity ping [host or IP]
Trace route traceroute [host or IP]
Download file wget [URL]
Upload file scp [local_file] [user]@[host]:[remote_path]
List jobs managed by the current shell jobs
Terminate process kill [PID]
Terminate current process Ctrl + C

Text Processing

Operation Command
Find text grep [text] [file]
Replace text sed -i 's/[old]/[new]/g' [file]
Sort file sort [file]
Count lines wc -l [file]
Show first 10 lines head -n 10 [file]
Show last 10 lines tail -n 10 [file]

Compression & Extraction

Operation Command
Compress folder tar -czvf [archive].tar.gz [folder]
Extract file tar -xzvf [archive].tar.gz
Create zip archive zip -r [archive].zip [folder]
Extract zip archive unzip [archive].zip

Miscellaneous

Operation Command
Clear screen Ctrl + L
Exit terminal exit
Close current tab Ctrl + Shift + W
Switch between tabs Ctrl + Tab
Open new terminal window Ctrl + Shift + N

Official reference

Related topics