From the course: LPI Linux Essentials (010-160) Cert Prep

Linux shell and commands - Linux Tutorial

From the course: LPI Linux Essentials (010-160) Cert Prep

Start my 1-month free trial

Linux shell and commands

- Let's explore the linux shell and a few basic commands. A more in depth discussion will be done regarding how to use these commands together with the proper syntax in the next section of the course, when we really dive into the command line. Simply put, the Linux shell is the program that takes commands from the keyboard and gives them to the kernel so that way it can be executed. In the old days, it was only available as a text based command line interface. But nowadays, we have the desktop environment or GUI that sits on top of the command line interface and makes execution of the commands much easier. An example is when you click on a shortcut on the desktop. The shortcut may contain a predefined set of commands that you can use with the correct syntax to execute a program. So if I double click on the Chrome icon, it might open up the Chrome web browser in incognito mode. On most linux systems there's a program called Bash, which stands for the bourne again shell. This acts as the shell program within the command line interface. Besides bash, there are other shell programs that can be installed in a way linux system. These include Ksh, the Korn shell, tcsh, the tee see shell, and zsh the zee shell. The shell can be accessed by running a program known as a terminal emulator, or simply known as the terminal. The terminal is going to open up a window and let the user interact with that shell. There are a bunch of different terminal emulators out there that you can use. Now most linux distributions are going to come with several different terminals, things like the gnome-terminal, konsole, xterm, rxvt, kvt, nxterm and eterm. While there are a number of different terminal emulators, they all do basically the same thing. They give you access to a shell session. Now there are a ton of commands that you can use from the command line environment that interact with that shell. We're going to cover just a few of them here. The first one is known as LS. LS is the list command. It's going to show you the files, the folders and directories that are inside that system. The next one we're going to talk about is the CD command, which stands for change directory, it allows you to switch between directories in the file system. The next one is move, or MV. This is going to allow user to move a file from one folder directory to another. Think about this as if you're using Windows or Mac, and you're dragging a file from one folder to another on your desktop. That's what the move command does, but it does it from the command line. The next one we have is man, man stands for manual. It's used to show all of the information about a particular command being used. Another one we have is known as the make directory command or mkdir. This will allow user to make a new empty folder or directory inside of the file system. Now in converse to the make directory, we also have remove directory or rmdir. The remove directory command is going to allow a user to remove an empty existing directory and that means that this is a directory that has no files inside of it. If you think about it a windows system, you might have an empty folder on your desktop, and you need to delete that folder. That's what rmdir does. Now the next one we have is known as touch. Touch is like making a file, it's going to allow a user to make a file using the command line. So if I make the command touch file name, it will create a new blank file called file name. That's the whole idea of touch. The next one we have is the remove command or rm. Rm is used to remove files and directories. Now, when we dealt with rmdir that only could delete an empty directory or an empty folder, but the rm command can remove both files and directories, even if they have files inside of those directories or folders. That being said, you need to be very careful when using the rm command because you can delete a lot of stuff very easily if you use it incorrectly. Next, we have the locate command and this is meant to find a file within the system. Think about it like this search function within Windows or Mac, if you don't know the name of a certain file, or you aren't sure where that file is located or stored on your hard drive, the locate command can be used to find it very easily. And the last one we're going to talk about is the clear command. Clear is going to allow you to clear the screen or that terminal environment of anything that's being shown there. So maybe you've done a bunch of directory listings, or you've been printing files to the screen so you can see them and you want to get back to a clear blank prompt. Well, if you type in clear enter, it will do that, it'll just clear the screen for you. Now using the clear command, will take the user back to the starting prompt for that current directory you're in and give you basically a new start. Now, I know I covered all those commands very, very quickly. And that's okay, because we're not going to spend a lot of time in this lesson on them. I just want you to be introduced to the fact that there are these different commands that can do things for you from the command line. Now we get into the command line sections course. We're going to dig into this and you're going to do a lot of labs hands on where you get to use all of these commands, and many more.

Contents