HB Computer Security | Aide Memoire
  • Introduction
  • Core Technical Skills
    • Core Skills
      • Linux
        • Getting to Know Linux
          • Using the Shell
            • Shells, Terminals, and Virtual Consoles
            • Choose your Shell
            • Shell Commands
              • Non-PATH Commands
              • Command History
                • Command Line Editing
                  • Keystrokes for Navigating Command Lines
                  • Keystrokes for Editing Command Lines
                  • Keystrokes for Cutting and Pasting Text from within Command Lines
                • Command Line Recall
                  • Keystrokes for Command Line Recall
              • Connecting and Expanding Commands
                • Piping Between Commands
                • Sequential Commands
                • Expanding Commands
            • Shell Variables
              • Common Shell Variables
            • Aliases
            • Create your Own Shell Environment
              • Modification Ideas
          • Navigating the Linux File System (LFS)
            • Filesystem Commands
            • Listing Files and Directories
            • File Permissions and Ownership
              • Modifying Permissions with chmod
              • Modifying Default Permissions with umask
              • Change File Ownership with chown
            • Copying, Moving, and Removing Files
            • Finding Files
              • locate
              • find
              • grep
            • Downloading Files
              • axel
              • wget
              • curl
                • User-Agent: Googlebot
          • Working with Text Files
            • Using vim and vi to Edit Text Files
              • Starting with vi
              • Adding Text
              • Moving Around in the Text
            • Text Manipulation
        • System Administration
          • Installing Linux
            • Installing from Live Media
            • Installing in the Enterprise
            • Partitioning Hard Disks
              • Tips for Creating Partitions
          • Account Administration
            • The root Account
              • Becoming root with su
              • sudo
                • The /etc/sudoers File
                • Granting sudo privileges
                  • visudo Guidance
                • Useful sudo Hints
            • Other Administrative Accounts
            • Standard User Accounts
              • Risks of userdel: Orphaned Files
          • Graphical Remote Administration
            • Cockpit
              • Installation Guide
            • Remote Desktop Protocol with xrdp
              • Installation and Configuration
            • Remote Desktop with vnc
              • Installation and Configuration
              • Running VNC as a System Service
          • Managing Running Processes
            • Listing Processes
              • ps
              • top
              • htop
            • Backgrounding and Foregrounding
              • Starting a Background Process
              • Using Foreground and Background Commands
            • Killing and Recining Processes
              • kill and killall
          • Managing Software
            • Managing Software from the Desktop
            • Going Beyond the Limitations of Software Center
              • Debian Packages
                • Advanced Package Tool (apt)
                • Repositories
                • dpkg
        • Shell Scripting
          • Variables
            • Command Substitution
            • Arguments
          • Reading User Input
          • if, else, and elif
          • BOOLEAN Logic
          • Loops
            • for Loops
            • while Loops
          • Functions
          • Local Vs Global Variables
          • Summary
        • Securing Linux
      • Windows
        • Security Hardening
Powered by GitBook
On this page
  • The Shell Prompt
  • The Terminal Window
  • Virtual Consoles
  • Try it yourself

Was this helpful?

  1. Core Technical Skills
  2. Core Skills
  3. Linux
  4. Getting to Know Linux
  5. Using the Shell

Shells, Terminals, and Virtual Consoles

PreviousUsing the ShellNextChoose your Shell

Last updated 1 year ago

Was this helpful?

There are multiple ways in which we can interact with the shell in Linux. The three most common ways are:

  • A Shell prompt

  • Terminal window

  • Virtual console

The Shell Prompt

You will most commonly run into the Shell prompt if you are using a distribution with no graphical interface (or one where the GUI has been disabled). You will simply be presented with a text based command prompt, where you type in commands singularly:

The default prompt for a regular user is a dollar sign:

$

For the root user, the default prompt is the pound sign (#), which you might know as the number sign, or perhaps the hashtag:

#

We'll delve into standard users and the root user in an upcoming section.

On the majority of Linux setups, the $ and # prompts are placed after a string showing your current username, the name of the system, and the directory you're currently in. So, if the user bennett is having a session on a computer named example and is currently in the /usr/share/ directory, it'd look a bit like this:

bennett@example:/usr/share$

The Terminal Window

If your Linux system has a GUI installed, popping open a Terminal Emulator (often just called the Terminal Window, or even just the Terminal) to kick off a shell is pretty straightforward. Most times, you can:

  • Right-click the desktop Check out the dropdown menu that appears. If you spot options like Open in Terminal, Shells, New Terminal, Terminal Window, Xterm, or something along those lines, give it a click. Some versions of Linux might not have this option

  • Click the panel menu A lot of Linux desktops have a panel, either at the top or bottom of your screen, acting as a handy launchpad for applications. On systems with the GNOME 2 desktop, for instance, you can navigate:

    Applications ➪ System Tools ➪ Terminal

    If you're on GNOME 3, hit the Activities menu, type in 'Terminal', and hit Enter.

Once you have the Terminal open, you interact with it in much the same way as you would the shell prompt:

Virtual Consoles

In Linux distributions that feature a graphical desktop, you'll usually find that there are multiple virtual consoles ticking away in the background, ready and waiting for you to use. These virtual consoles let you have several shell sessions up and running alongside your graphical interface, all at the same time.

Switching between these virtual consoles is a breeze – just hold down Ctrl and Alt, and then tap one of the F1 to F6 function keys.

To paint a picture, if you’re using Fedora, a combination of Ctrl + Alt + F1 (or F2, F3, F4, and so on, right up to F6) will whisk you away to one of the available seven virtual consoles. You’ll find the graphical user interface usually hanging out on one of the first two virtual consoles, while the remaining five are where your text-based adventures unfold. And when you’re ready to head back to the GUI (and it’s up and running), a quick Ctrl + Alt + F1 should do the trick!

On some systems, the GUI may run on a different virtual console, such as Virtual Console 2 (Ctrl + Alt + F2).

Try it yourself

  1. Hold down the Ctrl + Alt keys and press F3. You should see a plain-text login prompt

  2. Log in using your username and password. Try a few commands out

  3. When you are finished, type exit to exit the shell and then press Ctrl + Alt + F1 or Ctrl + Alt + F2 to return to your graphical desktop interface

You can go back and forth between these consoles as much as you like!!

An example of a shell prompt from Fedora, installed with no GUI
A terminal window spawned in the Ubuntu GUI