This course will get you up to speed with the fundamentals of Linux and prepare you for further study.
In today's lesson we're going to cover some basic yet essential Linux commands. Commands in Linux are case sensitive so lowercase ls is not the same as capital L capital S. This really isn't much of an issue because most commands in Linux are all lower case.
Here are the commands we're going to cover today: ls lists directory contents. It can also display detailed information about files and directories. cd is the change directory command. It does what it says, it changes the current working directory. When you log into a Linux system you're automatically placed into your home directory. You can use the cd command to navigate around the file system.
The pwd command displays the present working directory or your current directory. cat concatenates files. Really what cat does is it displays the contents of files. echo displays arguments to the screen. It may not be immediately obvious how this is helpful but in a minute when I show you some examples it will become clear.
Linux systems come with built-in documentation. You can use man to display the documentation for a given command on a Linux system. You may hear people refer to man pages. This is the documentation that you can view with the man command. To exit or log out of your shell, use the exit command. Finally clear clears the screen.
Let's see some of these commands in action. First, let's look at ls. If you run ls without any arguments it lists the files in the present working directory. In this example, we see several items in this directory, desktop, downloads, notes, et cetera. And this example ls output is color-coded. This may not always be the case but it is a common thing to see on Linux distributions. We can run ls with a -l option which displays a long listing format. Here, we get more information about the files and directories that are displayed. In a later lesson we'll cover what all this information means. As you recall earlier I said Linux commands are case sensitive so let's see what happens if we type in capital LS. We get an error saying that the command is not found. Let's try capital L lowercase s, lowercase l capital S, same thing. So ls works lowercase capital does not.
Let's use the cd command to change the directory. Directories and files are also case sensitive. So capital TPS, lowercase reports is not the same as all lower case tpsreports. We can use ls to see what's in this directory. And we can use ls-l to display a long listing more detailed information about these files. cat will display the contents of a file. This file only has one line in it. echo is used to display the contents of variables and we'll be talking about environmental variables later on.
Use the man command to learn more information about how to use a particular command. Type the word man space and the command you wanna know more about. In order to display the next page of information simply hit the space bar. When you're done looking at the man paid type q to quit man.
Here's the man page for ls. We'll see how ls has a lot of options. Here's one that we've been using in this lesson, -l use a long listing format. So as you can see there's a lot of information in the man pages. We'll talk more about the man command in the next lesson. The clear command clears the screen. If you execute cd without any arguments it takes you back to your home directory. pwd will display your current or present working directory. In order to exit your session type the word exit.
Today the commands we've talked about are: ls which displays the contents of a directory, cd which changes the current directory, pwd which displays what directory you're currently in, cat that displays the contents of files, echo displays arguments, man displays documentation about commands, exit exits your shell, and clear clears your screen.
Start becoming familiar with these commands. These are simple and basic, but yet you'll use these often. If you'd like, you can look at the man page for ls and start exploring some of the options that it has to offer. We'll be covering some of the more important options to ls in a later lesson. However, this will just give you some practice at using the man command and navigating within man.
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.