Learning UNIX.: 2.0 Main Features of UNIX
Learning UNIX.: 2.0 Main Features of UNIX
Part 1: Overview/1
http://uva.ulb.ac.be/cit_courseware/unix/onlinet.htm
http://www.nextstep4it.com/qa/linux/systemadmin/index3.html
multi-user
more than one user can use the machine at a time
supported via terminals (serial or network connection)
multi-tasking, more than one program can be run at a time
hierarchical directory structure, to support the organisation and maintenance of files
portability
only the kernel ( <10%) written in assembler. This meant the operating system could be
easily converted to run on different hardware
tools for program development, a wide range of support tools (debuggers, compilers)
kernel
schedules programs
manages data/file access and storage
enforces security mechanisms
performs all hardware access
shell
presents each user with a prompt
interprets commands types by a user
executes user commands
supports a custom environment for each user
utilities
file management (rm, cat, ls, rmdir, mkdir)
user management (passwd, chmod, chgrp)
process management (kill, ps)
printing (lp, troff, pr)
program development tools
The switching between user programs is done by part of the kernel. To switch from one program
to another requires,
The timed event is usually about 1 to 10 milliseconds apart. It is generated by a real-time clock.
The more memory that can be provided in total the better. Where there is insufficient main
memory to run a users program, some other users program residing in main memory must be
written out to the disk unit to create some free memory space.
This process is called swapping. When the system becomes overloaded (where there are more
users than the system can handle), the operating system spends most of its time shuttling users
programs between main memory and the disk unit, and users response time degrades. This is
called disk thrashing and is overcome by installing more main memory.
4.2 Processes
Each program running on a UNIX system is called a process. When a user types a command,
UNIX constructs a Process Control Block (PCB) for the process that process. Each process has a
PCB that holds its priority, the process state, register information and additional details.
UNIX provides a set of utilities for managing processes.
ps list processes
kill kill a process
& run a process in the background
If the system administrator found that a particular user was performing an operation that was
consuming too much computing time or dominating a system resource such as a printer, they
could use the ps command to identify the offending users process and then use the kill command
to terminate that process.
Each program is assigned a priority level. Higher priority tasks (like reading and writing to the
disk) are performed more regularly. User programs may have their priority adjusted dynamically,
upwards or downwards, depending upon their activity and available system resources.
Multi-tasking systems support foreground and background tasks. A foreground task is one that
the user interacts directly with using the keyboard and screen. A background task is one that runs
in the background (it does not have access to the screen or keyboard). Background tasks are
usually used for printing.
Bourne (sh)
Korn (krn)
C shell (csh)
Bash (an improved Bourne shell with history and aliases)
The shell is often called a command line shel, since it presents a single prompt for the user. The
user types a command, the shell invokes that command, then presents the prompt again when the
command has finished. This is done on a line by line basis, hence the term 'command line'.
Recent enhancements turn the command line interface into a graphical one (X, MOTIF,
OPENVIEW), where programs are represented as objects or icons on a screen. By use of a
mouse these icons are selected and run. This is similar to operating systems like Windows or
OS/2.
For instance, a person can give another access to a file and let them create a link to it. In this way
they both can access and work with the same file, ensuring that the information they enter into
the file is up-to-date. Only the original owner of the file may delete the file.
6.3 What are the security rights associated with files and directories?
UNIX provides three sets of security rights for each file and directory entry. These sets are for
the owner, the group to the owner belongs, and any other users on the system.
Each user belongs to a group (only one at a time). Group membership facilitates the sharing of
common files. A user can change their membership to another group by using the newgrp
command.
An empty directory on the root file system is selected as the mount point, and using the UNIX
mount command, the new file system will appear under this directory.
For example, a program that normally reads from stdin (the keyboard) can be redirected to read
from a file.
In a similar manner, a program that
normally writes to stdout (the screen) can
redirect its output to a file or printer. In this
example, the ls command redirects stdout to
files.
6.9 Pipes
Sometimes, the use of intermediatary files is undesirable. Consider an example where you are
required to generate a report, but this involves a number of steps. First you have to concatenate
all the log files. The next step after that is strip out comments, and then to sort the information.
Once it is sorted, the results must be printed.
A typical approach is to do each operation as a separate step, writing the results to a file that then
becomes an input to the next step.
Shell scripts
Once the script file has execute rights, the shell script is
run by typing its name.
7.4 Defining Shell Variables
Support for repetitive tasks (for and while statements) and conditions (if and select statements)
allow system administrators to write scripts that are reasonably powerful.
8.0 Networking
This section deals with some of features and commands associated with networking or accessing
other UNIX systems.
UNIX systems are usually interconnected using TCP/IP (transmission control protocol, Internet
protocol). This is a protocol mechanism that is widely used by large networks world-wide to
interconnect computers of different types.
A protocol is a set of rules that governs how computers talk to each other. TCP/IP is a widely
used and very popular protocol. With TCP/IP, different computer systems can reliably exchange
data on an interconnected network. It also provides a consistent set of application programming
interfaces (API's) to support application development.
8.2 Remote Execution (rexec)
This allows you to execute a command on another host and receive the results on your local
machine. This means you can take advantage of better processing power or unavailable software
which your local machine does not have.
A host machine, username, password and the command to execute are passed to the host
machine. If the authenification succeeds, the command is executed, and responses returned to
your local machine.
cit.ac.nz
and contains the higher level domain names of ac (academic) and nz (New Zealand). Examples
of the host computers at CIT are called news, ice, and www. Their host names in the domain are
news.cit.ac.nz
ice.cit.ac.nz
www.cit.ac.nz
Users are also assigned names. Consider the user joe, who has an account on the host machine
ice. The domain name for this user is,
When you send email or access resources on other computers, the domain names need to be
resolved in order that a connection is made to the correct computer. One host computer in the
network acts as a name resolver (domain name server), which resolves domain names to
computers. For example, if you want to ftp to the local host ice, your computer sends a request to
the designated name domain server, which if it knows about the host ice, will send back the
computer TCP/IP address, which your computer then uses to initiate a connection request.
The name domain server uses a special file called hosts to resolve host names and their TCP/IP
addresses.
names
packets transmitted and received
errors
routing information
8.9 Network Services
To provide services such as ftp, telnet and WWW servers, they are enabled on the host computer
by running the appropriate software, called a system daemon process. For example, to configure
a computer as an ftp server requires the installation, configuration and running of the ftpd
process (most system processes end in d, which means daemon).
If the daemon process is not started, the service is not available on that host computer. In other
words, you cannot ftp into a host which is not running the ftp daemon service.
When a UNIX host starts up, it usually runs an inetd service, which reads the file /etc/inetd.conf
which contains a list of the networking services for the host to run. A system administrator
would edit this file and include the various services that are required to run when the system
starts.
8.10 Sockets
Sockets are an end to end numbered connection between two UNIX machines communicating
via TCP/IP. Standard packages are assigned special socket numbers (telnet is port 23). The
socket numbers for various protocols and services are found in /etc/services.
A programming socket interface provides calls for opening, reading, writing and closing a socket
to another host machine. In this way, the programmer need not be concerned with the underlying
protocol associated with the socket interface.
$ arp
Address HWtype HWaddress Flags Mask Iface
lewis-fe00sw-dit.cit.ac ether 00:30:19:77:83:00 C eth0
flame.cit.ac.nz ether 00:C0:4F:CF:99:C2 C eth0
$
8.11.2 netstat (network status)
This command displays the network status of the local host. It provides information about the
TCP connections, packet statistics, memory buffers and socket information.
$ netstat
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 126 luni.cit.ac.nz:telnet flame.cit.ac.nz:1756 ESTABLISHED
tcp 0 0 luni.cit.ac.nz:telnet dhcp-78-8.cit.ac.n:1100 ESTABLISHED
tcp 0 0 luni.cit.ac.nz:telnet dhcp-78-3.cit.ac.n:1130 ESTABLISHED
Active UNIX domain sockets (w/o servers)
Proto RefCnt Flags Type State I-Node Path
unix 2 [ ] STREAM 830794 /dev/log
unix 2 [ ] STREAM CONNECTED 830793
unix 1 [ ] STREAM 830746
unix 2 [ ] STREAM 830697 /dev/log
unix 2 [ ] STREAM CONNECTED 830696
unix 2 [ ] STREAM 830680 /dev/log
unix 2 [ ] STREAM CONNECTED 830679
$
8.11.3 ping
This command sends an echo request to a host. It is a diagnostic tool for testing whether a host
can be found. When the request reaches the host, it is sent back to the originator.
$ ping flame
PING flame.cit.ac.nz (156.59.20.75): 56 data bytes
64 bytes from 156.59.20.75: icmp_seq=0 ttl=128 time=0.8 ms
64 bytes from 156.59.20.75: icmp_seq=1 ttl=128 time=0.8 ms
64 bytes from 156.59.20.75: icmp_seq=2 ttl=128 time=0.8 ms
--- flame.cit.ac.nz ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 0.8/0.8/0.8 ms
$
8.11.4 route
This command manually manipulates the network routing tables which are used to connect to
other hosts.
Example
8.11.5 nslookup
This command is used to query a domain name server and return information about a designated
host.
$ nslookup
Default Server: araiahi.cit.ac.nzAddress: 156.59.65.10
> flame
Server: araiahi.cit.ac.nz
Address: 156.59.65.10
Name: flame.cit.ac.nz
Address: 156.59.20.75
> exit
$
8.11.6 traceroute
This command is similar to ping, but traces the path (or route) that data travels across the
network to a specific host computer.
$ traceroute www
traceroute to tukutuku.cit.ac.nz (156.59.65.16), 30 hops max, 40 byte packets
1 route64.cit.ac.nz (156.59.64.1) 1.87 ms 1.737 ms 1.727 ms
2 tukutuku.cit.ac.nz (156.59.65.16) 2.815 ms 2.862 ms 3.101 ms
$
Objective
The objectives of this module is to
A system administrator has unrestricted access, thus can delete any file (including system files
that are part of UNIX), and execute any program.
For the most part, a system administrator can automate some activities to reduce the amount of
work they are required to do, but other tasks, such as resetting user passwords and unlocking
terminals or user accounts require the administrator to log on to the computer system using the
administrator account (root).
$ su
Password ######
#_
When you are logged in as a system administrator, the system prompt changes to #.
The other way you can log on as a system administrator is to use the special administrator
account, named root.
Login: root
Password ######
#_
/etc/ftpusers
/etc/printcap
/etc/resolv.conf
3.1 /etc/passwd
This plain text file holds information about users, such as their logon name and home directory.
Each user has a separate line of information (a record) in the /etc/passwd file. Each field of the
user record is separated by colons. The following table illustrates the purpose of each field of a
user record.
logon_name:encrypted_password:userid:groupid:user_name:home_directory:shell
brownbr:jwrt#4de:1154:101:Brian Brown:/user/brownbr:/bin/sh
Each user must have a unique ID and belong to a group that is defined in the /etc/group file.
3.2 adduser
Most UNIX systems provide a tool to allow creation of user accounts. The program adduser is
one such example.
When a system administrator runs adduser, they specify a number of options on the command
line. In the following example, adduser will create a new user called bloggsjo and make them a
member of the bc group (this group has already been defined in the /etc/group file).
What file does adduser reference to obtain default configuration details when creating a user
account?
_______________________________________________
When a user is created using adduser, a number of default settings are used. These have been
specified in the configuration file identified above.
What is the default group that adduser places a new user into (hint: look at the contents of the
configuration file)?
_______________________________________________
What is the path of the home directory that adduser creates for a newuser (hint: look at the
contents of the configuration file)?
_______________________________________________
When a user is created using adduser, a new entry is made in the /etc/passwd file for that user.
In addition, a home directory is created for the user and confiuration files copied into their new
home directory. Directory permissions are also applied so the user can access their home
directory and other files.
What is the location (directory) that adduser references to copy the configuration files (such
as .profile) to the users new home directory (hint: man adduser)?
_______________________________________________
The purpose of having master configuration files is so that the system administrator can
configure these (using vi editor) appropriately and not have to worry about copying them to each
new users home directory, or whether they are configured correctly.
Of course, the simpler way is to use adduser to create the user account (see also useradd).
After applying the correct security permissions to the users home directory, the default
configuration files such as .profile are copied into the users home directory. This ensures that
when they log on to UNIX, their shell is configured correctly.
System administrators are often required to change a users password, due to users forgetting their
password. An alternative method is to edit the /etc/passwd file and remove the characters for the
password field. This allows the user to logon with an empty password, and once logged on, they
can themselves run the passwd command and assign themselves a password.
3.6 Deleting a user account
To retire a user account involves removing their account record from /etc/passwd and deleting
their home directory (see also userdel).
To make a new group requires adding a record to the /etc/group file, assigning the group a
unique ID.
What command would a system administrator type to create a new group account called dipbc
(hint: man adduser)
_______________________________________________
The system administrator can use the passwd command to lock a user account.
What command would a system administrator type to disable the user account bloggsjo (hint:
man passwd)
_______________________________________________
What command would a system administrator type to enable the user account bloggsjo (hint:
man passwd)
_______________________________________________
The usermod command lets a system administrator change the group that a user belongs to.
3.12 Summary
Handling users can be a large part of a system administrators job on UNIX.
A user cannot remember their password. Name two ways in which a system administrator can
change the users password?
_______________________________________________
What actions are required in order for a system administrator to delete a user account?
_______________________________________________
_______________________________________________
_______________________________________________
An exisiting user (who is a member of the group sales) is assigned to a new group called dev.
The user has a number of existing files that they created earlier, yet other members in the group
dev cannot access them. What command should be used to correct this problem?
_______________________________________________
4.0 Mounting and Un-mounting file systems
System administrators are often required to mount and unmount file systems. Sometimes a hard
disk may need to be added to the system. On another ocassion, a CD-ROM may need to be
mounted so it can be used by a particular application (such as a WWW server).
When UNIX boots, it mounts the hard disk as the root file system, and if specified, additional
partitions as other file systems, such as /users and also a swap file system.
Each partition and disk unit (such as hard drive, floppy disk and CD-ROM) appears as a device
(either block or character) in the /dev subdirectory. The following table shows some of the
devices listed in the /dev subdirectory (obtained using ls -la /dev).
In the above table, /dev/hda is the entire hard disk, with /dev/hda1 the first partition (where the
root file system is located on this system) and /dev/hda5 the second partition (where user
directories have been located on this system).
Type the command mount to view the current mounted filesystems. Complete the following
table listing the mounted devices and mount points (directories).
/dev/hda1 /type
If a particular device requires to be mounted all the time, the details are placed in /etc/fstab. To
list the mounted devices on the system, type mount or view the /etc/mtab file.
One method would be to copy the CD-ROM files into a directory under /www, such as
/www/train. This would involve creating the /www/train subdirectory (mkdir /www/train), then
mounting the CD-ROM (mount /dev/hdc /cdrom) and then copying all the files into
/www/train.
The alternative is to mount the CD-ROM as the /www/train subdirectory (mount /dev/hdc
/www/train). The system administrator first creates the empty directory /www/train and then
mounts the CD-ROM. This avoids the necessity to copy the files.
A system administrator must therefore be familiar with backup programs, and implement a
backup strategy that ensures system and user files are regularly backed up. Typically, the backup
of these files would be automated at run at regular intervals with little or no intervention from the
system administrator. They would typically be run late at night or early morning when few
people are using the computer (running it during the day may slow the system down and affect
performance to users). However, one daily task would be to check the log files to ensure there
was no problem encountered backing up files.
5.1 cpio
A typical program is cpio which provides the ability to read and write files to or from a cpio
archive file.
cpio has three operating modes. Use the man command to fill in the following table,
describing each of the three operating modes for cpio.
copy-out mode
copy-in mode
copy-pass mode
Some of the available options for cpio are
$ cd $HOME
$ mkdir test
$ cd test
$ man cpio > text1
$ man tar > text2
$ cd $HOME
$
You now have two files in the test subdirectory that will be used in this exercise.
$ cpio -o -Otestcpio
cpio is now waiting for a list of filenames to archive. Type the following
test/text1
test/text2
ctrl-d (Note: this means press ctrl-d key combination)
_______________________________________________
_______________________________________________
You now have an archive file testcpio that contains the two files /test/text1 and test/text2. This
can be verified using the ls command.
$ cd $HOME
$ cd test
$ rm text1
$ rm text2
$ cd $HOME
$ rmdir test
$
The original files have now been erased. The test subdirectory has also been deleted. This can be
verified using the ls command.
Type the following commands to restore the files to their original location.
$ cd $HOME
$ cpio -i -Itestcpio
$
_______________________________________________
_______________________________________________
Do a listing of the files and directories to determine whether the files were restored. Why
do you think cpio printed these messages?
_______________________________________________
_______________________________________________
Type the following commands to restore the files to their original location.
$ cd $HOME
$ cpio -i -Itestcpio -d
$
_______________________________________________
Do a listing of the files in the test subdirectory. Enter the file sizes below.
text1 _______________________________________________
text2 _______________________________________________
Type the following commands to delete the files used in the cpio exercise.
$ cd $HOME
$ cd test
$ rm text1
$ rm text2
$ cd $HOME
$ rmdir test
$ rm testcpio
$
In this cpio exercise, you archived some files, deleted the original files, and later restored those
files from the archive. These are typical system administrator functions. However, a system
administrator would probably use a tape device rather than a file, and would also automate the
archiving of the files so they regularly occurred. In the next section you will learn about tar,
another archiving program.
5.2 tar
Another program used to read and write files associated with an archive is tar. Some of the
available options are
$ cd $HOME
$ mkdir test
$ cd test
$ man cpio > text1
$ man tar > text2
$ cd $HOME
$
You now have two files in the test subdirectory that will be used in this exercise.
_______________________________________________
You now have an archive file test2.tar.gz that contains the two files /test/text1 and test/text2. This
can be verified using the ls command.
_______________________________________________
What conclusions do you draw from files produced by exercises 5.2.1.1 and 5.2.1.2?
_______________________________________________
$ cd $HOME
$ cd test
$ rm text1
$ rm text2
$ cd $HOME
$ rmdir test
$
The original files have now been erased. The test subdirectory has also been deleted. This can be
verified using the ls command.
5.2.1.4 Restore the orginal files from the archive
In this part of the exercise, you will extract the files from the archive and restore them to the
original location. tar will also need to create the subdirectory when the files are restored.
Type the following commands to restore the files to their original location.
$ cd $HOME
$ tar -zxvf test2.tar.gz
$
Do a listing of the files in the test subdirectory. Enter the file sizes below.
text1 _______________________________________________
text2 _______________________________________________
Type the following commands to delete the files used in the tar exercise.
$ cd $HOME
$ cd test
$ rm text1
$ rm text2
$ cd $HOME
$ rmdir test
$ rm test.tar
$ rm test2.tar.gz
$
In this tar exercise, you archived some files, deleted the original files, and later restored those
files from the archive. These are typical system administrator functions.
6.1 cron
This program is started automatically (from the file /etc/init.d/cron) when the system enters
multi-user mode. cron searches for crontab files in /var/spool/cron/crontabs and if found, loads
them into memory ready for execution. Any crontab files are updated or removed using the
crontab command.
cron also reads /etc/crontab and the files in /etc/cron.d. Every minute, cron is activated and
examines all stored crontab files, checking each command to see if it should be run in the current
minute.
If a command is executed, the output is sent to the owner of the crontab file.
6.2 crontab
This command can also be used by users (if permitted) so they can run programs at scheduled
times.
crontab is the command used to install, edit, list and remove crontab files . Each user can have
their own crontab file (list of programs to execute).
Examples of crontab
A user creates a new crontab by using the -e option. Once the editor is quit (by saving the file
and exiting), the new crontab is automatically installed.
An example is
5 * * * * who >> /etc/users.list
The asterisk means all occurrences (in the above example, all hours, all days, all months). The
minutes is set to 5 in the above example. This means at 5 minutes past the hour the command
will be executed (it does not mean every five minutes).
$ tty
The system will respond with a /dev/ttyp number. Record this in the space below.
_______________________________________________
$ cd $HOME
$ crontab -e
After a brief message that a crontab file does not exist, the sytem will load the editor and create a
new file.
6.4.3 Enter the following line so that the command executes every minute. Change the
/dev/ttyp number to match that you recorded above in step 6.4.1
6.4.4 Press the ESC key. Save the file by typing the following command.
:wq
6.4.5 You should now be at the UNIX shell prompt. To verify that you have a crontab file, type
the following command.
$ crontab -l
6.4.6 What was the message printed when you typed the above command?
_______________________________________________
6.4.7 Wait at least two minutes. The crontab should be executed twice during this time.
6.4.8 What was printed on the screen during this time? Enter the messages printed in the
space below.
_______________________________________________
_______________________________________________
_______________________________________________
$ crontab -r
$ crontab -l
6.4.11 What was the message printed when you typed the above command?
_______________________________________________
7.1 who
The who command prints the following information for each user currently logged on,
Example
$ who
fitiseto ttyp1 Mar 9 13:25 (dhcp-78-168.cit.ac.nz)
oreganma ttyp2 Mar 9 13:31 (dhcp-78-25.cit.ac.nz)
ulaleiu ttyp3 Mar 9 12:09 (dhcp-79-75.cit.ac.nz)
brownbr ttyp6 Mar 9 13:32 (flame.cit.ac.nz)
$
7.1.1 What is the command option you would use to display only the login names and the
number of users logged on (work out the correct command and test it to verify that it
works)?
_______________________________________________
7.2 w
The w command displays the users that are logged on and what they are doing. The following
entries are displayed for each user:
login name, the tty name, the remote host, login time, idle time, JCPU, PCPU,
and the command line of their current process.
Example
$ w
1:37pm up 28 days, 4:24, 10 users, load average: 0.10, 0.09, 0.03
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
oreganma ttyp0 dhcp-78-25.cit.a 1:09pm 7:02 4.09s 2.44s vi newfile
fitiseto ttyp1 dhcp-78-168.cit. 1:25pm 6.00s 3.11s 1.16s vi newfile
brownbr ttyp6 flame.cit.ac.nz 1:32pm 2.00s 3.49s 1.48s w
$
7.2.1 Use the man command for w to complete the following table
Abbreviation Meaning
JCPU
PCPU
$ wall
Hello there. This is the system administrator.
Please logout. The system is being shutdown in 5 minutes.
ctrl-d
$
7.4 /etc/motd
The message of the day is held in the /etc/motd file. The contents of /etc/motd are displayed after
a successful login. A system administrator can place any message in this file and can thus advise
users of upcoming events etc when they log on. This is easier than using email and uses less disk
space.
8.1 fdisk
This command lets a system administrator view or edit table partition of a hard disk drive. Disk
drives are normally divided into one or more logical disks called partitions.
A partition is a device name followed by a partition number. The partition is a device name
followed by a partition number. For example, /dev/hda1 is the first partition on the first IDE hard
disk in the system.
All unix systems require a separate partition that is used as a swap area (this is used to implement
virtual memory and the operating system swaps processes out of main memory to this swap
area). The size of the swap partition depends upon a number of factors, such as available
memory, amount of disk space available and the number of users.
The LINIX computer used for these exercises has been configured with a 200MB swap partition
size (the system uses a 4GB disk and supports approximately 40 simultaneous users with 64MB
RAM).
_______________________________________________
8.2 fsck
fsck is used to check (or repair) a filesystem. As files are created, renamed, moved, deleted or
aborted, corruption of the filesystem can take place. There may be an entry for a file that really
doesn’t exist (the space for the file is marked as free).
System administrators regularly use fsck to check the filesystems to ensure that there are no file
problems.
fsck cannot be run on a filesystem that is mounted. When a UNIX system is shutdown correctly,
the filesystem is marked with a special flag. On bootup, the state of this flag is checked. If the
system was simply turned off or crashed, the startup sequence thus detects that the system was
not shutdown correctly, so automatically runs fsck at startup before the filesystems are mounted.
8.3 mkfs
When a new disk is added to a UNIX system, it is partitioned using fdisk. Once the desired
partitions are created, a filesystem must be created on the partitions so that files can be stored.
mkfs is the command used to create UNIX filesystems. The following example creates a new
UNIX filesystem on the first partition of the hard drive.
$ mkfs /dev/hda1
8.4 df and du
Another task a system administrator performs is to maintain the file system, by using df to report
the number of free blocks, and du to report the number of blocks used in a directory. In a typical
system, at least 15% free space is requarded as a minimum.
8.5 shutdown
When it becomes necessary to shutdown the computer system, the system administrator should
use the correct command to ensure that the system is shutdown in the correct sequence. The
following command
$ shutdown -g0
What would be the command to shutdown the computer in 10 minutes and display the
message "Please logoff now" to all users, automatically reboot after shutdown and force
the system to run fsck on reboot?
_______________________________________________
8.6 init
This command, used only by the system itself and system administrators, changes the runlevel of
the system. The runlevel is a mode of operation, such as single user or multiuser mode.
$ init 1
$ init
_______________________________________________
8.7 runlevel
runlevel displays the current and previous system runlevel (by reading the file /var/run/utmp)
separated by a single space. If there was no previous system runlevel, the letter N is printed.
$ runlevel
_______________________________________________
This now compeletes these exercises in system administrator commands. This exercise is an
introduction and thus does not cover all aspects of system administration. It is designed to get
you started.
EXT2 - Extended 2
VFAT - FAT 16 / 32
NTFS
Ans.
BIOS Initialization
Kernel Initialization
init process starts and enters desired run level by executing
/etc/rc.d/rc.sysinit
/etc/rc.d/rc
/etc/rc.d/rc.local
Ans.
Ans.
Run level specific script directories
Ans.
This script is run each time the system enters a run level.
Ans.
Ans.
3 Multi user mode with NFS support (GUI not
supported)
4 > User definable, but duplicate of run level 3 by default
8. Describe the various tools used to control the system services?
Ans.
ntsysv
redhat-config-services
chkconfig
service
9. What are the various commands used for system shutdown/reboot?
Ans.
poweroff
init 0
reboot
init 6
Ans. /boot/grub/grub.conf
Ans.
14. Which is the first process started in Linux and What is its process ID?
Ans.
Ans. lsmod > lists the modules currently reside in the kernel
Ans.
modprob is used to load the kernel modules with three improvements over
insmod:
It can try a list of modules, and when it loads a module successfully, it will
cease trying others in the list.
5. Which thread is responsible for executing the modprob as needed?
Ans.
Ans.
/var/log/dmesg
/etc/sysconf/hwconf
/usr/share/hwdata/
hwbrowser
Ans.
/proc/bus/pci/
/sbin/lspci
/proc/isapnp/
Ans.
/etc/hotplug
/sbin/hotplug
/proc/bus/
Ans. /sbin/lsusb
/sbin/usbmodules
/dev/usb
Ans.
/sbin/cardmgr
/etc/pcmcia/
/proc/bus/pccard
/sbin/cardctl
6. What are the various tools used for system monitoring?
Ans.
7. What are the various tools used for process control?
Ans.
Ans.
Ans.
Ans.
Separate partitions improve performance by keeping data together which
reduces the disk head seek.
Ans.
fdisk
sfdisk
Ans.
Ans.
Ans.
Ans.
Ans.
Writeback > Journal updates are not atomic, but this gives
Ans.
If the kernel needs to have access to the ext3 module at boot time, create a
new initial ramdisk as:
# mkinitrd /boot/initrd-.img
Ans.
Ans.
13. Which filesystem is referred by mount when displaying mounted & available
filesystems?
Ans.
Ans.
Ans.
Ans.
Ans.
Ans. Use the fdisk -l command to view all the mounted and unmounted
Ans.
Use the df -k command, which shows only mounted filesystems but has the big
advantage of giving you the mount points too.
Ans.
With the help of e2label command a filesystem label can be written into the
superblock of ext2/ext3 filesystem.
Ans.
Ans.
This file is referenced each time the system boots to create the desired
filesystem hierarchy.
Ans.
filesystem
fs_type > The filesystem type
Filesystem Management 2
26. What is swap space?
Ans. Swap space is supplement to system RAM.
30. When the system runs the fsck and which script invokes it?
Ans. When the system boots, the rc.sysinit script runs the fsck on any filesystems
marked for checking in /etc/fstab file. If any of these filesystems are markes as
dirty or have data in the journal, fsck will attempt to repair them. If it succeeds,
the filesystems will be mounted and boot process continues, else rc.sysinit will
run sulogin and will report that fsck needs to be run manually.