Linux/C2/General-Purpose-Utilities-in-Linux/English-timed

From Script | Spoken-Tutorial
Jump to: navigation, search
Time Narration
00:00 Hi, welcome to this spoken tutorial on General Purpose Utilities in Linux.
00:06 In this tutorial, we will make ourselves acquainted with some of the most basic yet heavily used commands of Linux.
00:14 The main motivation of this is to give you a head start about working with Linux.
00:21 The first command that we will see is the echo command. However note that Linux commands are 'case sensitive'.
00:29 Here, all commands and their options are in small letters unless otherwise mentioned.
00:36 This command is used to display some message on the screen. Switch to the terminal.
00:43 Ctrl Alt t helps to start a terminal in Ubuntu.
00:48 This command may not work in all Unix systems however.
00:52 A general procedure to open a terminal is already explained in another spoken tutorial.
00:58 Type at the prompt: echo space Hello World and press Enter.
01:08 This prints the customary 'Hello World' message on the screen.
01:14 We can also use the 'echo' command to display the value of a variable.
01:19 Type at the prompt: echo space dollar SHELL in capital and press Enter.
01:30 This outputs the present shell being used.
01:36 We can also use escape sequences with 'echo' command.
01:42 For this in Linux we need to use the -e (hyphen e) option.
01:46 Common escape sequences include \t (backslash t) for tab, \n for new line and \c is a escape sequence which when used causes the prompt to be displayed on the same line.
02:03 This can be useful if say we want a prompt message before entering something. Type at the prompt:

echo space minus e within single quote Enter a command back slash c (\c) and press Enter.

02:32 We will see that the prompt will be displayed after printing ‘Enter a command ‘ on the same line.
02:38 You may want to know what version of Linux Kernel you are running.
02:43 To know this and many other characteristics of our machine we have the uname command. Type at the prompt: uname space hyphen r and press Enter .
02:58 To know what is your username, type at the prompt: who space am space I and press Enter.
03:11 This in fact comes from the who command that enlists all the users currently logged into the system in case your system is a multiuser system.
03:21 Sometimes your login password may get compromised and/or you may want to change it.
03:28 For this we have the passwd command. Type at the prompt:

p-a-s-s-w-d and press Enter.

03:37 When you type this command you would be asked to type the current password.
03:43 Here I would be typing my system's current password.
03:48 When that is correctly entered, you will have to enter your new password and then retype it to confirm.
04:02 But what if we have forgotten our current password?
04:06 Then also the password can be changed without knowing the current password, but that can only be done by the root user.
04:14 Now who is a 'root user'?
04:18 He is a special person with extra privileges.
04:22 To draw an analogy we can say a 'root user' is similar to a user in Windows with Administrator status.
04:30 We may be interested in knowing the system date and time. For this we have the date command.
04:36 Type date in the terminal and press Enter
04:42 It will show you the present system time and date.
04:45 As we can see the date command gives both date and time. This is a very versatile utility and has many options as well.
04;54 Type at the prompt: date space plus 'percent' sign capital T and press Enter.
05:07 It gives us only the time in hours minutes and seconds (hh:mm:ss) format.
05:12 Type at the prompt: date space plus 'percentage sign small h and press Enter.
05:23 It gives the name of the month.
05:25 Type at the prompt: date space plus percentage sign small m and press Enter.
05:38 It gives the month of the year in numerical format. Here it is showing 02 for the month of February . Match this according to the output you are getting.
05:50 Type at the prompt: date space plus percentage sign small y and press Enter .
06:01 It gives the last two digit of the current year.
06:05 We can combine these options as well. For example type at the prompt: date space plus within double quotes percentage small h percentage small y and press Enter .
06:34 Here it is showing February 11.
06:39 Another related command is the cal command. Though not as common, this helps you to see the calender of any month and any year.
06:48 To see the current month's calendar, type at the prompt: cal and press Enter.
06:56 To see the calendar of any arbitrary month say December 2070, type at the prompt: cal space 12 space 2070 and press Enter.
07:13 This gives the calendar of December 2070.
07:19 Before moving ahead let us discuss a little bit about files and directories.
07:26 In Linux almost everything is a file. Now the question is what is a file?
07:34 In real file a file is where we store our documents and papers. Similarly a Linux file is a container for storing information.
07:48 Next what is a directory?
07:52 A directory can be understood as a collection of files and other (sub)directories.
07:58 A directory helps us in organizing our files in a systematic manner .
08:04 This is like what we call folders in Windows.
08:08 When we login into the Linux system we are by default in a home directory. To see the home directory type at the prompt: echo space dollar HOME in capital and press Enter.
08:27 The next command helps us to see the directory we are currently working in. It is pwd that stands for 'present working directory'. Type at the prompt pwd and press Enter.
08:42 Once we know of our directory we would also want to know what are the files and sub-directories in that directory. For this, we have the ls command which is probably the most widely used command in Unix and Linux.
08:56 Type the command ls and press Enter.
09:01 Now observe the output.
09:04 Files and sub-directories are generally shown with different colours.
09:08 ls is a very versatile command and has many options. Let us see some of them, type at the prompt: ls space minus minus all and press Enter.
09:24 This shows all the files including the hidden files (hidden files here are filenames starting with dot (.))
09:33 If we not only want to see the file but also get more information we can use the 'minus l' option.
09:40 Just type the command: ls space minus small l and press Enter.
09:50 It gives us the file permissions, file owner's name, last modification time, file size in bytes etc. Explanation of the fields of this option is beyond the scope of the present tutorial.
10:06 ls can be used with many options which we will see later.
10:11 Instead of just displaying all these information on the screen, we may store it in a file. In fact we can store the output of any command in a file in this way.
10:23 Just type the command followed by the right angle bracket and the file name. Say we write ls space minus small l space right angle bracket space fileinfo and press Enter.
10:46 Now all the files and directories information will be directed into the file named 'fileinfo'.
10:54 But how do we see the content of this file? For this, we have the cat command. Just type cat space and the name of the file, here it is fileinfo and press Enter.
11:12 Now you can see its contents. In fact, the other main use of cat is to create a file. For this, type at the prompt: cat space right angle bracket space filename say file1 and press Enter.
11:36 Now when we press Enter the command waits for input from the user.
11:42 Whatever we type would be written into the file so type some text.
11:50 Now press Enter key to indicate the end of input.
11:56 Now press the Ctrl and D keys together.
12:05 If a file by name say 'file1' already exists then the user input will be overwritten on this file.
12:13 Now if you wish to append to the end of an existing file ‘file1’ type at the prompt: cat space double right angle bracket space file1 and press Enter.
12:36 There are several other commands that we could have discussed but we would keep it to this for now. In fact, even for all the commands discussed there are many options and possibilities untouched here.
12:50 This brings us to the end of this spoken tutorial. Spoken Tutorials are a part of the Talk to a Teacher project, supported by the National Mission on Education through ICT.
13:02 More information on the same is available at the following link .
13:10 This script has been contributed by ----------------------(name of the translator) and this is -----------------------(name of the recorder) from --------------------------(name of the place)signing off . Thanks for joining.

Contributors and Content Editors

Minal, PoojaMoolya, Pratik kamble, Sandhya.np14