Introduction
Unix is a powerful, multiuser, multitasking operating system used widely in both servers and workstations. Mastering Unix commands is essential for navigating and managing Unix-based systems efficiently. This cheat sheet provides a quick reference to some of the most commonly used Unix commands.
Unix Commands Cheat Sheet
Here’s a handy cheat sheet of the most commonly used Unix commands:
Command | Description |
---|---|
ls |
Lists directory contents. |
cd |
Changes the current directory. |
pwd |
Prints the current working directory. |
mkdir |
Creates a new directory. |
rmdir |
Removes an empty directory. |
rm |
Removes files or directories. |
cp |
Copies files or directories. |
mv |
Moves or renames files or directories. |
touch |
Creates an empty file or updates the timestamp of an existing file. |
cat |
Concatenates and displays the content of files. |
more |
Displays the content of a file one screen at a time. |
less |
Similar to more , but allows backward movement in the file. |
head |
Displays the first few lines of a file. |
tail |
Displays the last few lines of a file. |
grep |
Searches for patterns in files. |
find |
Searches for files in a directory hierarchy. |
chmod |
Changes file permissions. |
chown |
Changes file ownership. |
ps |
Displays information about running processes. |
kill |
Sends a signal to terminate a process. |
df |
Reports file system disk space usage. |
du |
Estimates file space usage. |
top |
Displays tasks and system resource usage in real-time. |
ifconfig |
Configures network interfaces. |
ping |
Checks network connectivity. |
ssh |
Opens a secure shell connection to a remote machine. |
scp |
Copies files between hosts over a secure, encrypted connection. |
wget |
Downloads files from the web. |
curl |
Transfers data from or to a server. |
tar |
Archives files. |
gzip |
Compresses files. |
gunzip |
Decompresses files. |
zip |
Creates compressed ZIP archives. |
unzip |
Extracts files from a ZIP archive. |
man |
Displays the manual page for a command. |
alias |
Creates an alias for a command. |
unalias |
Removes an alias. |
echo |
Displays a line of text or variable value. |
export |
Sets environment variables. |
env |
Displays environment variables. |
history |
Shows the command history. |
whoami |
Displays the current user ID. |
date |
Displays or sets the system date and time. |
uptime |
Shows how long the system has been running. |
uname |
Displays system information. |
hostname |
Shows or sets the system’s hostname. |
nano |
Opens the Nano text editor. |
vim |
Opens the Vim text editor. |
crontab |
Schedules commands to run at specified times. |
at |
Schedules commands to run once at a specified time. |
sudo |
Executes a command as another user, typically the superuser. |
passwd |
Changes the user password. |
su |
Switches to another user. |
adduser |
Adds a new user. |
deluser |
Deletes a user. |
Conclusion
Mastering Unix commands is essential for efficiently managing Unix-based systems. This cheat sheet provides a quick reference to some of the most commonly used commands, helping you navigate and operate your system more effectively. Keep this guide handy to make the most of Unix. Happy coding!