50+ Essential Linux Commands Every User Should Know

50+ Essential Linux Commands Every User Should Know
Table of Content

Linux is a strong and versatile operating system. Many people use it for servers, software development, cybersecurity, and system administration. No matter if you're new to Linux or an expert handling complex systems, knowing Linux commands is key. They help with system navigation, file management, process control, network administration, and automation.

The command-line interface (CLI) in Linux gives users great control over the system. It helps them complete tasks more efficiently than using graphical interfaces. Linux commands simplify computing. They cover basic tasks like creating files and navigating directories. They also handle advanced tasks such as system monitoring and user management.

Knowing these 50+ Linux commands can help you work faster, boost your workflows, and easily fix system issues. This guide breaks down and explains the commands. It helps users of all skill levels make the most of Linux command-line tools. Knowing these 50+ Linux commands can help you work faster, boost your workflows, and easily fix system issues. This guide breaks down and explains the commands. It helps users of all skill levels make the most of Linux command-line tools.

1. Basic Linux Commands

These commands are the foundation of Linux and help users navigate the system.

 

  • pwd (Print Working Directory) – Displays the current directory path.

bash

pwd

  • ls (List Files and Directories) – Lists all files and directories in the current location.
    bash

    ls

ls -la   # Shows hidden files and detailed information

  • cd (Change Directory) – Moves between directories.
    bash
    cd /home/user/Documents  # Move to a specific directory

cd ..                    # Move up one directory level

  • mkdir (Make Directory) – Creates a new directory.
    bash

    mkdir new_folder
  • rmdir (Remove Directory) – Deletes an empty directory.
    bash

    rmdir old_folder
  • rm (Remove Files/Directories) – Deletes files and directories.
    bash

    rm file.txt           # Remove a file

rm -r directory_name  # Remove a directory and its contents

touch (Create a New File) – Creates an empty file.
bash

touch newfile.txt

2. File Management Commands

These commands help with handling and manipulating files.

  • cp (Copy Files and Directories) – Copies files and folders.
    bash

    cp file1.txt /destination/path/

cp -r folder1/ /destination/path/

  • mv (Move or Rename Files) – Moves files or renames them.
    bash

    mv oldname.txt newname.txt

mv file.txt /destination/path/

  • cat (View File Contents) – Displays the contents of a file.
    bash

    cat file.txt
  • nano (Edit a File in Nano Editor) – Opens files for editing.
    bash

    nano file.txt
  • vim (Edit a File in Vim Editor) – Opens the Vim text editor.
    bash

    vim file.txt
  • head (View the First Few Lines of a File)
    bash

    head -n 10 file.txt
  • tail (View the Last Few Lines of a File)
    bash

    tail -n 10 file.txt

3. File Permissions and Ownership

Linux is a multi-user system, so managing permissions and ownership is critical.

  • chmod (Change File Permissions)
    bash

    chmod 755 script.sh
  • chown (Change File Ownership)
    bash

    chown user:group file.txt
  • ls -l (View File Permissions)
    bash

    ls -l file.txt

4. Process Management Commands

These commands help you monitor and manage running processes.

  • ps (Show Running Processes)
    bash

    ps aux
  • top (Monitor System Resource Usage)
    bash

    top
  • htop (Interactive Process Viewer – Needs to be Installed)
    bash

    htop
  • kill (Terminate a Process by PID)
    bash

    kill 12345
  • killall (Kill a Process by Name)
    bash

    killall firefox
  • pkill (Kill Process by Name Without PID)
    bash

    pkill -9 processname
  • bg (Resume a Process in the Background)
    bash

    bg %1
  •  fg (Resume a Process in the Foreground)
    bash

    fg %1

5. Disk Management Commands

Managing disk space and filesystems is crucial for system administration.

  • df (Check Disk Usage)
    bash

    df -h
  • du (Check Directory Size)
    bash

    du -sh /home/user/
  • mount (Mount a Filesystem)
    bash

    mount /dev/sdb1 /mnt/
  • umount (Unmount a Filesystem)
    bash

    umount /mnt/

6. Networking Commands

These commands help with managing and troubleshooting network connections.

  • ping (Check Network Connectivity)
    bash

    ping google.com
  • ifconfig (Display Network Interface Details – Deprecated in favor of ip)
    bash

    ifconfig
  • ip (Modern Alternative to ifconfig)
    bash

    ip a
  • netstat (Show Network Statistics – Use ss Instead)
    bash

    netstat -tulnp
  • ss (Show Active Network Connections)
    bash

    ss -tulnp
  • traceroute (Trace Network Routes)
    bash

    traceroute google.com
  • wget (Download Files from the Internet)
    bash

    wget https://example.com/file.zip
  • curl (Send HTTP Requests or Fetch Files)
    bash

    curl -O https://example.com/file.zip
  • scp (Securely Copy Files Over SSH)
    bash

    scp file.txt user@server:/path/to/destination/
  • rsync (Efficient File Transfer & Synchronization)
    bash

    rsync -avz file.txt user@server:/path/to/destination/

7. User Management Commands

Essential for multi-user Linux environments.

  • whoami (Show Current User)
    bash

    whoami
  • who (Show Logged-in Users)
    bash

    who
  • id (Show User ID and Group ID)
    bash

    id
  • adduser (Create a New User)
    bash

    sudo adduser newuser
  • deluser (Delete a User)
    bash

    sudo deluser newuser
  • passwd (Change User Password)
    bash

    passwd

8. System Monitoring and Logs

Monitor system performance and log important events.

  • uptime (Show System Uptime and Load Average)
    bash

    uptime
  • free (Check RAM Usage)
    bash

    free -h
  • dmesg (View System Boot Logs)
    bash

    dmesg | tail
  • journalctl (View System Logs for Systemd Services)
    bash

    journalctl -xe
  • history (Show Command History)
    bash

    history

9. find (Search for Files and Directories)

Finds files and directories based on name, type, size, and other parameters.

bash

 

find /home/user -name "file.txt"  # Search for a file by name

find /var/log -type f -size +10M  # Find files larger than 10MB in /var/log

10. grep (Search for Text Within Files)

Searches for specific text in a file or output.

bash

 

grep "error" /var/log/syslog  # Search for 'error' in the syslog file

ps aux | grep apache          # Find running Apache processes

11. sed (Stream Editor for Modifying Files)

Edits text in files programmatically.

bash

 

sed 's/oldword/newword/g' file.txt  # Replace 'oldword' with 'newword' in file.txt

12. awk (Pattern Scanning and Processing)

Used for text processing and data extraction.

bash

 

awk '{print $1}' file.txt  # Print the first column of a file

13. tar (Create and Extract Archives)

Creates or extracts .tar archive files.

bash

 

tar -cvf archive.tar file1 file2  # Create an archive

tar -xvf archive.tar              # Extract an archive

14. zip and unzip (Compress and Extract Zip Files)

Used to compress and extract .zip files.

bash

 

zip archive.zip file1 file2  # Compress files into a zip

unzip archive.zip            # Extract a zip file

15. df (Check Disk Space Usage)

Displays the available and used disk space on filesystems.

bash

 

df -h  # Show disk usage in human-readable format

16. du (Check Directory Size Usage)

Displays disk usage of a directory.

bash

 

du -sh /home/user  # Show total size of /home/user directory

17. hostname (Show System Hostname)

Displays or sets the system's hostname.

bash

 

hostname  # Show the system hostname

18. uname (Show System Information)

Displays system details like OS type, kernel version, etc.

bash

 

uname -a  # Show all system information

19. uptime (Show System Uptime and Load Average)

Displays the system's uptime and average load.

bash

 

uptime

20. free (Check RAM Usage)

Shows system memory usage.

bash

 

free -h  # Show memory usage in human-readable format

21. echo (Print Messages or Variables)

Displays a message or variable value in the terminal.

bash

 

echo "Hello, World!"

22. env (Show System Environment Variables)

Lists all environment variables.

bash

 

env

23. export (Set Environment Variables)

Sets a new environment variable.

bash

 

export MY_VAR="Hello"

echo $MY_VAR

24. alias (Create Shortcuts for Commands)

Creates a shortcut for frequently used commands.

bash

 

alias ll='ls -la'  # Create an alias for 'ls -la'

25. unalias (Remove an Alias)

Removes a previously set alias.

bash

 

unalias ll

26. date (Show or Set System Date and Time)

Displays or modifies the system date and time.

bash

 

date  # Show the current date and time

27. cal (Display Calendar)

Shows the calendar for a given month or year.

bash

 

cal  # Show the current month's calendar

cal 2025  # Show the calendar for 2025

28. shutdown (Turn Off or Restart the System)

Shuts down or reboots the system.

bash

 

sudo shutdown -h now  # Shutdown immediately

sudo shutdown -r now  # Restart immediately

29. reboot (Restart the System)

Reboots the system instantly.

bash

 

sudo reboot

30. passwd (Change User Password)

Allows users to update their password.

bash

 

passwd  # Change the current user's password

31. useradd (Create a New User)

Creates a new user account.

bash

 

sudo useradd -m newuser

32. usermod (Modify a User Account)

Modifies existing user accounts.

bash

 

sudo usermod -aG sudo newuser  # Add user to the sudo group

33. userdel (Delete a User Account)

Removes a user from the system.

bash

 

sudo userdel -r newuser

34. groupadd (Create a New Group)

Creates a new user group.

bash

 

sudo groupadd developers

35. groupdel (Delete a Group)

Removes a user group.

bash

 

sudo groupdel developers

36. chmod (Change File Permissions)

Modifies file and directory permissions.

bash

 

chmod 755 script.sh  # Set read/write/execute permissions

37. chown (Change File Ownership)

Changes file ownership to a specific user.

bash

 

chown user:user file.txt

38. lsblk (List Information About Block Devices)

Shows details of storage devices and partitions.

bash

 

lsblk

39. fdisk (Manage Disk Partitions)

Used for creating and managing disk partitions.

bash

 

sudo fdisk -l  # List all partitions

40. mkfs (Format a Filesystem)

Formats a partition with a specific filesystem.

bash

 

sudo mkfs.ext4 /dev/sdb1

41. mount (Mount a Filesystem)

Mounts a filesystem or external drive.

bash

 

sudo mount /dev/sdb1 /mnt

42. umount (Unmount a Filesystem)

Unmounts a mounted filesystem.

bash

 

sudo umount /mnt

43. ps (List Running Processes)

Displays currently running processes.

bash

 

ps aux

44. kill (Terminate a Process by PID)

Stops a running process using its PID.

bash

 

kill 1234  # Kill process with PID 1234

45. killall (Kill a Process by Name)

Terminates all processes with the given name.

bash

 

killall firefox

46. htop (Interactive Process Monitoring – Requires Installation)

Provides a user-friendly way to monitor system processes.

bash

 

htop

47. history (Show Command History)

Displays a list of previously executed commands.

bash

 

history

48. clear (Clear Terminal Screen)

Clears all previous output in the terminal.

bash

 

clear

49. man (View Manual Pages for Commands)

Shows detailed documentation for a command.

bash

 

man ls  # Show the manual page for 'ls'

50. exit (Close the Terminal Session)

Closes the current shell session.

bash

exit

Mastering Linux Commands: Your Key to Efficiency and Control

Linux commands are the foundation of a powerful and flexible computing experience. Whether you're new or experienced, these 50+ key commands can help you work faster on the command line.

The command line helps you manage files, processes, and networks. It also lets you troubleshoot system issues quickly and accurately. Add these commands to your daily routine. They will help you maximise Linux's potential. You'll find system navigation, automation, and administration much easier.

To master these commands, the best way is hands-on practice with this list. Open your terminal, experiment with different commands, and watch your Linux skills grow!