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.

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)

What is the most commonly used Linux command?

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

How do I find my current directory in Linux?

Use the pwd command to display your current working directory.

What does the ‘cd’ command do in Linux?

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

How do I view the contents of a file?

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

What is the difference between ‘rm’ and ‘rmdir’?

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

How do I create a new file in Linux?

Use the touch command to create an empty file.

What command is used to create a new folder?

Use mkdir to make a new directory.

How do I copy files in Linux?

Use the cp command to copy files or folders.

How can I move or rename a file?

Use the mv command to move or rename files.

What command displays system information?

Use uname -a to display full system information.

How do I check available disk space?

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

What command shows memory usage in Linux?

Use free -h to view memory usage.

What is the ‘top’ command used for?

top shows real-time running processes and system usage.

How do I see network information in Linux?

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

What command checks internet connectivity?

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

How do I install software on Debian-based Linux systems?

Use apt install packagename to install software.

What is the difference between apt and yum?

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

How can I view hidden files in a directory?

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

What does the chmod command do?

chmod changes the file permission of a file or directory.

How do I change file ownership?

Use chown user:group filename to change ownership.

What is the purpose of the ‘grep’ command?

grep is used to search text using patterns.

How do I schedule a task in Linux?

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

What does ‘sudo’ mean in Linux?

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

How do I kill a running process?

Use kill PID or killall processname to terminate it.

What is the purpose of the ‘man’ command?

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

How do I compress a directory in Linux?

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

How can I unzip files in Linux?

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

What command shows running processes?

ps aux shows all active processes in the system.

How do I search for a file in Linux?

Use find / -name filename to search across directories.

How can I clear the terminal screen?

Use the clear command to wipe the terminal display.

Join Our Upcoming Class! Click Here to Join
Join Our Upcoming Class! Click Here to Join