VMware ESXi and vSphere Cluster Management
How to Open and Understand the Bash Shell in Ubuntu
Learn how to open Terminal or a TTY in Ubuntu, recognize the Bash prompt, run safe first commands, and use terminal basics.
What the shell is
A shell is a program that reads commands you type and then starts programs or performs shell operations. It is the command interpreter between you and the operating system.
Bash stands for Bourne Again Shell. It is a widely used Unix and Linux shell, and Ubuntu commonly provides Bash as the default interactive shell. Users can also choose other shells.
Do not confuse the shell with the terminal application:
- A terminal emulator is a graphical application that displays a text-based session and runs a shell.
- Terminal is the standard Ubuntu application name commonly used to launch that session.
- Bash is commonly the shell running inside the terminal window.
The terminal provides the text interface; Bash interprets the commands entered into that interface.
Open Terminal in the Ubuntu desktop
First, log in to your Ubuntu user account. Then open the application launcher or the Activities overview and search for Terminal. Select the Terminal application from the search results to open a window containing a shell.
On many Ubuntu desktop installations, the keyboard shortcut Ctrl+Alt+T opens Terminal directly. Desktop layouts, launcher names, and keyboard shortcuts can vary by Ubuntu version and desktop environment. A desktop environment is the graphical interface and collection of applications used to operate Ubuntu.
| Method | When to use it | Steps or shortcut | Expected result |
|---|---|---|---|
| Terminal application search | When you can use the graphical desktop | Open Activities or the application launcher, search for Terminal, and select the result | A terminal window opens with a shell prompt |
Ctrl+Alt+T | When the desktop shortcut is enabled | Press the three keys together | Terminal usually opens immediately |
| TTY virtual console | When the graphical desktop is unavailable or you need a text-only session | Press a combination such as Ctrl+Alt+F3, then log in | A text console provides a shell after authentication |
Open a text console with a TTY
A TTY is a text-based virtual console that can be used independently of the graphical desktop. It is useful when the desktop is not responding, is not installed, or cannot be used.
On many Ubuntu systems, press Ctrl+Alt+F3 to switch to a TTY. You may see a text login prompt. Enter your Ubuntu username and password. The username is the account name of the logged-in user. For security, the password usually does not appear while you type it.
To return to the graphical session, try the function-key combinations used by your system, such as Ctrl+Alt+F2 or Ctrl+Alt+F1. The correct key differs between Ubuntu releases, display managers, and hardware. If one function key does not return to the desktop, try the other likely graphical-session keys.
Recognize the Bash command prompt
The command prompt is text displayed by the shell to show that it is ready for input. For example, a typical Bash prompt might look like this:
alex@ubuntu-pc:~$In this example, alex is the username, ubuntu-pc is the hostname, ~ represents the user's home directory, and $ indicates a regular-user prompt.
| Prompt part | Example | Meaning |
|---|---|---|
| Username | alex | The account name of the current user |
| @ separator | @ | Separates the username from the computer name |
| Hostname | ubuntu-pc | The name assigned to the computer on the system or network |
| Current directory | ~ | The filesystem location in which commands operate unless another path is specified; ~ commonly means the home directory |
$ or # | $ | $ commonly indicates a regular user; # commonly indicates the root user |
The prompt is configurable, so yours may not contain every component or may use different colors and symbols. A different-looking prompt does not necessarily indicate a problem.
A regular user is a non-administrative account. The root user is the highly privileged system administrator account. Treat a # prompt carefully: commands run there can change or delete important system files without the normal protections of a regular account.
Run safe first commands
Click the terminal window, type a command, and press Enter. Bash processes the command, and its output appears below it. When a new prompt appears, the command has normally completed and Bash is ready for another command.
Try this harmless command:
echo "Hello from Bash"Expected output resembles:
Hello from BashCommands are generally case-sensitive. For example, pwd and PWD are different input, and only the lowercase command is normally recognized.
Identify the current account
whoamiwhoami prints the current username. Its output normally matches the username shown in the prompt.
Display the current directory
pwdpwd prints the current working directory. A new terminal commonly starts in your home directory, such as /home/alex.
The current directory is the filesystem location in which commands operate unless you provide another path.
Check the configured login shell
echo "$SHELL"This displays the shell path configured for your account. On Ubuntu it is often /bin/bash. This value describes the configured login shell; it is not always a definitive description of every shell currently nested inside the terminal.
Exit the shell
To leave the current shell session, run:
exitYou can usually get the same result by pressing Ctrl+D, which sends an end-of-file signal to an interactive shell. If the shell is the final process in a terminal window, the window may close. If it is a nested shell, you return to the parent shell instead.
Basic terminal usability
Copy and paste
In many Ubuntu terminal emulators, use Ctrl+Shift+C to copy selected text and Ctrl+Shift+V to paste. Select text with the mouse, then use the terminal context menu or the application's Edit menu if preferred.
Ctrl+V does not always paste in a terminal because terminals may assign that key combination a terminal-specific meaning. Use Ctrl+Shift+V, right-click and choose the paste option, or use the Edit menu.
Resize, scroll, and create sessions
- Drag the edge or corner of a terminal window to resize it.
- Use the mouse wheel, scrollbar, or terminal scrolling keys to review earlier output.
- Open another terminal tab from the terminal's tab menu or with the available tab shortcut.
- Open an additional terminal window when you want separate independent sessions.
Bash versus other shells
Bash is not the only shell available on Ubuntu. Examples include sh, zsh, fish, and dash. Many everyday commands work similarly in Bash and other common shells, so basic navigation and program-launching commands often transfer between them.
However, shells can differ in scripting syntax, startup files, prompt configuration, completion behavior, history features, and other interactive features. This lesson focuses on opening a terminal and recognizing Bash, not on shell scripting.
Troubleshooting
Terminal does not appear in search
- Try the search term
Terminalagain from the application launcher. - Look under a system, utilities, or applications category; names vary by desktop environment.
- Try
Ctrl+Alt+T. - If graphical access is unavailable, use a TTY such as
Ctrl+Alt+F3to log in and investigate. A terminal emulator may be missing or damaged and may require repair or installation.
Ctrl+Alt+T does nothing
Your desktop environment may not define that shortcut, or the shortcut may have been changed or intercepted. Open Terminal from the application launcher, review the keyboard shortcut settings, or use a TTY when graphical access is not essential.
The prompt does not look like username@hostname
The prompt may have been customized, or a different shell may be running. Do not rely only on its appearance. Inspect the session with:
whoami
hostname
pwd
echo "$SHELL"Pasted text does not work with Ctrl+V
Use Ctrl+Shift+V, the terminal's right-click context menu, or its Edit menu. Terminal applications commonly reserve Ctrl+V for another function.
A # prompt appears
A # prompt commonly means the session is running as the root user or inside an administrative shell. Root has extensive privileges. Avoid destructive commands and use elevated privileges only when they are required and understood.
Next steps
Once you can open and identify Bash, continue with essential Linux commands, filesystem navigation, files and directories in Bash, command history, tab completion, and safe use of sudo. Later topics can cover shell variables, changing the default shell, Bash scripting, and remote shell access with SSH.
Review this Ubuntu shell lesson whenever you need a quick reference for opening Terminal and recognizing the prompt.