MCA3060 Exercise 11 SLM

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Linux Operating System Practical

Exercise 11

Exercise 11

The Shell

i. View local variables and environment variables using set and env
commands and comment what you observed. Observe and write your
hostname, username and present working directory (pwd).
ii. Write down the list of executed commands using history
command.
iii. Write down the manual information about any command using
man command and use it.
iv. Allow permission to read, write and execute a file only to member of
your group whereas prohibit to write and execute to other members of
different group using shell prompt/Terminal.

Objective: The objective of this exercise is to enable to you set the


environment variables in your Personal computer. This exercise should
enable you to learn how to use different types of commands and modify the
access permissions of the files to groups and its members.
Procedure and description:
The intention of this exercise is to make you understand how your system
works and how the files work as per the access permissions provided to it.
A shell provides many mechanisms to customize your work environment.
You can customize your work environment as required.
The command man and history is always useful to get the details of any
commands.
In linux, files and directories are owned by a user. There are symbolic and
octal notations by which Unix permission schemes are represented for files.
File, directory and device permissions can be set to allow or deny access to
members of their own group or all others. Modification of file, directory and
device access is achieved with the chmod command. The permissions can
be assigned in octal notation or in the more easily recognized character
format where the command form is: chmod [ugoa][+-=][rwxXst]
fileORdirectoryName. Table 11.1 and 11.2 provides notations and its
descriptions for both symbolic and octal notations.

Sikkim Manipal University

Page No.: 20

Linux Operating System Practical

Exercise 11

Table 11.1:symbolic notations.


Symbolic notation
u
g
o
a
+
=
r
w
x
s
u
t

Description
User access
Group access
Other system user's access
Equivilent to "ugo"
Add access
Remove access
Access explicitly assigned
Permission to read a file Permission to read a directory
(also requires "x")
Permission
to
delete
or
modify
a
file
Permission to delete or modify files in a directory
Permission
to
execute
a
file/script
Permission to read a directory (also requires "r")
Set user or group ID on execution.
Permissions granted to the user who owns the file
Set "sticky bit. Execute file/script as user root for
regular user.

Permissions may be granted using human readable assignments "rwx" or


octal codes.
Table 11.2: octal notations
Description
Read access
Write (change)
permission
Execute script of binary
executable
Read and Execute
Read and Write
Read, Write and
Execute

Sikkim Manipal University

Abbreviation

Octal code

rx
rw

5
6

rwx

Page No.: 21

Linux Operating System Practical

Exercise 11

Algorithm: The steps for this exercise are given below:


Step 1: Type set in your command prompt. Study about the environment
variables of your OS. Observe and write your hostname, username and
present working directory (pwd).
Step 2: Type env in your command prompt. Study about the environment
variables of your OS. Observe and write your hostname, username and
present working directory (pwd).
Step 3: Type history in your command prompt. Note the commands that
you have already typed in command prompt and note it down.
Step 4: Type man man in your command prompt. Note the manual of
man and study how it can be used.(try man command to get manual of other
commands)
Step 5: Use the command chmod. (Type in the command prompt#
chmod xxx some_file. In place of xxx, use the number 777 or 755 or 700
or 666 or 644 or 600 and check the access permissions. You can also use
symbolic notations to modify the file access permissions. Type in the
command prompt # chmod a+x some_file and check the access
permissions. Avail access permissions by typing g+w or o-rwx or u+x or
a+rw or ug+r or g=rx etc. in place of a+x and check the access
permissions. Use - minus sign to Remove access from all others)
Expected Output: Able to use shell for various specified purposes.

Sikkim Manipal University

Page No.: 22

You might also like