- List files:
ls
- Change directory:
cd
- Print working directory:
pwd
- Create a directory:
mkdir
- Remove a directory:
rmdir
- Remove a file:
rm
- Copy a file:
cp
- Move or rename a file:
mv
- Display file contents:
cat
- Display file contents page by page:
less
- Search for a string in a file:
grep
- Count lines, words, and characters:
wc
- Sort lines in a file:
sort
- Display unique lines:
uniq
- Replace text in a file:
sed 's/old_text/new_text/g'
Networking
- Check network configuration:
ifconfig
- Display current IP address:
hostname -I
- Ping a host:
ping
- Check open ports:
netstat -tuln
- Trace the route to a host:
traceroute
Process Management
- List running processes:
ps aux
- Find a process by name:
pgrep
- Kill a process:
kill
- Kill a process by name:
pkill
- View system resource usage:
top
System Information
- Show disk usage:
df -h
- Show memory usage:
free -h
- Show system uptime:
uptime
- Show current users:
who
- Clear terminal screen:
clear
- Display current date and time:
date
- Get help for a command:
man
- Exit the terminal:
exit
Bash Command Cheat Sheet
Bash Command Cheat Sheet
File and Directory Commands
- List files:
ls
- Change directory:
cd
- Print working directory:
pwd
- Create a directory:
mkdir
- Remove a directory:
rmdir
- Remove a file:
rm
- Copy a file:
cp
- Move or rename a file:
mv
- Display file contents:
cat
- Display file contents page by page:
less
- Search for a string in a file:
grep
- Count lines, words, and characters:
wc
- Sort lines in a file:
sort
- Display unique lines:
uniq
- Replace text in a file:
sed 's/old_text/new_text/g'
Networking
- Check network configuration:
ifconfig
- Display current IP address:
hostname -I
- Ping a host:
ping
- Check open ports:
netstat -tuln
- Trace the route to a host:
traceroute
Process Management
- List running processes:
ps aux
- Find a process by name:
pgrep
- Kill a process:
kill
- Kill a process by name:
pkill
- View system resource usage:
top
System Information
- Show disk usage:
df -h
- Show memory usage:
free -h
- Show system uptime:
uptime
- Show current users:
who