Mastering Linux begins with the command line. For beginners, learning the most commonly used Linux commands is the first step toward becoming confident in system navigation, file management, user administration, and more.
This guide covers the top 100 Linux commands, grouped into practical categories, each explained with beginner-friendly examples. Bookmark this article and start practicing right from your terminal!
π 1. File and Directory Management Commands
These commands help you navigate and manipulate files and directories.
pwd
β Prints the current working directory.
Example:pwd
ls
β Lists files and directories.
Example:ls -l
cd
β Changes the current directory.
Example:cd /home/user/Documents
mkdir
β Creates a new directory.
Example:mkdir myfolder
rmdir
β Removes an empty directory.
Example:rmdir myfolder
rm
β Deletes a file or directory.
Example:rm file.txt
,rm -r folder/
cp
β Copies files or directories.
Example:cp file1.txt file2.txt
mv
β Moves or renames files/directories.
Example:mv old.txt new.txt
touch
β Creates an empty file.
Example:touch notes.txt
tree
β Displays the directory structure in tree format.
Example:tree
π 2. File Viewing and Text Handling
Use these commands to read or manipulate file content.
cat
β Displays the contents of a file.
Example:cat file.txt
less
β Views file contents one page at a time.
Example:less file.txt
more
β Similar toless
, for paginated viewing.
Example:more file.txt
head
β Shows the first few lines of a file.
Example:head file.txt
tail
β Shows the last few lines of a file.
Example:tail file.txt
echo
β Prints a message or writes to a file.
Example:echo "Hello World" > hello.txt
nano
β Opens the nano text editor.
Example:nano file.txt
vi
/vim
β Opens the vi/vim editor.
Example:vim file.txt
cat >
β Creates and writes to a file.
Example:cat > new.txt
then type content, press Ctrl+Dcat >>
β Appends content to a file.
Example:cat >> new.txt
then type content, press Ctrl+D
π 3. Search and Find
Quickly locate files or text within files.
find
β Finds files and directories.
Example:find . -name "*.txt"
locate
β Fast file search using a database.
Example:locate passwd
grep
β Searches text in files.
Example:grep "search" file.txt
which
β Shows the path of an executable.
Example:which python
whereis
β Locates source, binary, and man pages.
Example:whereis ls
type
β Describes a command type.
Example:type cd
βοΈ 4. File Permissions and Ownership
Manage access rights to files and directories.
chmod
β Changes file permissions.
Example:chmod 755 script.sh
chown
β Changes file owner and group.
Example:chown user:group file.txt
chgrp
β Changes group ownership.
Example:chgrp staff file.txt
umask
β Displays or sets default permission mask.
Example:umask
stat
β Displays detailed file info.
Example:stat file.txt
π¦ 5. Package Management (Debian/Ubuntu)
Install and manage software packages.
apt update
β Updates the package list.
Example:sudo apt update
apt upgrade
β Upgrades all upgradable packages.
Example:sudo apt upgrade
apt install
β Installs a new package.
Example:sudo apt install nginx
apt remove
β Removes a package.
Example:sudo apt remove nginx
dpkg -i
β Installs a.deb
package manually.
Example:sudo dpkg -i package.deb
π» 6. System Monitoring and Info
Keep an eye on system performance and status.
top
β Displays running processes.
Example:top
htop
β Interactive process viewer.
Example:htop
uptime
β Shows how long the system has been running.
Example:uptime
free
β Displays memory usage.
Example:free -h
df
β Displays disk space usage.
Example:df -h
du
β Estimates file or directory size.
Example:du -sh *
ps
β Displays running processes.
Example:ps aux
uname -a
β Shows kernel and system info.
Example:uname -a
whoami
β Prints current username.
Example:whoami
id
β Displays UID and GID.
Example:id
π 7. Networking Commands
Check and troubleshoot network-related settings.
ping
β Checks connectivity to a host.
Example:ping google.com
curl
β Sends HTTP requests.
Example:curl example.com
wget
β Downloads files from the web.
Example:wget http://example.com/file.zip
ip a
β Shows IP address details.
Example:ip a
netstat
β Displays open ports and connections.
Example:netstat -tuln
ss
β Modern alternative to netstat.
Example:ss -tuln
traceroute
β Traces network path to a host.
Example:traceroute google.com
nslookup
β DNS lookup tool.
Example:nslookup github.com
hostname
β Displays or sets system hostname.
Example:hostname
π₯ 8. User and Group Management
Manage users, groups, and access control.
adduser
β Adds a new user.
Example:sudo adduser testuser
deluser
β Deletes a user.
Example:sudo deluser testuser
passwd
β Changes user password.
Example:passwd
usermod
β Modifies a user account.
Example:sudo usermod -aG sudo testuser
groupadd
β Creates a new group.
Example:sudo groupadd developers
groups
β Shows groups of a user.
Example:groups
π¦ 9. Archiving and Compression
Work with .tar
, .zip
, .gz
files.
tar -cvf
β Archives files.
Example:tar -cvf backup.tar folder/
tar -xvf
β Extracts tar files.
Example:tar -xvf backup.tar
gzip
β Compresses a file.
Example:gzip file.txt
gunzip
β Decompresses.gz
files.
Example:gunzip file.txt.gz
zip
β Creates a zip archive.
Example:zip archive.zip file.txt
unzip
β Extracts zip files.
Example:unzip archive.zip
π§° 10. Disk & Storage Management
Work with partitions and drives.
mount
β Mounts a device.
Example:mount /dev/sdb1 /mnt
umount
β Unmounts a device.
Example:umount /mnt
lsblk
β Lists block devices.
Example:lsblk
fdisk
β Partition management tool.
Example:fdisk -l
mkfs
β Creates a filesystem.
Example:mkfs.ext4 /dev/sdb1
fsck
β Checks a filesystem for errors.
Example:fsck /dev/sda1
β²οΈ 11. Job Scheduling
Run commands at a scheduled time.
crontab -e
β Edits the cron jobs.
Example:crontab -e
at
β Schedules a one-time task.
Example:echo "shutdown -h now" | at 10pm
π οΈ 12. System Services
Start, stop, and manage system services.
systemctl
β Manages systemd services.
Example:systemctl restart apache2
service
β Older method to manage services.
Example:service ssh start
journalctl
β Views system logs.
Example:journalctl -xe
π§ 13. Miscellaneous Useful Commands
history
β Shows your command history.
Example:history
alias
β Creates a shortcut for a command.
Example:alias ll='ls -la'
clear
β Clears the terminal screen.
Example:clear
man
β Shows the manual for any command.
Example:man ls
help
β Provides help for shell built-ins.
Example:help cd
date
β Displays the current date and time.
Example:date
cal
β Shows a calendar.
Example:cal
uptime
β Shows system uptime.
Example:uptime
reboot
β Restarts the system.
Example:reboot
shutdown
β Shuts down the system.
Example:shutdown now
who
β Shows who is logged in.
Example:who
w
β Shows who is logged in and what theyβre doing.
Example:w
π― Conclusion
Learning these 100 Linux commands will give you a solid foundation to explore the system further, script efficiently, and troubleshoot problems with ease. Start by practicing 5β10 commands daily. Use tools like man
and --help
flags to dig deeper.
Stay curious, keep practicing, and happy learning!