Blog
Linux Commands Cheat Sheet
Basic command | Meaning |
ls | List the contents of the current directory. |
cd | Change directory. |
pwd | Print the working directory. |
mkdir | Create a new directory. |
rmdir | Remove a directory. |
touch | Create a new file. |
rm | Remove a file. |
cp | Copy a file or directory. |
mv | Move or rename a file or director |
File and directory management | |
cat | Display the contents of a file. |
more | Display the contents of a file one page at a time. |
less | Display the contents of a file one page at a time, with the ability to scroll back up. |
head | Display the first few lines of a file. |
tail | Display the last few lines of a file. |
grep | Search for a pattern in a file. |
find | Search for files or directories based on criteria such as name, size, or date modified. |
tar | Create or extract archive files. |
File permissions | |
chmod | Changes the permissions on a file or directory. |
chown | Changes the ownership of a file or directory. |
chgrp | Changes the group ownership of a file or directory. |
File searching | |
find | Searches for files and directories based on various criteria. |
grep | Searches for text patterns in files. |
Text processing | |
cat | Concatenates files and prints them to standard output. |
head | Prints the first few lines of a file. |
tail | Prints the last few lines of a file. |
sort | Sorts the lines of a file in alphabetical or numerical order. |
uniq | Removes duplicate lines from a file. |
Networking | |
ifconfig | Displays information about network interfaces. |
ping | Tests network connectivity to a host. |
traceroute | Traces the path that packets take to a host. |
netstat | Displays information about network connections. |
Process management | |
ps | List all running processes. |
top | Display information about running processes, such as CPU and memory usage. |
kill | Terminate a process. |
nice | Change the priority of a process. |
renice | Change the priority of a running process. |
Network commands | |
ping | Test network connectivity to a host. |
traceroute | Trace the path that network packets take to a host. |
ifconfig | Display information about network interfaces. |
netstat | Display information about network connections. |
dig | Query DNS servers for information about domain names. |
System administration | |
ps | Displays information about running processes. |
top | Displays a dynamic real-time view of the system’s process activity. |
kill | Terminates a running process. |
reboot | Reboots the system. |
shutdown | Shuts down the system. |
Other useful commands | |
man | Display the manual page for a command. |
sudo | Run a command as the superuser. |
su | Switch to a different user account. |
clear | Clear the terminal screen. |
exit | Exit the terminal. |