Ubuntu best commands cheat book

  • This topic is empty.
  • Post
    Weekend Wiki
    Keymaster
    Ubuntu is a popular Linux distribution, and mastering its commands can significantly enhance your efficiency. Here’s a categorized list of some of the best and most commonly used Ubuntu commands:


    System Information

    • uname -a
      Displays detailed system information.
    • lsb_release -a
      Shows Ubuntu version details.
    • hostnamectl
      Displays or sets the system’s hostname.
    • uptime
      Shows how long the system has been running.
    • df -h
      Displays disk space usage in a human-readable format.
    • free -h
      Displays memory usage.

    File and Directory Management

    • ls
      Lists files and directories. Add options like -l (detailed view) or -a (including hidden files).
    • cd <directory>
      Changes the current directory.
    • pwd
      Prints the current working directory.
    • mkdir <directory>
      Creates a new directory.
    • rm <file>
      Removes a file. Use rm -r <directory> to delete a directory recursively.
    • cp <source> <destination>
      Copies files or directories.
    • mv <source> <destination>
      Moves or renames files/directories.

    Package Management

    • sudo apt update
      Updates package lists.
    • sudo apt upgrade
      Upgrades installed packages.
    • sudo apt install <package>
      Installs a package.
    • sudo apt remove <package>
      Removes a package.
    • dpkg -l
      Lists all installed packages.

    User Management

    • whoami
      Displays the current logged-in user.
    • id
      Displays user ID and group information.
    • sudo adduser <username>
      Adds a new user.
    • sudo deluser <username>
      Deletes a user.

    Process Management

    • ps aux
      Lists all running processes.
    • top or htop
      Displays a real-time view of system processes.
    • kill <PID>
      Kills a process by its PID.
    • pkill <process_name>
      Terminates processes by name.

    Networking

    • ip a
      Displays network interface information.
    • ping <domain/IP>
      Tests connectivity to a domain/IP.
    • curl <URL>
      Fetches data from a URL.
    • wget <URL>
      Downloads files from a URL.

    File Permissions

    • chmod <permissions> <file>
      Changes file permissions (e.g., chmod 755 file).
    • chown <owner>:<group> <file>
      Changes file ownership.

    System Monitoring and Logs

    • dmesg
      Displays kernel messages.
    • journalctl
      Views system logs.
    • tail -f <logfile>
      Monitors a log file in real-time.

    Archiving and Compression

    • tar -cvf archive.tar <files>
      Creates a .tar archive.
    • tar -xvf archive.tar
      Extracts a .tar archive.
    • gzip <file>
      Compresses a file.
    • gunzip <file>
      Decompresses a .gz file.

    System Utilities

    • sudo reboot
      Restarts the system.
    • sudo shutdown now
      Shuts down the system immediately.
    • history
      Displays a history of commands used.
    • alias <name>='<command>'
      Creates an alias for a command.

    Text File Management

    • cat <file>
      Displays the contents of a file.
    • nano <file> or vim <file>
      Edits a file.
    • less <file>
      Views file content, scrollable.
    • grep <pattern> <file>
      Searches for a pattern in a file.

    This list is just the beginning. If you’re looking for advanced or specific commands for tasks, let me know!

  • You must be logged in to reply to this topic.
en_USEnglish