Top 100 Most Useful Linux Commands with Examples, Usage, and Output for Beginners and Advanced Users
If you're searching for the most important and frequently used Linux commands, this guide covers the top 100 Linux commands with detailed explanations, real examples, and output demonstrations. For beginners learning Linux basics and advanced users managing servers, this blog helps you understand file operations, process management, networking, permissions, system monitoring, and shell scripting using simple, effective Linux terminal commands. Master these commands to boost productivity and take full control of your Linux system like a pro.
Quick answer: The most useful Linux commands fall into groups. Use ls, cd, cp, mv and rm for files; cat, less and nano to read and edit; ps, top and kill for processes; chmod and chown for permissions; ping, ip and ss for networking; tar for archives; and cron for scheduling. Learn these first, then add the rest as your work needs them.
Key takeaways
- Group commands by task: ls, cp, mv and rm for files, ps, top and kill for processes, chmod and chown for permissions.
- Use man and the --help flag before running an unfamiliar command, especially rm and dd.
- Practise on a test machine, since a wrong recursive delete cannot be undone.
Table of Contents
- Introduction
- File and Directory Management
- File Viewing and Editing
- System Information and Monitoring
- Package Management (Debian/Ubuntu Based)
- What Are the Networking Commands?
- User and Group Management
- File Permissions and Ownership
- What Is Process Management?
- Compression and Archiving
- Disk and Partition Management
- Searching and Filtering
- Time and Date
- Job Scheduling
- Shell Customization and History
- Permissions and Security
- Miscellaneous
- Conclusion
- Frequently Asked Questions (FAQs)
Introduction
Linux is one of the most powerful and widely used operating systems for developers, cybersecurity professionals, and system administrators. Whether you’re managing servers or conducting penetration tests, you need to master essential Linux commands. Here are the top 100 Linux commands with their real-time usage and expected outputs, to help both beginners and experts use the command line efficiently.
File and Directory Management
ls
List the contents of a directory.ls /home/user
Output:
Documents Downloads Pictures
pwd
Prints the current working directory.pwd
Output:
/home/user
cd
Changes the directory.cd /var/log
mkdir
Creates a new directory.mkdir testfolder
rmdir
Deletes an empty directory.rmdir testfolder
rm
Removes files or directories.rm file.txtrm -r foldername
touch
Creates an empty file.touch notes.txt
cp
Copies files or directories.cp file1.txt backupfile.txt
mv
Moves or renames files.mv oldname.txt newname.txt
find
Searches for files and directories.find /home -name "*.txt"
File Viewing and Editing
cat
Displays the content of a file.cat file.txt
more
Displays file content page-by-page.more largefile.txt
less
Scrolls through file content interactively.less config.log
head
Shows the first 10 lines of a file.head data.csv
tail
Shows the last 10 lines of a file.tail data.csv
nano
Opens a file in the nano text editor.nano script.sh
vi
Opens a file using vi editor.vi index.html
System Information and Monitoring
uname -a
Displays system information.
top
Shows real-time processes and usage.
htop
Interactive process viewer (more user-friendly).
uptime
Displays how long the system has been running.
whoami
Shows the current logged-in user.
hostname
Displays or sets the system hostname.
free -h
Displays memory usage.
df -h
Shows disk usage of mounted partitions.
du -sh folder/
Shows space used by a directory.
vmstat
Provides system performance statistics.
Package Management (Debian/Ubuntu Based)
apt update
Refreshes package list.
apt upgrade
Upgrades all upgradable packages.
apt install
Installs new packages.apt install nmap
apt remove
Uninstalls a package.
dpkg -l
Lists installed packages.
dpkg -i
Installs a .deb package.dpkg -i chrome.deb
What Are the Networking Commands?
ping
Tests network connectivity.ping google.com
ifconfig
Displays network interface configuration.
ip a
Alternative to ifconfig for showing IPs.
netstat -tulnp
Lists all open ports and listening services.
ss -tuln
Displays active sockets.
traceroute
Traces packet path to a remote host.traceroute example.com
dig
Performs DNS lookup.dig google.com
nslookup
Another tool for DNS query.nslookup example.com
wget
Downloads files from a web server.wget http://example.com/file.zip
curl
Transfers data from or to a server.curl https://api.github.com
User and Group Management
adduser
Creates a new user.adduser john
userdel
Deletes an existing user.userdel john
passwd
Changes user password.passwd john
groupadd
Creates a new group.groupadd devs
usermod
Modifies a user account.usermod -aG sudo john
id
Displays UID and GID of a user.id john
who
Shows currently logged-in users.
File Permissions and Ownership
chmod
Changes file or directory permissions.chmod 755 script.sh
chown
Changes ownership of files.chown user:group file.txt
umask
Displays default permission value.
ls -l
Lists file permissions in detail.
What Is Process Management?
ps aux
Lists all running processes.
kill
Terminates a process by PID.kill 1234
killall
Kills all processes by name.killall firefox
xkill
Kills graphical applications by clicking.
bg
Resumes a background job.
fg
Brings a job to foreground.
Compression and Archiving
tar -cvf
Creates a tar archive.tar -cvf archive.tar folder/
tar -xvf
Extracts files from tar archive.tar -xvf archive.tar
zip
Compresses files into zip format.zip archive.zip file1 file2
unzip
Extracts zip archive.
gzip
Compresses using gzip.
gunzip
Decompresses .gz files.
Disk and Partition Management
mount
Mounts a file system.mount /dev/sdb1 /mnt/usb
umount
Unmounts a file system.umount /mnt/usb
fdisk -l
Lists partition tables.
parted
Advanced partition tool.
lsblk
Displays all block devices.
Searching and Filtering
grep
Searches text in files.grep "error" logs.txt
egrep
Extended pattern matching with grep.
awk
Processes and filters text.
sed
Stream editor for text substitution.
locate
Finds file paths quickly.
updatedb
Updates locate command's file database.
which
Shows location of an executable.which python
Time and Date
date
Shows current date and time.
cal
Displays calendar.
timedatectl
Controls date and time settings.
Job Scheduling
cron
Automates recurring tasks.
crontab -e
Edits user’s cron jobs.
at
Schedules one-time tasks.at now + 1 minute
Shell Customization and History
history
Shows previously executed commands.
alias
Creates shortcuts for commands.alias ll='ls -la'
unalias
Removes command alias.
clear
Clears the terminal screen.
echo
Prints text to the terminal.echo Hello, World!
Permissions and Security
sudo
Executes a command as another user.
su
Switches to another user.
gpasswd
Adds user to group with password.
visudo
Safely edits the sudoers file.
Miscellaneous
yes
Prints “yes” repeatedly.yes | apt install nmap
sleep
Delays command execution.sleep 5
watch
Runs a command repeatedly.watch -n 5 free -h
uptime
Displays system uptime.
dmesg
Displays kernel messages.
env
Shows environment variables.
man
Displays command manual.man ls
Conclusion
Mastering these 100 essential Linux commands can drastically improve your command-line efficiency, whether you're working on system administration, cybersecurity, or software development. From file manipulation and process management to networking and automation, these tools provide a solid foundation for any Linux environment. Bookmark this guide and refer to it often as you grow your Linux skills!
To take this further with guided labs and an instructor, see our Linux training in Pune.
Related reading
- 70+ Essential Windows CMD Commands for Beginners to Advanced Users
- Which are the Most Important Linux Commands: A Complete Guide
- Top 100 Most Useful Kali Linux Commands with Practical Examples for Ethical Hackers and Beginners
Reference
For the authoritative details, see Red Hat product documentation.
Frequently Asked Questions
What's Your Reaction?
Like
0
Dislike
0
Love
0
Funny
0
Wow
0
Sad
0
Angry
0