Consoles & The Command Line (CLI)

Key Goals

  • Manage and access different consoles in linux
  • Basic commands to navigate the command line

Content

  1. Consoles:
    • Consoles types:
      • Physical TTY
      • Local Pseudo TTY
      • Remote Pseudo TTY
    • Related commands:
      • tty
      • who
  2. Command line basics:
    • Shortcuts
    • Related commands:
      • pwd
      • ls
      • tree
      • cd
      • exit
  3. Wildcards

Exercises

Consoles

  1. Explain the difference between Physical, Local Pseudo and Remote Pseudo TTY.
  2. ssh is example to which kind of TTY?
  3. How many physical consoles exist in a Linux environment?
  4. Which shortcut can you use to bring up the physical TTY?
  5. Run the tty command and explain it’s output.
  6. What is the meaning of the number of files in the /dev/pts directory?

The Command Line

  1. Explain the following CLI shortcuts:
    • CTL + l
    • CTL + r
    • CTL + w
    • CTL + d
  2. Which shortcut makes the CLI’s font bigger?
  3. The cd command
    • How can you get to your home directory using cd?
    • Why would someone run the cd with the ‘-‘ option?
  4. The who command:
    • Login to your second physical tty
    • Run the who command, exaplain the meaning of the output.
    • The ouput should contain :0, pts/0 and tty2, explain thier meaning.
  5. The ls options:
    • List all the files in the /etc directory (including the hidden files).
    • List the files in the /etc directory so the most recently modified files are shown last.
    • Which functionality adds the -F option?
  6. In the follwing example: ls -l $(tty), which functionality provides the ‘$(<command>)’

Wildcards

  1. Explain what is a wildcard.
  2. !!
  3. !$
  4. List the directories that match the following conditions:
    • Located inside your home directory
    • Directory name starts with the ‘D’ character
  5. List the files that match the following conditions:
    • Located inside /dev directory
    • File name starts with sda and then followed by a single character (for example: /dev/sda8)
  6. List only the following 2 files: /dev/sda1 and /dev/sda2 using a the [] wildcard.