Working with the Linux Shell

Working with the Linux Shell

Familiarize yourself with the Linux terminal

The Shell

Remember:

  • The terminal is a program that takes the command as input and hands it off to the shell.
  • The shell is a program that creates an interface through which we can interact with the system kernel.

Useful terminal shortcuts:

ctrl + u                 -> clear the line
ctrl + l                 -> clean it off
ctrl + shift + t         -> starts a new terminal
ctrl + shift + n         -> opens up a seperate terminal
ctrl + shift +           -> increases font size in the terminal
ctrl -                   -> decreases font size in the terminal

Type of Shells

There are many shell environments available in Linux. You can check all the available shells in your system by issuing cat /etc/shells. You can install new shells as per your requirements.

bk@linux:~$ cat /etc/shells
/bin/sh
/bin/bash
/usr/bin/bash
/bin/rbash
/usr/bin/rbash
/bin/dash
/usr/bin/dash
/bin/zsh
/usr/bin/zsh

If you want to run a particular shell, simply type in the name of the shell, just like so:

bk@linux:~$ zsh

And, it will put you in the zsh shell. To pop back out of the shell, just type bash in the terminal.


There are many times when we want to go back to the traditional terminal apart from the ones we have been provided with the Linux GUI system, usually the Gnome terminal. The tty command prints the name of the terminal you're using in the GUI environment. TTY stands for “teletypewriter.”

[bk@localhost ~]$ tty
/dev/pts/0

💡💡 Do you know the difference between TTY and PTS terminal?

  • TTY: TTY (Teletypewriter) ports are direct connections to the computer such as a keyboard/mouse or a serial connection to the device.

  • PTS: PTS (Pseudo Terminal Slave) connections are SSH connections or telnet connections.


💡💡 Remember, in a traditional terminal, there is no scrollbar. But you can press shift + page up and shift + page down to go up and down.