Upload
pyinternet
View
222
Download
0
Embed Size (px)
Citation preview
8/3/2019 Linux Shell and Per Missions and Tar
http://slidepdf.com/reader/full/linux-shell-and-per-missions-and-tar 1/26
LINUX SHELL
• In Linux Os Shell is a special program that acceptsinstructions or commands in English, if it’s a validcommand and pass it to kernel. Shell is a commandlanguage interpreter that executes commands read
from the standard input device(keyboard) or from afile. Shell is not a part of system kernel but uses thesystem kernel to execute the programs, create files etc.
• To find the our current shell following command isused:-
#echo $ shell
8/3/2019 Linux Shell and Per Missions and Tar
http://slidepdf.com/reader/full/linux-shell-and-per-missions-and-tar 2/26
Linux/Unix Shells
8/3/2019 Linux Shell and Per Missions and Tar
http://slidepdf.com/reader/full/linux-shell-and-per-missions-and-tar 3/26
• 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 MS-
DOS batch file."
8/3/2019 Linux Shell and Per Missions and Tar
http://slidepdf.com/reader/full/linux-shell-and-per-missions-and-tar 4/26
Variable
• A variable is the label that has a value which
will be used to configure the shell.
# set / less
# set / env
8/3/2019 Linux Shell and Per Missions and Tar
http://slidepdf.com/reader/full/linux-shell-and-per-missions-and-tar 5/26
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 “-”
8/3/2019 Linux Shell and Per Missions and Tar
http://slidepdf.com/reader/full/linux-shell-and-per-missions-and-tar 6/26
• Permissions are defined for three types of
users:-
1. The owner of the file2. 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.
8/3/2019 Linux Shell and Per Missions and Tar
http://slidepdf.com/reader/full/linux-shell-and-per-missions-and-tar 7/26
File Permissions Notations
1. Textual representation like “-rwxr—r-”
It is used in linux long directory listings. Itconsists of 10 characters.The first character
shows the file type.Next 9 characters arepermissions consisting of three groups:owner,group,others.Each group consists of 3symbols: rwx , if some permission is deniedthen a dash “-” is used. E.g “-rwxr--r--”.
0123456789
8/3/2019 Linux Shell and Per Missions and Tar
http://slidepdf.com/reader/full/linux-shell-and-per-missions-and-tar 8/26
• 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.
8/3/2019 Linux Shell and Per Missions and Tar
http://slidepdf.com/reader/full/linux-shell-and-per-missions-and-tar 9/26
8/3/2019 Linux Shell and Per Missions and Tar
http://slidepdf.com/reader/full/linux-shell-and-per-missions-and-tar 10/26
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
8/3/2019 Linux Shell and Per Missions and Tar
http://slidepdf.com/reader/full/linux-shell-and-per-missions-and-tar 11/26
8/3/2019 Linux Shell and Per Missions and Tar
http://slidepdf.com/reader/full/linux-shell-and-per-missions-and-tar 12/26
8/3/2019 Linux Shell and Per Missions and Tar
http://slidepdf.com/reader/full/linux-shell-and-per-missions-and-tar 13/26
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.
8/3/2019 Linux Shell and Per Missions and Tar
http://slidepdf.com/reader/full/linux-shell-and-per-missions-and-tar 14/26
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.
8/3/2019 Linux Shell and Per Missions and Tar
http://slidepdf.com/reader/full/linux-shell-and-per-missions-and-tar 15/26
To check the contents in a TAR file
• Command is:
#tar –tvf myfile.tar
The contents of the myfile.tarfile will be displayed.
8/3/2019 Linux Shell and Per Missions and Tar
http://slidepdf.com/reader/full/linux-shell-and-per-missions-and-tar 16/26
To move a file in TAR folder
• Command is:
#tar –rvf myfile.tar yahoo
8/3/2019 Linux Shell and Per Missions and Tar
http://slidepdf.com/reader/full/linux-shell-and-per-missions-and-tar 17/26
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.
8/3/2019 Linux Shell and Per Missions and Tar
http://slidepdf.com/reader/full/linux-shell-and-per-missions-and-tar 18/26
Creating a Tarred file that is
compressed with zip
• Command is:
#tar –czvf myfile.tar.gz myfile.tar
8/3/2019 Linux Shell and Per Missions and Tar
http://slidepdf.com/reader/full/linux-shell-and-per-missions-and-tar 19/26
8/3/2019 Linux Shell and Per Missions and Tar
http://slidepdf.com/reader/full/linux-shell-and-per-missions-and-tar 20/26
8/3/2019 Linux Shell and Per Missions and Tar
http://slidepdf.com/reader/full/linux-shell-and-per-missions-and-tar 21/26
8/3/2019 Linux Shell and Per Missions and Tar
http://slidepdf.com/reader/full/linux-shell-and-per-missions-and-tar 22/26
8/3/2019 Linux Shell and Per Missions and Tar
http://slidepdf.com/reader/full/linux-shell-and-per-missions-and-tar 23/26
8/3/2019 Linux Shell and Per Missions and Tar
http://slidepdf.com/reader/full/linux-shell-and-per-missions-and-tar 24/26
8/3/2019 Linux Shell and Per Missions and Tar
http://slidepdf.com/reader/full/linux-shell-and-per-missions-and-tar 25/26