Top 50 Linux Commands You Must Know

Top 50 Linux Commands You Must Know

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

  1. pwd – Print the current working directory.

     pwd
    
  2. ls – List files and directories.

     ls -l
    
  3. cd – Change directory.

     cd /home/user/Documents
    
  4. mkdir – Create a new directory.

     mkdir my_folder
    
  5. rmdir – Remove an empty directory.

     rmdir my_folder
    
  6. rm – Remove files or directories.

     rm -r folder_name
    
  7. cp – Copy files and directories.

     cp file1.txt file2.txt
    
  8. mv – Move or rename files and directories.

     mv old_name.txt new_name.txt
    
  9. touch – Create an empty file.

     touch newfile.txt
    
  10. find – Search for files in a directory hierarchy.

    find /home -name filename.txt
    

2. File and Directory Permissions

  1. chmod – Change file permissions.

    chmod 755 file.sh
    
  2. chown – Change file ownership.

    chown user:group file.txt
    
  3. ls -l – View file permissions.

    ls -l file.txt
    

3. Process Management

  1. ps – Display currently running processes.

    ps aux
    
  2. top – Show real-time system processes.

    top
    
  3. htop – Interactive process viewer (if installed).

    htop
    
  4. kill – Terminate a process.

    kill PID
    
  5. pkill – Kill processes by name.

    pkill process_name
    

4. Networking Commands

  1. ping – Check network connectivity.

    ping google.com
    
  2. ifconfig – Display network configuration (deprecated, use ip).

    ifconfig
    
  3. ip a – Show IP address configuration.

    ip a
    
  4. netstat – Display network connections.

    netstat -tulnp
    
  5. curl – Transfer data from URLs.

    curl https://example.com
    

5. Disk Management

  1. df – Show disk space usage.

    df -h
    
  2. du – Show directory size.

    du -sh folder_name
    
  3. mount – Mount a filesystem.

    mount /dev/sdb1 /mnt
    
  4. umount – Unmount a filesystem.

    umount /mnt
    
  5. fsck – Check and repair filesystem errors.

    fsck /dev/sda1
    

6. User Management

  1. whoami – Show current user.

  2. who – Show logged-in users.

  3. useradd – Add a new user.

    sudo useradd newuser
    
  4. passwd – Change user password.

    passwd
    
  5. groupadd – Add a new group.

    sudo groupadd newgroup
    

7. System Monitoring and Logs

  1. uptime – Show system uptime.

  2. free – Display memory usage.

  3. dmesg – Show system boot logs.

  4. journalctl – View system logs.

  5. history – Show command history.

  6. clear – Clear terminal screen.


8. Package Management

  1. apt (Debian-based systems)

    sudo apt update && sudo apt upgrade
    
  2. yum (RHEL-based systems)

    sudo yum install package_name
    
  3. dnf (Fedora-based systems)

    sudo dnf install package_name
    
  4. pacman (Arch-based systems)

    sudo pacman -S package_name
    
  5. snap – Install snap packages.

    sudo snap install package_name
    

9. Compression and Archiving

  1. tar – Compress and extract tar files.

    tar -cvf archive.tar folder_name
    
  2. zip – Create zip archive.

    zip archive.zip file.txt
    
  3. unzip – Extract zip files.

    unzip archive.zip
    

10. Miscellaneous Commands

  1. echo – Print a message.

    echo "Hello, Linux!"
    
  2. cat – Display file contents.

    cat file.txt
    
  3. nano / vim – Edit text files.

    nano file.txt