The course is part of this learning path

The Shell
Overview
Difficulty
Beginner
Duration
49m
Students
213
Ratings
5/5
starstarstarstarstar
Description

This course will get you up to speed with the fundamentals of Linux and prepare you for further study. We'll look at the essentials of Linux including the directory structure, basic commands, the shell, and using the command line.

Learning Objectives

Gain a foundational understanding of:

  • Linux directories and permissions
  • Shell scripting and the command line

Intended Audience

  • Anyone with little to no knowledge of Linux who wants to learn more about the operating system
  • Professionals who want to learn about Linux to enhance their career prospects

Prerequisites

This is a beginner-level course so there are no prerequisites, but an interest in Linux and programming knowledge in general would be beneficial.

Transcript

In today's lesson, you will learn what the shell is, how to access it, and we'll talk a little bit about the superuser account. The shell is the default user interface to a Linux system. When you log into a Linux server over the network, the shell is the program that is started and it acts as your default interface to the system. Also if you're presented with a text-based login prompt, you'll also be interacting with the shell by default.

If you log into a graphical user interface then you'll need to start a terminal emulator application to gain access to the shell. In CentOS for example, you can go to the applications menu then system tools and click on terminal. In Ubuntu, you need to start a program called the dash. To do that you click on the top icon in the launcher which is on the left-hand side of your screen. It's the icon with the Ubuntu logo on it. Start typing the word terminal and you should see the terminal application pop up and you can click on it to start it.

The graphical user interface on a Linux system is also called a shell, it's a graphical shell. However, if someone isn't specific and they say shell, they're typically talking about the command line interface. The shell is really nothing more than an application or a program that takes the commands you feed it, and it executes those commands for you. Sometimes you'll hear the shell referred to as a command line interpreter.

The command line interface can be more powerful than the graphical interface. For example, if you have several files and you need to perform the same operation on those files you can often do this easily at the shell. For example if you had 100 documents that you needed to rename, you could run a command at the shell to do all 100 at once. If you are using the graphical user interface, you would have to click on the first file, rename it go to the next while and do that a hundred times.

In this instance the command line is a much better solution. Another reason you wanna be familiar with the command line and be able to use it effectively is that it's always going to be there. Most server additions of Linux distributions do not include a graphical interface. Also when you're connecting to a Linux system over the network, you're typically going to be connecting via SSH or secure shell. This will give you access to the command line interface as well.

Desktop Linux distributions have both graphical user interfaces as well as command line interfaces. This allows you to have the best of both worlds. When it makes sense to use the command line, use the command line. When it makes sense to use a graphical program, use that program. For example, if I'm working on a Linux desktop and I wanna visit Wikipedia on the web, I would start a graphical web browser like Firefox, for instance. There are command line web browsers that come with Linux. So you can surf the web from the command line. Given the choice of using the command line for web browsing or a graphical web browser such as Firefox, I would choose Firefox any day.

When the shell is started it displays a prompt or a shell prompt. The prompt simply just sits there and stares at you waiting for you to do something interesting, like give it a command to execute. A shell prompt typically gives you some sort of useful information. In this example, prompt, you'll see a username Jason@ and the name of the Linux system that you're connected to in this case, LinuxSVR or Linux server.

At the end of the prompt, you'll see a dollar sign. This is an indication that you're using the system as a normal user, as opposed to a superuser. The superuser shell prompt ends typically with a pound sign. The superuser on a Linux system is also called root, it's the root account. We've previously talked about the root of the file system or slash being root. This is a different root. This is an account called root. So when someone talks about root they're either talking about slash the beginning of the file system or the superuser account named root.

The root account on a Linux system is similar to an administrator account on a window system. Anything that can be done on a Linux system can be done by the root user. Normal user accounts can only do a subset of the things that the root account can do. Most of your day-to-day activities will be performed with a normal user account.

Root access is typically restricted to system administrators. For example, if you're working in a company and you have access to Linux servers, there will be a team of people that are responsible for the upkeep maintenance and configuration of those servers. And those people are system administrators. Sometime there are not dedicated people that are system administrators. For example, if you're running Linux on your desktop you'll have access to a normally user account and the root account. You may need root access if you're going to install an application that resides outside of your home directory. You also may need root access in order to start or stop that application.

Applications that run as services, our servers typically need root access to start. For example, you need root access in order to start a web server, however you don't need special privileges to start normal applications like a web browser for instance. Prompts can vary greatly in appearance. Sometimes they're very simple, they're only one character in length like a dollar sign. Sometimes they contain more useful information such as, the account you're using, the name of the server that you're connected to, and the directory that you're currently in.

In a couple of these prompts, you'll notice a Tilda. The Tilda is a shorthand way of representing a home directory. The Tilda use by itself represents your home directory, or the current accounts home directory that you're using. For example, if I'm logged into a Linux system with adjacent account, Tilda represents /home/Jason. You can also append a username to the Tilda. And that will expand to that account's home directory. For example Tilda Pat could expand to /home/Pat. Root's home directory is typically in /root. So Tilda root equals /root.

Not all accounts on a Linux system are associated with an individual user. For example, services often have their own accounts. In this case, Tilda FTP expands to the home directory of the FTP service account, which lives in /SRV/FTP. So far, we've looked at prompts that are contained within a single line, just know that they can span multiple lines as well.

Later in this course, you'll learn how to customize the shell prompt to your liking. In summary, the shell is a default user interface for the Linux system. You're automatically presented with a shell prompt if you connect to Linux over the network using SSH. If you log into the graphical user environment, you can start the terminal application to gain access to the command line. Root is a special user on a Linux system. It's the all-powerful superuser. Your day-to-day activities will be performed using your regular user account.

About the Author
Avatar
Jason Cannon
Founder, Linux Training Academy
Students
3453
Courses
61
Learning Paths
8

Jason is the founder of the Linux Training Academy as well as the author of "Linux for Beginners" and "Command Line Kung Fu." He has over 20 years of professional Linux experience, having worked for industry leaders such as Hewlett-Packard, Xerox, UPS, FireEye, and Amazon.com. Nothing gives him more satisfaction than knowing he has helped thousands of IT professionals level up their careers through his many books and courses.

Covered Topics