Using the Terminal: Viewing and Navigating

the terminal

  • a command line interface (CLI)
  • a textual user interace (TUI), as opposed to a graphical user interface (GUI)
  • a window onto the shell

the shell

  • middleman between user and kernel
  • a command line interpreter that operates in a read-eval-print-loop; REPL
  • basic form of a shell command $ commandname [-options] [arguments]
  • example ls (list)
  • aborting a shell command CTRL-C
  • the bash (Bourne again) shell
    • there are many kinds of shells; to find out which one you are using, type echo $SHELL

the file system

  • every item in the UNIX (Linux) file system is either a directory (folder) or a file. Directories can contain files and other directories, files cannot.

the structure of the file system

  • an inverted tree with the root (/) at the top

absolute paths

  • start at / (notice the ambiguity of “/”)

relative paths

  • start in current working directory

the current working directory

  • represented by a single dot (.)

the parent directory

  • represented by two dots (..)

navigation in the file system

locate yourself in the file system

pwd

go to the root directory

cd /

go back to the previous directory

cd -

go to the home directory

cd ~ (tilde)

go to <target directory>

cd <target directory>

reading directories

list the contents of the current working directory

ls

list the contents of the current working directory including the hidden files and directories

ls -a

show the details of the files and directories contained in the current working directory

ls -l

reading files

show the contents of <filename>

  • cat <filename>
  • less <filename>
  • head <filename>
  • tail <filename>

getting help

getting help for pwd

help pwd

look up the man (manual) pages for pwd

man pwd