Difference between revisions of "Linux Spoken Tutorial/Basic Level Tutorial Set/Linux-part2"
(Created page with 'Spoken tutorial on basic linux commands part – 2 {| style="border-spacing:0;" | style="border-top:0.035cm solid #000000;border-bottom:0.035cm solid #000000;border-left:0.035…') |
(No difference)
|
Latest revision as of 16:30, 9 January 2013
Spoken tutorial on basic linux commands part – 2
|
|
Show first slide from the presentation | Dear friends,
Welcome to the second part of spoken tutorial on basic linux commands In this tutorial we will focus on directory operaions and file permissions. |
Show second slide from the presentation | First command that we will cover is mkdir. This command creates a new directory in linux file system. |
Switch to console and type
mkdir testdir |
To create a new directory we will type mkdir tesdir. This will create a new directory called testdir. <pause> Let us now list all sub directories under the current directory and see if new directory has been created. |
Type ls and highlight the newly created directory | As you can see we success fully create a new directory called testdir. |
Stay in console | Mkdir can create multiple directories under a given path. When used with -p switch, mkdir will create all the required directories in a given path. |
Switch to console and type
mkdir -p /tmp/hello/world |
We will now create a new directory called hello in the /tmp directory and another subdirectory called world under the newly created hello directory. |
Switch to console and type
|
As you can this command created a directory called hello and a subdirectory called world under hello. |
Show slide number 3 | Let us now create a directory structure as shown in the figure. |
Switch to console and type
|
|
Stay in console and type
|
As you can see, we create the required directory with a single command. <pause> |
Switch to slide 4 | Now lets move to next command. <pause> chown is a command used to change the ownership of a file or directory. |
Switch to console | To change the ownership of a file or directory, type chown followed by options and filename. |
Stay in the console and type
|
This command will change the ownership of the tmpdir to root user.<pause>
You can specify the oner user and owner group for a file with chown. |
Stay in the console and type
|
This command will change the ownership of tmpdir to nobody user and nogroup group. |
Stay in console and type
|
You can change the ownership of all files and subdirectories in a given directory at once, recursively. The -R will make chown change permissions of all files and directories recursively. |
Switch to slide number 5 | Before moving to our next command, lets look at a unix file permissions. <pause> In unix world, every file and directory has permissions associated with it. These permissions control who can read, write or execute a file or directory.<pause> An user will require execute permission on a directory, if he wants to change directory to a given directory.<pause>
Let us now look at few files and the permissions associated with the files.
|
Switch to console and type
|
As you can see with every file you have some permissions. <highlight the permission bits in the console>. <pause> First thre e letters will tell you the permissions that owner of a file has <highlight first three rwx bits>. <pause> Next three letters will tel you what permissions the owner group of the file has <highlight next three bits of the permissions> <pause>. Last three letters will tell you what are the permissions for rest of the world.<pause>
A r in first place means you have read permissions on the file.<pause> A w in second position means you have write permission on the file.<pause> A x in third position means you have execute permission on the file. |
Switch to slide number 6 | Let us now look at chmod command in unix world that lets you change the permissions of a file |
Switch to console and type
|
You can see that file has only read permissions. Let us add write permissions to the owner of the file. |
Stay in console and type
|
In this command u represents user permissions and plus sign represents adding permissions. |
Stay in console and type
|
To remove a specific permission from a file you have to use minus sign. |
Stay in console and type
|
To add permissions for a group we will use g instead of u. |
Stay in console and type
|
To give write permission to all users, we will use a plus w. |
Switch to console and type
|
To grant write permissions to all files in a directory you can use -R option. This option will recursively apply the specified permissions. |
Switch to slide number 7 | Our next command is chgrp which allows you to change the group of a file. |
Switch to console and type
|
To change the group of a file we will type the following command <type the command in the console> |
Stay in console and type
|
As we can see the group of the file abc.txt is now changed to nogroup. |
Switch to slide number 8 | Our next command is rm. This command lets us remove files and directories from the file system. |
Switch to console and type
|
To remove a file simply type following command <type the command in the console>. |
Stay in console and type
|
Rm will not remove a directory by default. You have to specify the -r switch to remove the directory.<pause> You can also force the removal of a file or directory by using a -f switch. |
Switch to slide 9 | This brings us to the end of the second part of spoken tutorial on basic linux commands. Thanks for watching this tutorial. |