Ubuntu best commands cheat book (1 Example)

  • هذا الموضوع فارغ.
  • Post
    Weekend Wiki
    مدير عام

    Here are examples for each of the commands listed. Replace placeholders (e.g., <file>, <package>, <directory>) with actual values on your Ubuntu system:


    System Information

    1. uname -a
      Example:

      uname -a
      

      Output: Linux ubuntu-PC 5.15.0-60-generic #66-Ubuntu SMP x86_64 GNU/Linux.

    2. lsb_release -a
      Example:

      lsb_release -a
      

      Output: Ubuntu version details.

    3. hostnamectl
      Example:

      hostnamectl
      

      Output: Hostname and OS details.

    4. uptime
      Example:

      uptime
      

      Output: 08:24:56 up 1:23, 3 users, load average: 0.01, 0.02, 0.00.

    5. df -h
      Example:

      df -h
      

      Output: Disk space usage (e.g., /dev/sda1 50G 25G 25G 50% /).


    File and Directory Management

    1. ls
      Example:

      ls -la
      

      Output: Lists all files, including hidden ones, with detailed info.

    2. cd <directory>
      Example:

      cd /var/log
      
    3. pwd
      Example:

      pwd
      

      Output: /var/log.

    4. mkdir <directory>
      Example:

      mkdir my_project
      
    5. rm <file>
      Example:

      rm sample.txt
      
    6. cp <source> <destination>
      Example:

      cp file1.txt /tmp/file1.txt
      
    7. mv <source> <destination>
      Example:

      mv old_name.txt new_name.txt
      

    Package Management

    1. sudo apt update
      Example:

      sudo apt update
      
    2. sudo apt upgrade
      Example:

      sudo apt upgrade
      
    3. sudo apt install <package>
      Example:

      sudo apt install curl
      
    4. sudo apt remove <package>
      Example:

      sudo apt remove curl
      
    5. dpkg -l
      Example:

      dpkg -l
      

    User Management

    1. whoami
      Example:

      whoami
      

      Output: ubuntu.

    2. id
      Example:

      id
      

      Output: uid=1000(ubuntu) gid=1000(ubuntu).

    3. sudo adduser <username>
      Example:

      sudo adduser john
      
    4. sudo deluser <username>
      Example:

      sudo deluser john
      

    Process Management

    1. ps aux
      Example:

      ps aux
      
    2. top
      Example:

      top
      
    3. kill <PID>
      Example:

      kill 1234
      
    4. pkill <process_name>
      Example:

      pkill firefox
      

    Networking

    1. ip a
      Example:

      ip a
      
    2. ping <domain/IP>
      Example:

      ping google.com
      
    3. curl <URL>
      Example:

      curl http://example.com
      
    4. wget <URL>
      Example:

      wget http://example.com/file.txt
      

    File Permissions

    1. chmod <permissions> <file>
      Example:

      chmod 644 file.txt
      
    2. chown <owner>:<group> <file>
      Example:

      sudo chown ubuntu:ubuntu file.txt
      

    System Monitoring and Logs

    1. dmesg
      Example:

      dmesg | tail
      
    2. journalctl
      Example:

      journalctl -u apache2.service
      
    3. tail -f <logfile>
      Example:

      tail -f /var/log/syslog
      

    Archiving and Compression

    1. tar -cvf archive.tar <files>
      Example:

      tar -cvf backup.tar file1.txt file2.txt
      
    2. tar -xvf archive.tar
      Example:

      tar -xvf backup.tar
      
    3. gzip <file>
      Example:

      gzip file.txt
      
    4. gunzip <file>
      Example:

      gunzip file.txt.gz
      

    System Utilities

    1. sudo reboot
      Example:

      sudo reboot
      
    2. sudo shutdown now
      Example:

      sudo shutdown now
      
    3. history
      Example:

      history
      
    4. alias <name>='<command>'
      Example:

      alias ll='ls -la'
      

    Text File Management

    1. cat <file>
      Example:

      cat file.txt
      
    2. nano <file>
      Example:

      nano file.txt
      
    3. less <file>
      Example:

      less file.txt
      
    4. grep <pattern> <file>
      Example:

      grep 'error' file.txt
      

    Let me know if you’d like examples tailored to a specific use case!

    For consulting email us at [email protected]

  • يجب تسجيل الدخول للرد على هذا الموضوع.
arArabic