Bash, also known as the Bourne Again Shell, is the default command-line interpreter for most Linux operating systems. It allows users to interact with the system, manage files and processes, and execute scripts. To help beginners and experienced users alike, we have compiled a list of 50 commonly used Bash commands along with their descriptions and sample outputs.
50 Bash Commands Cheat Sheet
This reference table serves as a quick guide for your Bash-related tasks.
Command | Description |
---|---|
ls |
List directory contents |
pwd |
Print current working directory |
cd dir_name |
Change directory |
echo "Hello" |
Display a message or output |
man ls |
Display manual for a command |
mkdir new_dir |
Create a directory |
rmdir new_dir |
Remove a directory |
cat file.txt |
Display the contents of a file |
touch newfile.txt |
Create a new empty file or update timestamp |
rm file.txt |
Remove a file |
cp file1 file2 |
Copy file1 to file2 |
mv file1 dir1 |
Move file1 to dir1 directory |
date |
Display current date and time |
cal |
Display the calendar |
df |
Display disk space usage |
du |
Estimate file and directory space usage |
ps |
Display currently active processes |
top |
Display dynamic real-time view of running processes |
kill 12345 |
Kill process with PID 12345 |
bg |
Lists stopped or background jobs |
fg |
Brings a background job to the foreground |
history |
Display command history |
clear |
Clear the terminal |
chmod 755 file |
Change file permissions |
chown user:group file |
Change file owner and group |
find . -name "file.txt" |
Search for files in directory tree |
grep "word" file.txt |
Search for a word inside a file |
wc file.txt |
Count lines, words, and characters in a file |
sort file.txt |
Sort the lines of a file |
cut -d':' -f1 /etc/passwd |
Cut out sections from each line of files |
tar czf archive.tar.gz dir |
Create a compressed archive of a directory |
unzip file.zip |
Extract files from a zip archive |
alias ll='ls -la' |
Create an alias for a command |
uname -a |
Display system information |
ifconfig or ip a |
Display network interfaces and configurations |
ping google.com |
Ping google.com |
netstat -tuln |
Display network ports and listening services |
ssh user@host |
SSH to a remote host |
curl www.example.com |
Fetch the contents of a webpage |
wget www.example.com/file.zip |
Download a file from the internet |
This is a basic cheat sheet and there are many other options and arguments available for each command. Refer to the man pages (man command_name) for more detailed information on each command.