π§° Complete Linux/Unix Commands List & Basic Utilities β Cheat Sheet for Beginners
π§² Introduction β Why Master Linux/Unix Commands?
At the heart of Linux/Unix is the command line. Whether you’re managing servers, automating scripts, or navigating the file system, knowing the right commands makes you faster and more powerful. These basic utilities are the essential building blocks of everything from system administration to development.
π― In this guide, youβll learn:
- Frequently used Linux/Unix commands and their syntax
- Basic file, directory, and system management tools
- Real examples with practical output
- Categories of commands: navigation, file handling, text processing, system info
π File and Directory Management Commands
Command | Description |
---|---|
pwd | Print current working directory |
ls | List files and directories |
cd | Change directory |
mkdir | Create new directory |
rmdir | Remove empty directory |
touch | Create a new empty file |
rm | Delete files or directories |
cp | Copy files or directories |
mv | Move or rename files |
π§ͺ Example:
mkdir test
cd test
touch file.txt
ls -l
π File Viewing and Content Commands
Command | Description |
---|---|
cat | View file content |
more | View file page-by-page |
less | Scrollable file viewer |
head | Show beginning of a file |
tail | Show last lines of a file |
wc | Word, line, and character count |
nl | Number lines while displaying content |
π§ͺ Example:
cat myfile.txt
head -n 5 myfile.txt
wc myfile.txt
βοΈ Text Processing Utilities
Command | Description |
---|---|
grep | Search for patterns in text |
cut | Remove selected columns/fields |
awk | Pattern scanning and processing |
sed | Stream editing (find/replace) |
sort | Sort lines of text files |
uniq | Filter duplicate lines |
tr | Translate or delete characters |
diff | Compare two files |
cmp | Compare files byte by byte |
π§ͺ Example:
grep "error" logs.txt
awk '{print $1}' data.csv
sort names.txt | uniq
π₯οΈ System Information Commands
Command | Description |
---|---|
date | Show current date and time |
cal | Display calendar |
uptime | Show how long system has been running |
whoami | Show current user |
id | Show UID, GID, and groups |
hostname | Show system hostname |
uname -a | Display system information |
df -h | Disk space usage |
free -m | Show memory usage in MB |
π§ͺ Example:
date
uname -a
df -h
π File Permissions and Ownership
Command | Description |
---|---|
chmod | Change file permissions |
chown | Change file ownership |
chgrp | Change group ownership |
umask | Set default permission mask |
stat | Show file metadata |
π§ͺ Example:
chmod 755 script.sh
chown user:group script.sh
π§ Process and Job Control
Command | Description |
---|---|
ps | List current processes |
top | Real-time process viewer |
kill | Send signal to process |
jobs | Show background jobs |
bg /fg | Resume background/foreground jobs |
nice | Set process priority |
killall | Kill all processes by name |
π§ͺ Example:
ps aux
kill 1234
top
π¦ Archive and Compression Utilities
Command | Description |
---|---|
tar | Archive files |
gzip | Compress files |
gunzip | Decompress .gz files |
zip | Create ZIP files |
unzip | Extract ZIP files |
π§ͺ Example:
tar -czf archive.tar.gz myfolder/
unzip myfile.zip
π Network Utilities
Command | Description |
---|---|
ping | Check network connectivity |
ifconfig | View network interfaces (deprecated for ip ) |
ip addr | Show IP addresses |
netstat | View network connections |
ss | Replacement for netstat |
curl | Transfer data from/to a server |
wget | Download files from the internet |
host / dig | DNS lookup |
π§ͺ Example:
ping google.com
curl ifconfig.me
ip addr
π Search Commands
Command | Description |
---|---|
find | Search for files and directories |
locate | Find files quickly using a database |
which | Show path of a command |
type | Show if a command is built-in or external |
whereis | Locate source, binary, and man page of command |
π§ͺ Example:
find /etc -name "*.conf"
which bash
π οΈ Miscellaneous Utilities
Command | Description |
---|---|
echo | Print text to terminal |
history | Show command history |
alias | Create shortcut commands |
clear | Clear the terminal screen |
man | Manual pages for commands |
help | Show help for built-in commands |
π§ͺ Example:
alias ll='ls -alF'
history | grep ssh
man tar
π Summary β Recap & Next Steps
π Key Takeaways:
- Linux/Unix provides a wide range of command-line utilities for working with files, processes, networks, and text.
- Each command has options (
-l
,-h
,--help
) to customize behavior. - You can combine commands using pipes (
|
) and redirection (>
,<
,>>
) for powerful workflows.
βοΈ Mastering these utilities is your gateway to automation, scripting, and professional system administration.
Next: Explore Linux Built-in Functions & System Calls like printf()
, fork()
, and open()
.
β FAQs
β How can I learn all Linux commands?
β
Start with frequently used commands (ls
, cd
, grep
) and use man <command>
to explore more.
β What is the difference between cat
, less
, and more
?
β
cat
prints full content; less
and more
let you scroll page-by-page. less
is more advanced and preferred.
β How do I find the path of a command in Linux?
β
Use which <command>
or type <command>
.
β How can I count the number of lines in a file?
β
Use:
wc -l filename.txt
β How do I search text inside files?
β
Use:
grep "pattern" filename.txt
Share Now :