[email protected] +91 9175287066
This website is always under updation with new contents
Unit - IV
Unit I
Unit II
Unit III
Unit IV
Unit V
Q1) Explain the octal file permission:
Ans: Octal file permission use the numbers in the range zero to seven(0-7) for setting access permission
settings. When using octal file permission we will new to remember the following
• Read permission is represented by the value 4
• Write permission is represented by the value 2
• Execute permission is represented by the value 1
USER GROUP OTHER
READ 4 4 0
WRITE 2 0 0
EXECUTE 0 0 0
In order to assign an octal permission it is helpful to construct a simple table representing the permissions and the user classes to which they are to be applied as shown in above fig.
The table shows a permission setting giving the owned read and write permission,
the group users has only read permission and the others users has no permission at all.
Each column is summed to give the final octal code. This octal code is used on command line as the actual protection setting .
This octal protection setting is equivalent to the symbolic setting in the command chmod u+rw, g+r, o-rwx.
These are the examples from the Symbolic notation section given in octal notation:
• "-rwxr-xr-x" would be represented as 755 in three-digit octal.
• "-rw-rw-r--" would be represented as 664 in three-digit octal.
• "-r-x------" would be represented as 500 in three-digit octal.
Here is a summary of the meanings for individual octal digit values:
0 --- no permission
1 --x execute
2 -w- write
3 -wx write and execute
4 r-- read
5 r-x read and execute
6 rw- read and write
7 rwx read, write and execute
Octal digit values can be added together to make Symbolic Notations:
(4=r)+(1=x) == (5=r-x)
(4=r)+(2=w) == (6=rw-)
(4=r)+(2=w)+(1=x) == (7=rwx)
Here is a summary showing which octal digits affect permissions for user, group, and other:
UGO = User, Group, Other
• 777 = "-rwxrwxrwx" = rwx for all
• 754 = "-rwxr-xr--" = rwx for owner, r-x for group, r-- for other
• 124 = "--x-w-r--" = x for owner, w for group, r for other
Q2) Explain the following commands. i) Kill ii)talk

Ans: i)Kill: In computing, kill is a command that is used in several popular operating systems to send signals to running processes,
for example to request the termination of this process.
To car you the killigng we must first note the PID of the process to be killed using th eps command.
Then we must employ this PID and the kill command to terminate the process . Ex is
$ cat employee.dat | grep ‘nagpur’ | sort > output.dat &
6173
$
The kill command allows you to kill one process ID or multiple process IDs.
The syntax for the kill command is:
kill [options] IDs
Example:
kill -9 78689
When invoked the kill command sends a termination signal to the process being killed.
A signal is a mechanism to communicate with a process being killed. A signal is a mechanism to communicate with a process.
These signals have been given numbers. When the signal number is not given it will take the default signal number but this default signal is not powerful and may not able to kill process at all time.
At such time we can employ signal number 9 the ‘sure kill’ signal to forcibly terminate a process as shown below.
Kill -9 2316
There are some process which cannot be killed by sure kill signal. For ex. Sched or vhand cannot be killed using the sure kill signal.
This is quite reasonable, because if these process get killed the entire Unix Os would collapse.
Talk : The command talk creates a two-way, screen-oriented communication program.
It allows users to type simultaneously, with their output displayed in separate regions of the screen.
To send a talk request, type talk and then @.
So, for example, to send a talk request to dmb, who is logged on to cslab0a, type talk [email protected] .
The recipient of the request is then prompted for a response.
Syntax: talk person [ttyname ]
Options available:
person :If you wish to talk to someone on your own machine, then person is just the person's login name.
If you wish to talk to a user on another host, then person is of the form `[email protected]'
ttyname : If you wish to talk to a user who is logged in more than once, the ttyname argument may be used to indicate the appropriate terminal name,
where ttyname is of the form `ttyXX' or `pts/X' When first called, talk contacts the talk daemon on the other user's machine, which sends the message
Message from [email protected]_machine... talk: connection requested by [email protected]_machine.
talk: respond with: talk [email protected]_machine
to that user. At this point, he then replies by typing
talk [email protected]_machine
It doesn't matter from which machine the recipient replies, as long as his login name is the same.
Once communication is established, the two parties may type simultaneously; their output will appear in separate windows.
Typing control-L (^L) will cause the screen to be reprinted.
The erase, kill line, and word erase characters (normally ^H, ^U, and ^W respectively) will behave normally.
To exit, just type the interrupt character (normally ^C);
talk then moves the cursor to the bottom of the screen and restores the terminal to its previous state.
Q3) What do you mean by backing up of data? How is it done?
Ans: Backups are taken as preventive measures against the loss of information through system breakdown, accidental erasure or corruption of data.
A backup copy of a file is a simply an exact copy of that file.
Backup can be complete copy of a complete file system are at least a part of it.
The key point is to remember that backup copies are not really intended to capture the working state of the system at a specific time;
they are taken so that data can be restored up to the time that the backup was take. The Unix system is rich in backup facility. The commands which provide backup facility are dump, restore, tar.
Dump command: It is one of a pair of commands that is used to backup files from a system disk to portable storage media such as floppy disk or tape cartridges.
Data backed up using the DUMP command can be restored to the system using the restore command.
When using the dump utility it is necessary to understand the concept of dump levels which allow the incremental backups to be taken.
The dump level exists in nearly all implementations of the dump utility, each of which defines the extent of the dump being taken.
The syntax of the dump command is :
Dump [dump level] [option][file system]
The dump command has many options. It includes s, u and f.
If you are using a tape cartridge the s option is used to set the length of the tape.
The actual mount is placed directly after the s option. The dump commands expect a default value for the tape length.
The u option is used to append a record to a file that records each dump operation. The /etc/ddate file is commonly used to store these records.
The f option is used to force a dump to a non default device. The name of the device follows f option.
Default dump devices are specific to individual UNIX systems. A typical dump command could therefore take the form: $ dump 4f /dev/crt04/dev/dk05
These commands make a level 4 dump of the file system that is store don the disk device /dev/dk05.
The dump will return to the cartridge device /dev/crt04,a removable data storage media item.
Restore utility: The restore command as the name suggests, is used to restore data from disk or tape etc.
onto a system disk. The syntax of the command is
Restor [option][device][filename]
The most command options are x and r which instruct restore to restore single and multiple files respectively .
The f <$device> option allows restoration to be carried out on to non default devices.
Example:
A typical command could be:
$ restore r /dev/dk05
This command restores multiple files on to the disk device /dev/dk05.
If you do not know which your system’s default device is, you can specify the name of the device literally.
The tar utility: The tar commands restore and save multiple files on a single storage media item and tar stands for tape archive.
The actual copies of the files cannot be controlled on an incremental basis through dump level as with the dump command, but tar is useful since it takes back up files according to their position in the file system.
Tar can also be used to restore archived information. This is done using a specific restore option.
The syntax of the tar command is tar [key [option]] [file…]
Only the key can be specified and this determines how tar operates- whether to make copies of files or extract exiting files etc.
Q4) Explain the role of system administrator.
Ans: The system administrator is responsible for following things:
1. User administration (setup and maintaining account)
2. Maintaining system
3. Verify that peripherals are working properly
4. Quickly arrange repair for hardware in occasion of hardware failure
5. Monitor system performance
6. Create file systems
7. Install software
8. Create a backup and recovery policy
9. Monitor network communication
10. Update system as soon as new version of OS and application software comes out
11. Implement the policies for the use of the computer system and network
12. Setup security policies for users. A sysadmin must have a strong grasp of computer security (e.g. firewalls and intrusion detection systems).
Q5) Explain in detail the password commnd.
Ans: passwd: It is utility that allow a user to change their current password.
The password file is a plain ASCII file and it resides in /etc/ directory, hence its full pathname is /etc/passwd.
This file is common to all Unix system and it contain critical information about each user of Unix of which the passwd is only on piece of information.
Syntax:
Passwd [-option] [user]
The passwd command has one main argument namely a username. This username must exist in /etc/passwd file if the command is to work.
If username argument is not specified then passwd cahnegs the passwd of the person who is currently logged in.
Only the super user can use the suer_name argument, unless the username argument is the name of the person currently logged in with that name.
Passwd will not change the user’s password unless the old password is typed in first.
New passwords can be typed in twice for verification reasons. A user who forgets password cannot ask the system manager for that password to be revealed.
All the system manger can do is reissuing a new password using the password command.
The option that can be used password command allow the user to change other information in the /etc/passwd file.
Example:
$ passwd jim
Changing password:
New password:
Retype new password:
$
This example will work only if the user issuing the passwd command is Jim.
If the user does not log in under the name jim then this command would fail. Only the super user can change the password of any user on the system.
The user’s old password I typed first this authenticates that the user issuing the command is the person in question and should a user forget to log out.
It prevents someone else to issue the passwd command at their terminal to try to change the password.
The old password and new password cannot echoed on the screen. This is compulsory feature and is also used when you initially logged in.
The user has to retype new password so verify it and to make sure that the user remembers the new password.
The shell returns to $ prompt that indicate that the password has been changed.
Example 2: $ passwd john
Must be logged in as root
This ex shows a common message that indicates that you must be logged in as root to change another user’s password, which is action being attempted here.

Q6) Describe with suitable example how symbolic and octal file permission can be changed using chmod command.
Ans: octal file permission using chmod :
The chmod command accepts up to four digits to represent an octal number.
The octets refer to bits applied to the file owner, group and other users, respectively.
Use of three digits is discouraged because it leaves the fourth as the default and this value is not fixed.
The least significant digit sets/resets an additional mode for each of these three sets of bits.
Experienced Unix and Linux users tend to recommend that the user of this command check the man page (man chmod) on the system of interest.
Particular care should be taken when a directory is the target because the effect is not intuitive.
In addition, it will not work on all file types. For example, it has no effect on a symbolic link myfile :
$ chmod 664 myfile
$ ls -l myfile
-rw-rw-r-- 1 57 Jul 3 10:13 myfile
The chmod command accepts up to four digits to represent an octal number.
The octets refer to bits applied to the file owner, group and other users, respectively.
Use of three digits is discouraged because it leaves the fourth as the default and this value is not fixed.
The least significant digit sets/resets an additional mode for each of these three sets of bits.
Experienced Unix and Linux users tend to recommend that the user of this command check the man page (man chmod) on the system of interest.
Particular care should be taken when a directory is the target because the effect is not intuitive. In addition, it will not work on all file types.
For example, it has no effect on a symbolic link. myfile :
$ chmod 664 myfile
$ ls -l myfile
-rw-rw-r-- 1 57 Jul 3 10:13 myfile
The modes indicate which permissions are to be granted or taken away from the specified classes.
There are three basic modes which correspond to the basic permissions:

Q7) what are daemons? Explain the purpose of the update daemon.
Ans: Daemons are processes that are normally executed in the background.
They perform a variety of tasks such as looking after printer and executing commands at certain times of day etc.
There are number of daemons such as Cron, Update, LPAD etc.
Update daemon: Update is a daemon found as part of the Berkeley tool set. It is program that periodically updates the system’s superblock area.
It issues a command called sync approximately every 30 seconds.
This is done to keep the file system up-to-date in a case system breakdowns occur.
The update command should not be executed directly and is most commonly started as a daemon from the /etc/rc file.
However the sync command can be entered directly and it is common for some systems to have an /etc/passwd entr y of:
Sync: :1:1: :/bin/sync
This entry will allow sync program to be executed by typing the username sync at the login:prompt.
It means that the executable file/bin. sync has replaced the normal login shell.
No user can thus log in under such a username, but it allows the command to be run simply but issuing its name.
However it should be mentioned that any user can run this command, since it is not executed upon logging in but is executed when user issues the particular user_name/command.
There is no protection setting in force at this stage either.

Q8) what is electronic mail? Explain write and wall command .
Ans: Electronic mail (E-mail, Email, e-mail, or email) on a Unix system is invoked with the mail or mailx command.
Sending Mail
Invoking Mail To Send Messages
To invoke the UNIX mail utility program to send messages, type mailx email-names
or
mailx -s subject email-names
where email-names is a list of electronic mail names of people to whom you wish to send the message and subject is the subject (or title) of the message being sent.
The email name may be as simple as name or [email protected] or may require the name followed by a fully qualified host/domain name (e.g. [email protected]).
If the mailx command does not prompt you for a subject (which is nice to include for the receiver of the mail), it can be included with the -s option.
After invoking the mailx utility, simply type in lines of text (hit the key after entering each text line).
When you are done entering the message, hit -D (at the start of a new line) to send the message (and exit back to the system or UNIX prompt).
To abort a message and exit mailx, type -C twice.
Message Text Commands
Tilde escapes are entered at the start of a text line (when entering mail message text) to perform some useful operations.
Hit the key after entering a tilde escape sequence/command.

Q9) Explain CPIO command. What is the easiest way to back up a small number of files?
Ans: CPIO command: cpio command is useful to backup the file systems.
It copy file archives in from or out to tape or disk, or to another location on the local machine.
Its syntax is
cpio flags [options]
It has three flags, -i, -o, -p
o cpio -i [options] [patterns]
o cpio -i copy in files who names match selected patterns.
o If no pattern is used all files are copied in.
o It is used to write to a tape.
cpio -o
o Copy out a list of files whose name are given on standard output.
cpio -p
o copy files to another directory on the same system.
Options
o -a reset access times of input files.
o -A append files to an archive (must use with -o).
o -b swap bytes and half-words. Words are 4 bytes.
o -B block input or output using 5120 bytes per record.
o -c Read or write header information as Ascii character.
o -d create directories as needed.
o -l link files instead of copying.
o -o file direct output to a file.
o -r rename files interactively.
o -R ID reassign file ownership and group information to the user's login ID.
o -V print a dot for each file read or written.
o -s swap bytes.
o -S swap half bytes.
o -v print a list of filenames.
Examples
o find . -name "*.old" -print | cpio -ocvB > /dev/rst8 will backup all *.old files to a tape in /dev/rst8
o cpio -icdv "save"" < /dev/rst8 will restore all files whose name contain "save"

Q10) Give command to find which processes are running on the system. What is the function of kill command.
Ans: Command to check the process status (ps command)
Any time the system is running, processes are also running. You can use the ps command to find out which processes are running and display information about those processes.
The ps command has several flags that enable you to specify which processes to list and what information to display about each process.
To show all processes running on your system, at the prompt, type the following:
ps -ef
The system displays information similar to the following:
USER PID PPID C STIME TTY TIME CMD
root 1 0 0 Jun 28 - 3:23 /etc/init
root 1588 6963 0 Jun 28 - 0:02 /usr/etc/biod 6
root 2280 1 0 Jun 28 - 1:39 /etc/syncd 60
mary 2413 16998 2 07:57:30 - 0:05 aixterm
mary 11632 16998 0 07:57:31 lft/1 0:01 xbiff
mary 16260 2413 1 07:57:35 pts/1 0:00 /bin/ksh
mary 16469 1 0 07:57:12 lft/1 0:00 ksh /usr/lpp/X11/bin/xinit
mary 19402 16260 20 09:37:21 pts/1 0:00 ps -ef
The columns in the previous output are defined as follows:
USER User login name
PID Process ID
PPID Parent process ID
C CPU utilization of process
STIME Start time of process
TTY Controlling workstation for the process
TIME Total execution time for the process
CMD Command
In the previous example, the process ID for the ps -ef command is 19402. Its parent process ID is 16260, the /bin/ksh command.
For accessing computer programs go to TECHNOLOGY