Linux Spoken Tutorial/Basic Level Tutorial Set/Linux-part1

From Process | Spoken-Tutorial
Jump to: navigation, search

Spoken tutorial on basic linux commands part – 1

Visual Cue
Show slide number 1 Dear friends,

welcome to first part of spoken tutorial on basic linux commands.

Switch to slide number 2 Before we start learning any command, let us have a look on a command to provide help on other commands. <pause> To find help on any linux you can use a command called man.
Switch to console and type

man cp

To find help on a linux command cp, let us type man cp.<pause> What you see is the manual of the cp command. You can use up arrow and down from arrow to navigate through the manual.
Stay in the console and press q To exit from the manual, you have to press q key.
Switch to slide number 3 Most linux commands have a built in –help switch. This provides a short help on the given command and lists all the options available for the given command.
Switch to console and type

cp –help

As you can see, --help lists all the options available for copy command and how to use cpy command.
Switch to slide number 4 Our first linux command for this tutorial is cp. This command copies files or directories from one location to another.
Switch to console and type

cp abc.txt temp

To copy abc.txt to temp directory type cp space abc.txt space temp. Simple and you are done copying the file from one location to other.
Stay in console and type

cp -r temp perm

Cp by default will not copy directories. To copy a directory you have to use the option -r . <pause> to copy temp directory to perm directory, type cp space minus r space temp space perm. Here temp is known as source and perm is known as destination.
Switch to slide number 5 Our next command is for moving files from one location to anothher. The command to move a file, the command is mv.
Switch to console and type

mv xyz.txt perm

To move a file from current directory to perm directory, type mv space xyz.txt space perm .
Stay in console and type

mv first.txt second.txt

Mv command can also be used to rename files and directories. To rename fisrt.txt to second.txt, type mv spave first.txt space second.txt. Thats all and the file is renamed.
Switch to slide number 6 Our next command will help us list all files and sub-directories in a given directory.<pause> This command is called ls.
Switch to console and type


When you type ls in the console, a list of all files and directories is shown. Based on the configuration of the console, directories and some files may be shown in different color.
Stay in console and type

ls -a

Ls doesnot list hidden files by default. To list hidden files type ls witth -a option.<pause> As you can see hidden files and directories, starting with a dot are now listed
Stay in console and type

ls -l

Ls can list more information about files along with listing. When combined with -l option the ls commandd will show you the filename, permissions, owner user, owner group, size and date of modification. <highlight each attribute in console as it is spoken>
Stay in console and type

ls -lh

The long listing generated by ls -l option shows file size in bytes. This will require you to convert the the bytes to megabytes or gigabytes to have an idea of how much space is being used by a file.
Switch to slide number 7 Now let us look at a command that will allow us to change directories. The command is called cd .
Switch to console and type

cd dummy

To switch to directory called dummy type cd space dummy. Notice the prompt in the console shows the new directory name. <highlight the changed directory name in the console>
Switch to slide number 8 Last command that we will learn in this tutorial is ln . This command is used to create links to files or directories.<pause>

Unix systems support two types of links.<pause> hard links and symbolic links.

Stay with the slide Symbolic links are also known as soft links. When you create a symbolic link, a special file is created that refers to another file. A symbolic link can exist independent of the original file.If the target file is deleted or moved, symbolic link still exists but it points to a file that does not exist.
Stay with the slide Hard links are special files too but if you remove the original file, the data can still be accessed through the hard link.
Switch to console Let us look at few examples to understand thsi better.
Stay in console and type

ln -s original.txt symb.txt

Let us create a symbolic link. To create a symbolic link type ln -s original.txt symb.txt. <pause> This will create the symbolic link.
Stay in the console and type

ln original.txt hard.txt

Let us now create a hard link. To create a hard link type ln original.txt hard.txt . This will create a hard link
Stay in the console and type

ls -l

On long listing the files in a directory, we can see that soflink is represented differntly and points to the original file location <highlight the link as you speak it>. <pause> You will notice that hard link is shown as a normal file.
Stay in the console and type

rm -f original.txt

ls -l

Now, if we remove the original file and do a listing, you will notice that symbolic link has a red marking. This is because the original file pointedd by the symbolic link, soesnot exist any more.
Stay in the console and type

cat symb.txt

If we try to open symb.txt by typing cat symb.txt , we get an error. <hightlight the error in the console>
Stay in the console and type

cat hard.txt

Lets now open hard,.txt by typing cat hard.txt . We notice that data of the original.txt is still available in the hard link.
Switch to slide number 9 This brings us to the end of the first part of spoken tutorial on basic linux commands. Thanks for watching this tutorial.

Contributors and Content Editors