Master 100 Essential Linux Shell Commands to Boost Your Productivity
This comprehensive guide introduces the 100 most frequently used Linux shell commands, covering file, directory, permission, network, process, system, and scripting operations with clear explanations and practical examples, helping both beginners and professionals improve efficiency and mastery of the command line.
In most Linux and Unix-like systems, the shell is the primary interface for users to interact with the kernel, offering powerful command‑line interpretation and scripting capabilities.
Whether you are a beginner or a professional, mastering shell commands is essential; this article explains and demonstrates the 100 most commonly used shell commands with practical examples.
File Operations Commands
ls – list directory contents ls /home cd – change directory cd /home/user/Documents pwd – print working directory pwd cat – view file contents cat /etc/passwd more – paginate file view more /var/log/syslog less – reverse paginate file view less /var/log/syslog touch – create empty file or update timestamps touch /home/user/newfile.txt cp – copy files or directories cp /home/user/file.txt /home/user/Documents mv – move or rename files or directories
mv /home/user/file.txt /home/user/Documents/newfile.txtrm – delete files or directories rm /home/user/unwantedfile.txt find – search for files or directories find / -name '*.log' grep – search for patterns within files grep 'error' /var/log/syslog head – output the beginning of a file head -n 10 /var/log/syslog tail – output the end of a file tail -n 20 /var/log/syslog sort – sort lines of text sort /etc/passwd wc – count words, lines, bytes wc /var/log/syslog cut – cut sections from each line of a file cut -d: -f1 /etc/passwd nano, vi, emacs – common text editors
nano /home/user/file.txt
vi /home/user/file.txt
emacs /home/user/file.txtpaste – merge lines of files
paste file1.txt file2.txtSearch Commands
find – locate files or directories find / -name '*.log' grep – search for text patterns grep 'error' /var/log/syslog locate – fast filename lookup using a database locate myFile.txt which – show the path of an executable which java ack – programmer‑oriented search tool ack 'your_search_term' ag (The Silver Searcher) – faster code search ag 'your_search_term' whereis – locate binaries, sources, and manuals whereis ls type – identify command type (builtin, file, alias) type pwd apropos – search manual page descriptions apropos partition alias – create shortcuts for frequently used commands
alias l='ls -al'Directory Operations Commands
mkdir – create a new directory mkdir /home/user/new_directory rmdir – remove an empty directory rmdir /home/user/empty_directory tree – display directory tree tree /home/user/ du – estimate disk usage of files/directories du -sh /home/user/Documents df – report file system disk space usage
df -hPermission Operations Commands
chmod – change file or directory permissions chmod 755 /home/user/file.txt chown – change file owner and group chown newuser:newgroup /home/user/file.txt chgrp – change group ownership
chgrp newgroup /home/user/file.txtNetwork Operations Commands
ping – test network connectivity ping www.linuxyz.cn ifconfig – display or configure network interfaces ifconfig eth0 netstat – show network connections, routing tables, etc. netstat -ntlp ssh – remote login or command execution ssh user@remote_host scp – securely copy files between hosts
scp /path/to/file user@remote_host:/remote/path/curl – retrieve network resources curl www.linuxyz.cn telnet – remote login tool telnet remote_host 23 nslookup – query DNS records nslookup www.linuxyz.cn ftp – FTP client ftp ftp_server wget – retrieve files from the web
wget www.linuxyz.cn -o google.htmlProcess and System Control Commands
ps – display current processes ps aux top – dynamic view of running processes top kill – send a signal to terminate a process kill 1234 shutdown – power off the machine shutdown -h now reboot – restart the machine reboot logout – end the login session
logoutText Operations Commands
echo – print text to terminal echo 'Hello, World!' printf – formatted output
printf 'Name: %s
Age: %d
' 'Alice' 20sed – stream editor for text manipulation echo 'Hello, World!' | sed 's/World/Shell/g' awk – pattern scanning and processing language
echo -e 'name age
Alice 20
Bob 22' | awk '{if ($2 >= 21) print $1}'Compression and Decompression Commands
tar – create, extract, and manage tar archives tar -cvf archive.tar folder gzip – compress files gzip file gunzip – decompress gzip files gunzip file.gz zip / unzip – handle zip archives
zip -r archive.zip folder
unzip archive.zipDisk Usage Management Commands
df – report file system disk space usage df -h du – estimate file and directory space usage du -sh folder fdisk – partition management sudo fdisk -l hdparm – view or modify SATA/ATA parameters
sudo hdparm -i /dev/sdaPackage Management Commands
apt-get – APT package handling (Debian/Ubuntu) sudo apt-get install package dpkg – Debian package manager sudo dpkg -i package.deb yum – RPM package handling (RedHat/CentOS) sudo yum install package rpm – RPM package manager
sudo rpm -i package.rpmProcess Management Commands
ps – report process status ps aux top – dynamic view of resource‑intensive processes top htop – improved interactive process viewer htop kill – terminate a process kill 1234 pkill – terminate processes by name
pkill process_nameEnvironment Variable Commands
env – display all environment variables env set – display shell variables and functions set export – set or display environment variables
export VARName='Value'
echo $VARNameSystem Information Commands
uname – print operating system name uname hostname – show system hostname hostname dmesg – print or control kernel ring buffer dmesg | less df – display disk space usage df -h free – show memory and swap usage free -h uptime – show how long the system has been running uptime last – view reboot and shutdown records last reboot w – show who is logged in and what they are doing w who – display logged‑in users (simpler than w) who id – show user UID, GID, and groups
idSystem Control Commands
halt – power off the system sudo halt reboot – restart the system sudo reboot shutdown – power off or reboot with options
sudo shutdown -h now
sudo shutdown -r nowpasswd – change user password
passwdText Editor Commands
vi/vim – classic and improved text editors
nano – simple command‑line editor
emacs – powerful, extensible editor
Other Useful Commands
man – view command manual pages
whatis – brief description of a command
whereis – locate binaries, sources, and manuals whereis ls which – show full path of a command which ls whoami – print effective username whoami date – display or set system date and time date cal – display a calendar cal alias / unalias – create or remove command aliases
history – show command history
clear – clear the terminal screen
watch – execute a program periodically and show output watch -n 2 date Most people learn shell scripting to improve efficiency: write a task once and let the computer handle it, automate repetitive actions, and gain flexible control over users and programs. Mastering these commands gives you powerful control over a Linux system.
In the future, the best way to explore the unknown is to try it yourself; may this complete list of 100 commands become your compass in the Linux world. Mastering shell commands and using them in scripts can greatly boost productivity for system administration and programming alike.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Open Source Linux
Focused on sharing Linux/Unix content, covering fundamentals, system development, network programming, automation/operations, cloud computing, and related professional knowledge.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
