Linux Commands

  1. System reference manuals.

    • man

      Options: <1, 2, 3, 4, 5, 6, 7, 8, 9>

      Example 1: man man

      Example 2: man 1 pwd

      Example 3: man 2 strlen

  2. Command to install package

    • apt-get (For Ubuntu)

      Options: <install, update, upgrade>

      Example: sudo apt-get install sl

    • yum or dnf (For Fedora/Redhat)

      Options:

      Example 1: sudo yum install sl

      Example 2: sudo dnf install sl

  3. Basic command for files or directory

    • touch

    • rm

      options: <-i, -r>

    • cp

      options: <-l, -a, -r, -f, -i, -v, --help>

    • mv

      options: <-l, -a, -f, -i, -v, --help>

    • ln

      options: <-s>

    • pwd

    • cd

      options: < .., dir_path, /, ~/ >

    • ls

      options: <-l, -t, -r, -h, -a, -R>

    • mkdir

      options: <-p>

    • rmdir

      options: <-r -f>

    • tree

      options: <-d -f>

  4. Command to view files

    • cat
    • head
    • tail
    • less
    • more
  5. Commands to check/modify file properties

    • file

    • stat

    • wc

      options: <-c, -b, -l>

    • chmod

      options: <+x>

    • chown

    • du

      options: <-s, -h, -a>

  6. Command to compare files/directory

    • md5sum
    • diff
    • comm
    • cmp
    • meld
  7. Comand to search/find a file

    • find

      Example 1: To Find all executable file in a directory recursevely

        find . -type f -executable
      

      Example 2: To limit the search to current directory only

        find . -maxdepth 1 -type f -executable
      

      Example 3: To Find all executable file in a directory recursevely and remove it

        find . -type f -executable | xargs rm
      
    • locate

    • which

    • whereis

  8. Command to search/match-pattern inside file

    • grep
  9. Command for Disk and filesystem

    • df

      options: <-h>

    • mount

    • unmount

    • fdisk

    • mkfs.ext3

    • mkfs.ext4

    • mkfs.vfat

    • mkfs.ntfs

  10. Command to monitor system/process/user

    • uptime

    • uname

      options: <-a -r>

    • whoami

    • ps

      options: <-a -x>

    • top

    • pstree

    • kill

    • pkill

    • killall

  11. Process scheduling command

    • sleep
    • watch
    • renice
  12. Command for system environmental variable

    • env
    • export
  13. Command for networking

    • ifconfig
    • ping
    • ssh
    • scp
  14. Compression and file packaging command

    • tar
    • zip
    • unzip
    • rar
  15. Command to get Kernel Logs

    • dmesg

      options: <-c>

  16. Command to load/unload driver

    • insmod
    • rmmod
    • modprobe
  17. importent BASH variables

    • PATH
    • PWD

©2023-2024 rculock.com