Hi, welcome to this spoken tutorial on General Purpose Utilities in Linux.
In this tutorial, we will make ourselves acquainted with some of the most basic yet heavily used commands of Linux.
The main motivation of this is to give you a head start about working with Linux.
The first command that we will see is the echo command. However note that Linux commands are 'case sensitive'.
Here, all commands and their options are in small letters unless otherwise mentioned.
This command is used to display some message on the screen. Switch to the terminal.
Ctrl Alt t helps to start a terminal in Ubuntu.
This command may not work in all Unix systems however.
A general procedure to open a terminal is already explained in another spoken tutorial.
Type at the prompt: echo space Hello World and press Enter.
This prints the customary 'Hello World' message on the screen.
We can also use the 'echo' command to display the value of a variable.
Type at the prompt: echo space dollar SHELL in capital and press Enter.
This outputs the present shell being used.
We can also use escape sequences with 'echo' command.
For this in Linux we need to use the -e (hyphen e) option.
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.
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.
We will see that the prompt will be displayed after printing ‘Enter a command ‘ on the same line.
You may want to know what version of Linux Kernel you are running.
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 .
To know what is your username, type at the prompt: who space am space I and press Enter.
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.
Sometimes your login password may get compromised and/or you may want to change it.
For this we have the passwd command. Type at the prompt: p-a-s-s-w-d and press Enter.
When you type this command you would be asked to type the current password.
Here I would be typing my system's current password.
When that is correctly entered, you will have to enter your new password and then retype it to confirm.
But what if we have forgotten our current password?
Then also the password can be changed without knowing the current password, but that can only be done by the root user.
Now who is a 'root user'?
He is a special person with extra privileges.
To draw an analogy we can say a 'root user' is similar to a user in Windows with Administrator status.
We may be interested in knowing the system date and time. For this we have the date command.
Type date in the terminal and press Enter
It will show you the present system time and date.
As we can see the date command gives both date and time. This is a very versatile utility and has many options as well.
It gives us only the time in hours minutes and seconds (hh:mm:ss) format.
Type at the prompt: date space plus 'percentage sign small h and press Enter.
It gives the name of the month.
Type at the prompt: date space plus percentage sign small m and press Enter.
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.
Type at the prompt: date space plus percentage sign small y and press Enter .
It gives the last two digit of the current year.
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 .
Here it is showing February 11.
Another related command is the cal command. Though not as common, this helps you to see the calender of any month and any year.
To see the current month's calendar, type at the prompt: cal and press Enter.
To see the calendar of any arbitrary month say December 2070, type at the prompt: cal space 12 space 2070 and press Enter.
This gives the calendar of December 2070.
Before moving ahead let us discuss a little bit about files and directories.
In Linux almost everything is a file. Now the question is what is a file?
In real file a file is where we store our documents and papers. Similarly a Linux file is a container for storing information.
Next what is a directory?
A directory can be understood as a collection of files and other (sub)directories.
A directory helps us in organizing our files in a systematic manner .
This is like what we call folders in Windows.
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.
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.
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.
Type the command ls and press Enter.
Now observe the output.
Files and sub-directories are generally shown with different colours.
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.
This shows all the files including the hidden files (hidden files here are filenames starting with dot (.))
If we not only want to see the file but also get more information we can use the 'minus l' option.
Just type the command: ls space minus small l and press Enter.
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.
ls can be used with many options which we will see later.
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.
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.
Now all the files and directories information will be directed into the file named 'fileinfo'.
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.
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.
Now when we press Enter the command waits for input from the user.
Whatever we type would be written into the file so type some text.
Now press Enter key to indicate the end of input.
Now press the Ctrl and D keys together.
If a file by name say 'file1' already exists then the user input will be overwritten on this file.
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.
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.
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.
More information on the same is available at the following link .
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.