UNIX Basic Command Line Interface Commands
January 19, 2026 9:25 pmThe Ultimate UNIX Command Reference Guide
Whether you are a system administrator or a developer, mastering the Command Line Interface (CLI) is essential. Below is a categorized list of over 60 essential UNIX commands to help you navigate and manage your system efficiently.
1. File & Directory Management
These commands allow you to navigate the file system and manipulate files and folders.
| Command | Description | Example |
|---|---|---|
ls |
List directory contents | ls -la |
cd |
Change directory | cd /var/log |
pwd |
Print working directory (where am I?) | pwd |
mkdir |
Make a new directory | mkdir my_folder |
rmdir |
Remove an empty directory | rmdir my_folder |
cp |
Copy files or directories | cp file.txt backup.txt |
mv |
Move or rename files/directories | mv old.txt new.txt |
rm |
rm file.txt |
|
touch |
Create empty file or update timestamp | touch index.html |
ln |
Create a link (shortcut) to a file | ln -s file.txt link.txt |
find |
Search for files in a directory hierarchy | find . -name "*.jpg" |
locate |
Find files by name (faster than find) | locate config.php |
2. Text Processing & Viewing
Commands for reading, searching, and modifying the contents of text files.
| Command | Description | Example |
|---|---|---|
cat |
Concatenate and display file content | cat file.txt |
head |
Output the first part of files | head -n 5 file.txt |
tail |
Output the last part of files | tail -f access.log |
more |
File perusal filter for CRT viewing | more file.txt |
less |
Advanced file perusal (backwards scrolling) | less file.txt |
grep |
Search for patterns in text | grep "error" log.txt |
sed |
Stream editor for filtering/transforming text | sed 's/old/new/g' file.txt |
awk |
Pattern scanning and processing language | awk '{print $1}' file.txt |
sort |
Sort lines of text files | sort names.txt |
uniq |
Report or omit repeated lines | sort file.txt | uniq |
wc |
Word, line, and character count | wc -l file.txt |
diff |
Compare files line by line | diff file1.txt file2.txt |
echo |
Display a line of text or variable | echo "Hello World" |
3. System Information & User Management
Monitor your system health and manage user accounts.
| Command | Description | Example |
|---|---|---|
date |
Display current date (Y,M,D example) | date +"%Y-%m-%d" |
whoami |
Display current effective user ID | whoami |
who |
Show who is logged on | who |
w |
Show who is logged on and what they are doing | w |
uptime |
Tell how long the system has been running | uptime |
uname |
Print system information | uname -a |
passwd |
Change user password | passwd |
df |
Report file system disk space usage | df -h |
du |
Estimate file space usage | du -sh * |
free |
Display amount of free and used memory | free -m |
id |
Print real and effective user and group IDs | id username |
last |
Show listing of last logged in users | last |
4. Network & Connectivity
Tools for communicating with other servers and checking network status.
| Command | Description | Example |
|---|---|---|
ping |
Send ICMP ECHO_REQUEST to network hosts | ping google.com |
ssh |
OpenSSH SSH client (remote login) | ssh user@host |
scp |
Secure copy (remote file copy) | scp file.txt user@host:/path |
wget |
Non-interactive network downloader | wget http://site.com/file.zip |
curl |
Transfer data from or to a server | curl -I google.com |
ip |
Show/manipulate routing, devices, policy | ip addr show |
netstat |
Print network connections and routing tables | netstat -tuln |
traceroute |
Print the route packets trace to network host | traceroute google.com |
5. Permissions & Process Control
Manage security and running programs.
| Command | Description | Example |
|---|---|---|
chmod |
Change file mode bits (permissions) | chmod 755 script.sh |
chown |
Change file owner and group | chown user:group file.txt |
sudo |
Execute a command as another user (root) | sudo apt update |
ps |
Report a snapshot of current processes | ps aux |
top |
Display Linux processes in real-time | top |
kill |
Send a signal to a process (terminate) | kill -9 1234 |
jobs |
List active jobs in current shell | jobs |
bg |
Put a job in the background | bg %1 |
fg |
Bring a job to the foreground | fg %1 |
6. Miscellaneous Utilities
Helpful tools for everyday tasks.
| Command | Description | Example |
|---|---|---|
man |
Display the online manual for commands | man ls |
sleep |
Delay for a specified amount of time | sleep 10 |
tar |
Archive utility (tape archive) | tar -czvf archive.tar.gz folder |
gzip |
Compress or expand files | gzip file.txt |
zip/unzip |
Package and compress (zip) files | unzip archive.zip |
history |
Show the command history list | history |
clear |
Clear the terminal screen | clear |
alias |
Create a shortcut for a command | alias ll='ls -la' |
exit |
Exit the current shell or terminal | exit |
Categorised in: Blog, COMP-10024, Portfolio
This post was written by amax
Comments are closed here.