Linux/C2/Basic-Commands/English-timed
From Script | Spoken-Tutorial
Time | Narration |
---|---|
0:00 | Dear friends, welcome to a spoken tutorial on the Linux Operating System. |
0:05 | In this tutorial, we will study some basic commands. |
0:10 | I am using Ubuntu 10.04. |
0:12 | We assume that you know how to get started with the Linux operating system. |
0:17 | If you are interested, it is available through another spoken tutorial, on the website http://spoken-tutorial.org. |
0:26 | In this tutorial, we will see what are commands and what is a command interpreter. |
0:33 | Then we will learn about how to find help in Linux using the man command. |
0:39 | Now the first question is, "what are commands?". |
0:43 | In simplest terms we can say that Linux commands are words that when keyed in cause some actions to take place. |
0:52 | Linux commands are seldom more than four character in length like ls, who, ps etc. |
0:59 | The commands are in lower case and they are case sensitive. Let us see an example . |
1:05 | Go to the applications menu. |
1:08 | Select accessories and then click on terminal from the available options |
1:14 | or press ctrl alt t on your keyboard to open a terminal window. |
1:20 | Now we can see a prompt ($) and a cursor blinking next to it. This is where we need to type in a command. |
1:29 | Type in the words who and press enter. |
1:34 | We can see the name of the users logged in. Actually we have just executed a command called who which shows who are logged into the system. |
1:47 | But which entity is converting these commands which are nothing more than a few letters into actions? |
1:54 | This is the job of the Command Interpreter, also called the shell. |
1:59 | We can define a shell as a program that acts as the interface between us and the Linux system, |
2:08 | allowing us to enter commands for the operating system to execute. |
2:13 | On Linux it’s quite feasible to have multiple shells installed, with different users able to pick the one they prefer. |
2:22 | On Linux, the standard shell that is always installed as /bin/sh is called bash, the GNU Bourne-Again SHell, from the GNU suite of tools. |
2:35 | The commands we would be covering in this tutorial are generic and can run on most of the Linux shells with slight variations. |
2:44 | Nevertheless, we would be using the bash as the shell for demonstration in this tutorial. |
2:51 | It is because bash is the most popular shell and portable to almost all UNIX. |
2:58 | Other shells include the Bourne shell which is the original Unix shell, C Shell and Korn shell |
3:08 | To see which shell we are using |
3:11 | go to the terminal and type the command echo space dollar in capital SHELL and press enter |
3:27 | Normally the output is /bin/bash which gives us the bash shell. |
3:34 | There are ways by which we can activate different shells. Those will be covered in an advanced tutorial. |
3:42 | Commands are actually files containing programs, often written in C. |
3:47 | These files are contained in directories. To find out where a command is stored, we can use the type command. |
3:55 | Type at the command prompt. Type--space-- ps and press enter. |
4:03 | This shows that ps is actually a file stored in the /bin directory. |
4:09 | When we key in a command at the command prompt, the shell searches for a file matching the command name in a list of directories. |
4:18 | If it is found, then the program corresponding to that file is executed, else a “command not found” error is given. |
4:27 | The list of directories searched is specified by the PATH variable, as we will see later. |
4:34 | For now, if we want to see this list, just type the command echo space dollar PATH |
4:44 | in capital and press enter |
4:52 | Talking of commands, there is one important thing that we need to know. |
4:57 | Linux commands are of two types: External commands and internal commands. |
5:02 | Now external commands are those which exist as separate files/programs. |
5:07 | Most commands in Linux are of this nature. But there are some commands whose implementation is written within the shell and they do not exist as separate files. |
5:18 | These are internal commands. |
5:20 | The echo command, which we will see later, is in fact an internal command. |
5:25 | Go to the terminal and type at the command, |
5:33 | type space echo and press enter. |
5:40 | The output shows echo as a shell built-in. |
5:43 | So instead of giving a file name it shows that the echo command's implementation is internal to the shell. So it is called internal command. |
5:56 | Another important thing which we need to understand is the structure of commands. |
6:01 | Commands can be of one word or multiple words, separated by white spaces. |
6:08 | In the second case the first word is the actual name of the command while the other words are the arguments. |
6:16 | Arguments can be options or expressions or file names. |
6:20 | A command can perform different tasks depending on the option specified. |
6:26 | They are generally preceded by a single or double minus sign(-), called short and long option, respectively. |
6:35 | Go to the terminal window and type the commands and see their outputs. |
6:40 | Type clear to clear the terminal window |
6:44 | Then type ls and press enter |
6:49 | Again, type clear and press enter |
6:55 | Type ls space minus a and enter. |
7:04 | Type clear to clear the terminal window |
7:11 | Now type ls space minus minus all and press enter. |
7:19 | Again, type clear to clear the terminal . |
7:23 | Now type ls space minus d and press enter. |
7:32 | At this point it is enough to understand how the command's behavior changes with change of options |
7:40 | In Linux we have a larger number of commands, |
7:45 | each of which have many different options. |
7:48 | Commands can also be combined together as we will see later. So how do we keep so much in mind? |
7:55 | In reality you don't have to. This is because of the excellent online help facility available in Linux. |
8:01 | The man command provides documentation on just about every available command on the system. |
8:08 | For instance, to know about say, the ls command, all you have to do is to go to the terminal |
8:16 | and type man command with ls as argument that is type man space ls and press enter |
8:30 | Press q to come out. |
8:35 | man is the system’s manual pager. Each argument given to man is normally the name of a program, utility or function. |
8:43 | The manual page associated with each of these arguments is then found and displayed. |
8:49 | A section, if provided, will direct man to look only in that section of the manual. |
8:55 | The default is to search in all of the available sections, following a pre-defined order and to show only the first page found, even if page exists in several sections. |
9:07 | You can use man command to know more about the command man itself. |
9:14 | Go to the terminal and type man space man and press enter. |
9:23 | Press q to come out of it. |
9:26 | man command has many options. |
9:30 | Here let me tell the most useful ones. Sometimes we know what we want to do but do not know the exact command. Then what can we do? |
9:41 | man provides the -k option which takes a keyword and return a list of commands and their brief purpose. |
9:50 | For example, create a directory, we may not know the exact command, |
9:56 | so we can go to the command prompt and type man space minus k space directories and press enter. |
10:12 | Now we can search each of these commands to see what we actually need. |
10:17 | The same thing can be achieved using apropos command. |
10:21 | Type at the command prompt apropos space directories and press enter to see the output. |
10:36 | Some times we do not need too much details. We only need to know what a command does. |
10:40 | In that case we can use the whatis command or man -f. Both give one line description about the command. |
10:52 | Go to the terminal type clear to clear the terminal window |
10:58 | now type whatis space ls and press enter |
11:06 | Some commands have many options. We may want to obtain a list of the different options that a command has. |
11:13 | Then we use the minus help option. |
11:18 | Go to the command prompt and type ls space minus minus help and press enter |
11:29 | I will scroll up so that u can see all the options on this manual page |
11:45 | Thats it for this part of the Linux Spoken tutorial. Spoken Tutorials are a part of the Talk to a Teacher project, supported by the National Mission on Education through ICT. |
11:56 | More information on the same is available at the following link . |
12:00 | This script has been contributed by ----------------------(name of the translator) and this is -----------------------(name of the recorder) from --------------------------(name of the place)signing off. Good bye |