CEIT Open Course Content

Command reference

Help

  1. man pico
    View the manual page (help) of the pico command. Press 'q' to quit.

File system

  1. pwd
    Print the current working directory
  2. cd
    Change directory to the user's home directory
  3. cd /etc
    Change directory to /etc
  4. ls
    List current directory content
  5. ls -l
    List current directory content in long format
  6. ls -l /etc
    List the content inside /etc directory in long format
  7. mkdir x
    Create directory named "x"
  8. rmdir x
    Remove directory named "x"
  9. rm x
    Remove file named "x"
  10. rm -rf x
    Remove directory x including all content inside forcefully (no prompts asked for confirmation)
  11. cp filex filey
    Copy filex to filey
  12. cp -a /etc/nginx /etc/nginx.backup
    Copy complete directory /etc/nginx to /etc/nginx.backup
  13. mv x y
    Rename file or directory named 'x' to 'y'
  14. chmod +x /usr/local/bin/myscript
    Change mode of the file to be an executable.
  15. chmod 755 /usr/local/bin/myscript
    Change mode of the file so that
    1. read, write, exec permissions are set for the owner
    2. read and exec permissions are set for the users in the owning group
    3. read and exec permissions are set for all other users
  16. chown userx:groupy filez
    Change the ownership of filez to user userx and user group groupy

System details

  1. df -h
    Show file system usage (disk free)
  2. du -h
    Show the current directory usage (disk usage)
  3. free -m
    Show memory details
  4. cat /proc/cpuinfo (or less /proc/cpuinfo)
    Show the cpu details
  5. uptime
    Show system uptime and load average

Date/time

  1. date
    Show date and time
  2. timedatectl
    Show date, time and time synchronization details

User management

  1. adduser kamal
    Add a new user to the system named "kamal"
  2. useradd -m kamal
    Add a new user to the system named "kamal". Not interactive.
  3. passwd
    Change the current user's password
  4. passwd kamal
    Change the password of user named 'kamal'

Package management

  1. dpkg -l
    List all installed packages
  2. dpkg -l | grep vim
    Print only the lines containing word "vim" from the output of command "dpkg -l"
  3. apt update
    Update package information from sources
  4. apt upgrade
    Upgrade packages that can be upgraded
  5. apt-cache search color picker
    Search for packages that matches the given text (color picker)
  6. apt-cache show gpick
    Show the details of the package gpick
  7. apt install gpick
    Install the package called gpick

Process management

  1. ps x
    List all processes of the current user
  2. ps xa
    List all system processes
  3. ps xa | grep nginx
    Check if any process is running related to nginx
  4. top
    Display system processes with additional details interactively. Press 'q' to quit.
  5. kill PID
    Gracefully terminate a process with process id PID. PID of a process can be obtained from the ps command or top command.
  6. kill -9 PID
    Forcefully terminate a process with the process id PID.

Service management

  1. systemctl status nginx
    View the status of service nginx
  2. systemctl start nginx
    If not running already, start nginx service
  3. systemctl stop nginx
    Stop nginx service
  4. systemctl is-enabled nginx
    Is nginx service configured to start at boot time?
  5. systemctl enable nginx
    Enable nginx to start at boot time
  6. systemctl disable nginx
    Stop nginx from starting at boot time