You are on page 1of 26

LINUX SHELL

In Linux Os Shell is a special program that accepts instructions or commands in English, if its a valid command and pass it to kernel. Shell is a command language interpreter that executes commands read from the standard input device(keyboard) or from a file. Shell is not a part of system kernel but uses the system kernel to execute the programs, create files etc. To find the our current shell following command is used:#echo $ shell

Linux/Unix Shells

Shell script defined as: "Shell Script is series of command written in plain text file. Shell script is just like batch file is MS-DOS but have more power than the MSDOS batch file."

Variable
A variable is the label that has a value which will be used to configure the shell. # set / less # set / env

File Permissions in LINUX


Every folder or file in Linux has access permission. There are three types of permissions(what allowed to do with a file): Read access r Write access w Execute access x If access type is denied -

Permissions are defined for three types of users:1. The owner of the file 2. The group that the owner belongs to 3. Other users Thus linux file permissions are nine bits of information (3types by 3types of users), each of them may have just one or two values: allowed or denied.

File Permissions Notations


1. Textual representation like -rwxrr- It is used in linux long directory listings. It consists of 10 characters.The first character shows the file type.Next 9 characters are permissions consisting of three groups: owner,group,others.Each group consists of 3 symbols: rwx , if some permission is denied then a dash - is used. E.g -rwxr--r--.
0123456789

Symbol in the position 0 - is the type of file.It is d if the item is a directory and l if the item is a link. Symbols in the position 1 to 3 rwx are permissions for the owner of the file. Symbols in the position 4 to 6 r-- are permissions for the group. Symbols in the position 7 to 9 r-- are permissions for the others.

2.Numeric (octal) Representation


Digits involved are 0 to 7. Example 644 Here first digit stands for the owner, second digit stands for the group, third digit stands for right of others

How to set file permissions


To apply permission there is a command called as chmod. e. g #chmod 755 testfile. This would change the testfile permissions to -rwxr-xr-x. It means that owner would have full read, write and execute permissions, group and others will have read and execute permissions.

How to create a TAR file in Linux


Tape Archive (TAR) files were used in Linux to back up data to tape. They function similarly to the ZIP file format in the windows environment. Command is: #tar cvf myfile.tar filename1 filename2 where myfile.tar is the name of the TAR file.

To check the contents in a TAR file


Command is: #tar tvf myfile.tar

The contents of the myfile.tar file will be displayed.

To move a file in TAR folder


Command is: #tar rvf myfile.tar yahoo

Extracting the files from a TAR file


Command is: #tar xvf myfile.tar

the system would uncompress (untar) the myfile.tar file in the current directory.

Creating a Tarred file that is compressed with zip


Command is: #tar czvf myfile.tar.gz myfile.tar

You might also like