Shell

What is the shell

  • Shell is a textual interface to the computers, it can help you take full advantage of the tools your computer provides.

    This lecture uses bash.

Using the shell

  1. root@VM5014-TheMissingSemesterPra:~#
  • root@VM5014-TheMissingSemesterPra: your machine.
  • ~: the current working directory ( short for your personnal directory ).
  • #: the seperator, after which is your command.

:::info command:

  1. date: print the current date and time
  2. echo: print its argument
  3. which: find out which file is executed for the given program name :::

    Navigating in the shell

  • A path that starts with / called absolute path, any other path is a _relative _path.
  • /: the “root” of the file system.
  • .: refers to the current directory.
  • ..: refers to .‘s parent directory. :::info command:
  1. pwd: print the absolute path of the current directory.
  2. cd: change directory.
  3. ls: see what lives in the given directory.
    1. -l: use a long listing format ( with more information ). :::

      root@VM5014-TheMissingSemesterPra:~# ls -l 总用量 4 drwxr-xr-x 2 root root 4096 9月 13 16:43 immelon

  • d means this is a directory, rwx indicates the permissions of owner of the file ( root ), r-xindicates the owner group ( root, -means “none” ), the ending r-x means everyone else. :::info command:
  1. mv: to move / rename a file.
  2. cp: to copy a file.
  3. mkdir: to make a directory. :::