UNIX Commands - Quick Reference
File and Directory Commands
ls -: Lists files and directories.
cd -: Changes the current directory.
pwd -: Prints the current working directory.
mkdir -: Creates a new directory.
rmdir -: Removes an empty directory.
rm -: Deletes files or directories.
touch -: Creates an empty file or updates file timestamps.
cp -: Copies files or directories.
mv -: Moves or renames files or directories.
find -: Searches files and directories based on conditions.
tree -: Displays directory structure in tree format.
File Viewing and Content
cat -: Displays the content of a file.
more -: Views file content page by page (forward only).
less -: Views file content (forward and backward).
head -: Shows the first few lines of a file.
tail -: Shows the last few lines of a file.
wc -: Counts lines, words, and characters.
cut -: Extracts sections from each line of input.
sort -: Sorts lines of text files.
uniq -: Removes duplicate lines from a sorted file.
diff -: Compares two files line by line.
Permissions and Ownership
chmod -: Changes file permissions.
chown -: Changes file owner.
chgrp -: Changes group ownership.
Search and Filter
grep -: Searches text using patterns.
egrep -: Extended version of grep with support for regex.
awk -: Pattern scanning and processing language.
sed -: Stream editor for filtering and transforming text.
System Info and Process
ps -: Displays current running processes.
top -: Displays real-time system processes.
kill -: Sends a signal to terminate a process.
killall -: Kills all processes by name.
uname -: Shows system information.
uptime -: Shows how long the system has been running.
whoami -: Shows current logged-in user.
id -: Shows user ID and group ID.
df -: Shows disk space usage.
du -: Shows disk usage of files and directories.
free -: Displays memory usage.
date -: Displays or sets the system date and time.
cal -: Displays a calendar.
Input/Output and Redirection
> -: Redirects output to a file (overwrite).
>> -: Appends output to a file.
< -: Takes input from a file.
| -: Pipes output of one command to another.
Compression and Archiving
tar -: Archives multiple files into one.
gzip -: Compresses files.
gunzip -: Decompresses gzip files.
zip -: Compresses files into .zip.
unzip -: Extracts .zip files.
User Management
useradd -: Adds a new user.
passwd -: Changes a user's password.
usermod -: Modifies a user account.
userdel -: Deletes a user.
groupadd -: Creates a new group.
Miscellaneous
echo -: Displays a line of text.
history -: Shows command history.
clear -: Clears the terminal screen.
alias -: Creates shortcuts for commands.
man -: Shows the manual of a command.
exit -: Exits the terminal session.