Introduction
Today, I will provide you all useful linux command list. Linux commands are the foundation of efficient system administration and server management. This comprehensive guide covers more than 50 essential Linux commands that every system administrator, developer, and power user should know.
From basic file operations to advanced system management, each command is explained with its syntax and practical examples.
Essential Linux Commands

pwd (Print Working Directory)
Use: Displays current working directory path
Syntax: pwd
Example:
$ pwd
/home/user/documentsls (List Directory Contents)
Use: Lists files and directories
Syntax: ls [options] [directory]
Example:
$ ls -la # List all files with details
$ ls -lh # List with human-readable sizes
$ ls -R # List recursivelycd (Change Directory)
Use: Changes current directory
Syntax: cd [directory]
Example:
$ cd ~ # Go to home
$ cd .. # Go up one level
$ cd - # Go to previous directorytree
Use: Displays directory structure
Syntax: tree [options] [directory]
Example:
$ tree -L 2 # Show 2 levels deepcp (Copy)
Use: Copies files and directories
Syntax: cp [options] source destination
Example:
$ cp -r dir1 dir2 # Copy directory
$ cp -p file1 file2 # Preserve attributesmv (Move)
Use: Moves/renames files
Syntax: mv [options] source destination
Examples:
$ mv file1 file2 # Rename file
$ mv -i * ../ # Move all files with promptrm (Remove)
Use: Removes files/directories
Syntax: rm [options] file(s)Examples:
$ rm -rf dir/ # Force remove directory
$ rm -i file.txt # Remove with promptmkdir (Make Directory)
Use: Creates directories
Syntax: mkdir [options] directory
Examples:
$ mkdir -p dir1/dir2 # Create parent directories
$ mkdir -m 755 dir # Create with permissionstouch
Use: Creates empty files/updates timestamps
Syntax: touch [options] file(s)
Examples:
$ touch file.txt
$ touch -t 202401191200 file # Set specific timecat (Concatenate)
Use: Displays/combines file content
Syntax: cat [options] file(s)
Examples:
$ cat file.txt
$ cat file1 file2 > file3less
Use: Views file content page by page
Syntax: less [options] file
Example:
$ less -N file.txt # Show line numbers
$ less /etc/updatedb.conf # Open a Text File
$ less -pERROR /etc/init/mysql.conf # Open File with Pattern Search
$ less -s welcome.txt # Remove Multiple Blank Lines
$ less welcome.txt aboutus.txt # Open Multiple Files
$ less +F /var/log/syslog # Real-Time Monitoringhead
Use: Shows first lines of file
Syntax: head [options] file
Example:
$ head -n 20 file.txt # Show first 20 linestail
Use: Shows last lines of file
Syntax: tail [options] file
Examples:
$ tail -f log.txt # Follow file updates
$ tail -n 50 file # Last 50 linesgrep (Global Regular Expression Print)
Use: Searches text patterns
Syntax: grep [options] pattern [file(s)]
Examples:
$ grep -i "error" *.log # Case-insensitive
$ grep -r "TODO" ./ # Recursive searchsed (Stream Editor)
Use: Text stream manipulation
Syntax: sed [options] 'command' file
Examples:
$ sed 's/old/new/g' file.txt
$ sed -i '1d' file.txt # Delete first lineawk
Use: Text processing tool
Syntax: awk [options] 'pattern {action}' file
Example:
$ awk '{print $1}' file.txt # Print first columntar
Use: Archives files
Syntax: tar [options] archive files
Examples:
$ tar -cvzf archive.tar.gz files/ # Create tar.gz file
$ tar -xvzf archive.tar.gz # Extract tar filegzip
Use: Compresses files
Syntax: gzip [options] file(s)
Example:
$ gzip file.txtzip/unzip
Use: Creates/extracts ZIP archives
Syntax: zip [options] zipfile files
Examples:
$ zip -r archive.zip directory/
$ unzip archive.zipuname
Use: Shows system information
Syntax: uname [options]
Example:
$ uname -a # All system infotop
Use: Shows running processes
Syntax: top [options]
Example:
$ top
$ top -u username # User specific processeshtop
Use: Interactive process viewer
Syntax: htop [options]
Example:
$ htop
$ htop --sort-key PERCENT_CPUps (Process Status)
Use: Shows process information
Syntax: ps [options]
Examples:
$ ps aux # All processes
$ ps -ef # Full process infodf (Disk Free)
Use: Shows disk space usage
Syntax: df [options]
Example:
$ df -h # Human readable sizesdu (Disk Usage)
Use: Shows file space usage
Syntax: du [options] [file(s)]
Example:
$ du -sh */ # Directory sizes26. free
Use: Shows memory usage
Syntax: free [options]
Example:
$ free -h # Human readableuseradd
Use: Creates new user
Syntax: useradd [options] username
Example:
$ sudo useradd -m -s /bin/bash usernamesudo (Superuser Do)
Use: Executes as superuser
Syntax: sudo command
Example:
$ sudo apt-get install phpmyadmin # Install PHPMyAdmin
$ sudo service apache2 restart # Restart Apache2 Server
$ sudo service apache2 start # Start Apache2 Server
$ sudo service apache2 stop # Stop Apache2 Server
$ sudo service apache2 status # Check Apache2 Statuspasswd
Use: Changes password
Syntax: passwd [options] [username]
Example:
$ sudo passwd usernamechown (Change Owner)
Use: Changes file ownership
Syntax: chown [options] owner:group file(s)
Example:
$ sudo chown user:group file.txtchmod (Change Mode)
Use: Changes file permissions
Syntax: chmod [options] mode file(s)
Examples:
$ chmod 755 script.sh
$ chmod +x file.shping
Use: Tests network connectivity
Syntax: ping [options] host
Example:
$ ping -c 4 google.comnetstat
Use: Shows network statistics
Syntax: netstat [options]
Example:
$ netstat -tuln # Active listening portsss (Socket Statistics)
Use: Investigates sockets
Syntax: ss [options]
Example:
$ ss -ltn # Listening TCP socketscurl
Use: Transfers data from/to servers
Syntax: curl [options] URL
Example:
$ curl -O https://example.com/filewget
Use: Downloads files from web
Syntax: wget [options] URL
Example:
$ wget -c https://example.com/fileifconfig/ip
Use: Configures network interface
Syntax: ip [options] object command
Examples:
$ ip addr show
$ ifconfig eth0ssh (Secure Shell)
Use: Remote system access
Syntax: ssh [options] user@host
Example:
$ ssh -p 2222 user@server.comscp (Secure Copy)
Use: Copies files over SSH
Syntax: scp [options] source destination
Example:
$ scp file.txt user@server:/pathkill
Use: Terminates processes
Syntax: kill [options] PID
Example:
$ kill -9 1234 # Force killpkill
Use: Kills processes by name
Syntax: pkill [options] pattern
Example:
$ pkill -f firefoxkillall
Use: Kills processes by name
Syntax: killall [options] name
Example:
$ killall -9 process_namenice
Use: Sets process priority
Syntax: nice [options] command
Example:
$ nice -n 10 commandnohup
Use: Runs command immune to hangups
Syntax: nohup command &
Example:
$ nohup ./script.sh &apt (Advanced Package Tool)
Use: Debian package management
Syntax: apt [options] command
Examples:
$ sudo apt update # Update package list
$ sudo apt upgrade # Upgrade installed packages
$ sudo apt autoremove # Remove unnecessary packagesdpkg
Use: Debian package manager
Syntax: dpkg [options] action
Example:
$ dpkg -i package.debyum/dnf
Use: RPM package management
Syntax: yum [options] command
Example:
$ sudo yum install packagesnap
Use: Universal Linux packages
Syntax: snap [options] command
Example:
$ sudo snap --version # Check snap version
$ sudo snap list # List installed snaps
$ sudo snap find "media player" # To search for snaps with ‘media player’ in either their names or descriptions, type snap find "media player" into your terminal:
$ sudo snap install <package_name> # Install snap >> See above examples
$ sudo snap install skype # Install Skype
$ sudo snap refresh # Update all snap packages
$ sudo snap refresh <package_name> # Update specific snap package
$ sudo snap remove <package_name> # Remove a snapsystemctl
Use: Controls systemd services
Syntax: systemctl [options] command service
Examples:
$ sudo systemctl start service
$ sudo systemctl stop service
$ sudo systemctl restart service
$ sudo systemctl enable service
$ sudo systemctl disable servicejournalctl
Use: Query systemd journal
Syntax: journalctl [options]
Example:
$ journalctl -u service -fcrontab
Use: Schedules tasks
Syntax: crontab [options]
Example:
$ crontab -e # Edit cron jobsat
Use: Schedules one-time task
Syntax: at time
Example:
$ at now + 1 hourConclusion
This comprehensive list of 50+ Linux commands covers the most essential tools for system administration and daily operations. While these commands form a solid foundation, Linux offers many more specialized commands and options.
To become proficient:
- Practice these commands regularly
- Read man pages for detailed information
- Combine commands to create powerful operations
- Stay updated with new tools and features
Remember that mastering these commands takes time and practice. Start with the basic commands and gradually incorporate more advanced ones into your workflow. Use the man pages (man command) and help options (command --help) to learn more about specific commands and their options.
For system administrators, it’s crucial to understand not just how to use these commands, but also their implications on system security and performance. Always test commands in a safe environment before using them on production systems.
Keep this guide as a reference, and continue exploring the vast capabilities of Linux command-line operations. Happy system administration!
Thank you for reading this article. Happy system administration!








