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. Whether you’re a beginner learning Linux basics or an advanced user 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.

Apr 09, 2025 - 16:54
103.4k
Top 100 Most Useful Linux Commands with Examples, Usage, and Output for Beginners and Advanced Users

Table of Contents

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, mastering essential Linux commands is crucial. This blog provides the top 100 Linux commands along with their real-time usage and expected outputs, designed to help both beginners and experts navigate 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.txt
rm -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

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.

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!

Frequently Asked Questions (FAQs)

ls is one of the most used commands to list files and directories in Linux.

Use the pwd command to display your current working directory.

The cd command is used to change the current working directory.

Use cat, less, or more to display the content of a file.

rm deletes files or directories, while rmdir only deletes empty directories.

Use the touch command to create an empty file.

Use mkdir to make a new directory.

Use the cp command to copy files or folders.

Use the mv command to move or rename files.

Use uname -a to display full system information.

Use the df -h command for human-readable disk usage.

Use free -h to view memory usage.

top shows real-time running processes and system usage.

Use ifconfig or ip a to see IP and network configuration.

Use ping followed by a website, like ping google.com.

Use apt install packagename to install software.

apt is used in Debian/Ubuntu, while yum is used in RedHat/CentOS systems.

Use ls -a to view all files, including hidden ones.

chmod changes the file permission of a file or directory.

Use chown user:group filename to change ownership.

grep is used to search text using patterns.

Use crontab -e to edit cron jobs for task scheduling.

sudo allows you to run commands as another user, typically the superuser.

Use kill PID or killall processname to terminate it.

man displays the manual of a command, e.g., man ls.

Use tar -cvf archive.tar folder/ to compress it into a tarball.

Use unzip filename.zip or tar -xvf archive.tar.

ps aux shows all active processes in the system.

Use find / -name filename to search across directories.

Use the clear command to wipe the terminal display.

What's Your Reaction?

Like Like 0
Dislike Dislike 0
Love Love 0
Funny Funny 0
Wow Wow 0
Sad Sad 0
Angry Angry 0
Vaishnavi

Vaishnavi is a skilled tech professional at the Ethical Hacking Training Institute in Pune, responsible for managing and optimizing the technical infrastructure that supports advanced cybersecurity education. With deep expertise in network security, backend operations, and system performance, she ensures that practical labs, online modules, and assessments run smoothly and securely. Her behind-the-scenes contributions play a vital role in delivering a seamless and secure learning experience for aspiring ethical hackers.