Linux Commands Cheatsheet
System Information
Command | Description |
---|---|
uname -a | Display Linux system information |
top | Show system resource usage and running processes |
free | Display available memory and swap space |
df -h | Show disk space usage |
du -sh | Show size of a directory |
uptime | Show system uptime |
User Management
Command | Description |
---|---|
useradd | Create a new user |
passwd | Set user password |
usermod | Modify user account |
userdel | Delete a user |
su | Switch user |
sudo | Execute a command as a superuser |
chown | Change file ownership |
chgrp | Change file group ownership |
chmod | Change file permissions |
File Management
Command | Description |
---|---|
ls | List directory contents |
cd | Change current directory |
pwd | Print working directory |
mkdir | Create a new directory |
touch | Create a new empty file |
cp | Copy files or directories |
mv | Move or rename files or directories |
rm | Remove files or directories |
ln | Create a symbolic link |
Text Editing
Command | Description |
---|---|
nano | Simple text editor |
vi | Advanced text editor |
sed | Stream editor |
grep | Search for a pattern in a file or input |
awk | Text processing and pattern matching |
Network Management
Command | Description |
---|---|
ping | Check network connectivity |
traceroute | Show the route packets take to a network host |
netstat | Show network connections and statistics |
ifconfig | Configure network interfaces |
route | Show or modify the IP routing table |
iptables | Configure firewall rules |
ssh | Securely connect to a remote system |
Process Management
Command | Description |
---|---|
ps | Show running processes |
kill | Terminate a process |
nice | Set process priority |
nohup | Run a command that persists even if the terminal is closed |
screen | Create a virtual terminal session |
bg | Run a command in the background |
fg | Bring a command running in the background to the foreground |
jobs | List all background jobs |
Package Management
Command | Description |
---|---|
apt-get | Install or remove software packages |
dpkg | Install or remove individual software packages |
yum | Install or remove software packages (Red Hat-based systems) |
rpm | Install or remove individual software packages (Red Hat-based systems) |
System Administration
Command | Description |
---|---|
cron | Schedule recurring tasks |
systemctl | Manage system services (systemd-based systems) |
service | Manage system services (init-based systems) |
hostname | Set or display the system hostname |
date | Display or set the system date and time |
reboot | Reboot the system |
shutdown | Shut down the system |
tar | Create or extract tar archives |
Miscellaneous
Command | Description |
---|---|
echo | Display a message on the terminal |
history | Show command history |
clear | Clear the terminal screen |
whoami | Display the current user name |
uname | Show system information |
man | Show the manual for a command |
which | Show the location of a command |
whereis | Show the location of a command and its documentation |
find | Search for files or directories |
du | Show disk usage of files or directories |
id | Display user and group information |
time | Measure the time it takes for a command |