Skip to content

Bash Command Cheat Sheet

This page provides a visual cheat sheet for Bash commands, including file operations, system management, network tools, and various other commonly used commands.

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 information uname -a
Show current user whoami
Switch user su [username]
Execute 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 configuration 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]
Show all processes in current directory jobs
Terminate process kill [PID]
Terminate current process Ctrl + C

Text Processing

Operation Command
Search 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 of file head -n 10 [file]
Show last 10 lines of file tail -n 10 [file]

Compression & Decompression

Operation Command
Compress folder tar -czvf [archive].tar.gz [folder]
Decompress 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