Linux is a powerful and versatile operating system, and mastering its command line interface (CLI) can significantly boost productivity. Here’s a list of the top 50 Linux commands every user should know.
1. Basic Commands
pwd
– Print the current working directory.pwd
ls
– List files and directories.ls -l
cd
– Change directory.cd /home/user/Documents
mkdir
– Create a new directory.mkdir my_folder
rmdir
– Remove an empty directory.rmdir my_folder
rm
– Remove files or directories.rm -r folder_name
cp
– Copy files and directories.cp file1.txt file2.txt
mv
– Move or rename files and directories.mv old_name.txt new_name.txt
touch
– Create an empty file.touch newfile.txt
find
– Search for files in a directory hierarchy.find /home -name filename.txt
2. File and Directory Permissions
chmod
– Change file permissions.chmod 755 file.sh
chown
– Change file ownership.chown user:group file.txt
ls -l
– View file permissions.ls -l file.txt
3. Process Management
ps
– Display currently running processes.ps aux
top
– Show real-time system processes.top
htop
– Interactive process viewer (if installed).htop
kill
– Terminate a process.kill PID
pkill
– Kill processes by name.pkill process_name
4. Networking Commands
ping
– Check network connectivity.ping google.com
ifconfig
– Display network configuration (deprecated, useip
).ifconfig
ip a
– Show IP address configuration.ip a
netstat
– Display network connections.netstat -tulnp
curl
– Transfer data from URLs.curl https://example.com
5. Disk Management
df
– Show disk space usage.df -h
du
– Show directory size.du -sh folder_name
mount
– Mount a filesystem.mount /dev/sdb1 /mnt
umount
– Unmount a filesystem.umount /mnt
fsck
– Check and repair filesystem errors.fsck /dev/sda1
6. User Management
whoami
– Show current user.who
– Show logged-in users.useradd
– Add a new user.sudo useradd newuser
passwd
– Change user password.passwd
groupadd
– Add a new group.sudo groupadd newgroup
7. System Monitoring and Logs
uptime
– Show system uptime.free
– Display memory usage.dmesg
– Show system boot logs.journalctl
– View system logs.history
– Show command history.clear
– Clear terminal screen.
8. Package Management
apt
(Debian-based systems)sudo apt update && sudo apt upgrade
yum
(RHEL-based systems)sudo yum install package_name
dnf
(Fedora-based systems)sudo dnf install package_name
pacman
(Arch-based systems)sudo pacman -S package_name
snap
– Install snap packages.sudo snap install package_name
9. Compression and Archiving
tar
– Compress and extract tar files.tar -cvf archive.tar folder_name
zip
– Create zip archive.zip archive.zip file.txt
unzip
– Extract zip files.unzip archive.zip
10. Miscellaneous Commands
echo
– Print a message.echo "Hello, Linux!"
cat
– Display file contents.cat file.txt
nano
/vim
– Edit text files.nano file.txt