Sie sind auf Seite 1von 9

1.What is a shell?

A Unix shell is the program which reads user input from the command line and exe
cutes actions based upon that input.
2.Define session?

A session is a collection of one or more process groups. A process establishes a
new session by calling setsid function. This function returns process group id
if OK.
3.What do you mean by signal?

Signals are software interrupts. Signals provide a way of handling asynchronous
events: a user at a terminal typing the interrupt key to stop a program or the n
ext program in the pipeline terminating prematurely.
4.What is unix?

UNIX is the most popular operating system on multi-user systems. This operating
system originated as a single-user system. It started off on a cast-off DEC PDP-
7 at Bell laboratories in 1969. Ken Thompson, with ideas and help from Dennis Ri
tchie, and others, wrote a small, general-purpose operating system.
5.Define message queue?

message queue Message queue is a linked list of messages. It is used to make a c
ommunication between the related or unrelated processes.
6.Define directory and filename?

A directory is a file that contains directory entries. The directory entry conta
ining a file name along with structure of information describing the attributes
of the file. The names in a directory are called filename. The only two characte
rs that cannot appear in a file name are / and null character.
7.Define program and process?

A program is a executable file residing in a disk file. An executing instance of
a program is called a process. Every UNIX process have a unique numeric identif
ier called the process ID. The process ID is always a non negative integer.
8.List down the different file types?

Regular file
Directory file
Character special file
Block special file
FIFO
Symbolic link
Socket
9.What are the options available to determine the group ID of the new file?

The group ID of the new file can be the effective group ID of the process
The group ID of the new file can be the group ID of the directory in which the f
ile is being created.
10.Define sticky bit?

The bit S_ISVTX is known as sticky bit. If this bit is set for an executable pro
gram file, then the first time the program was executed a copy of the programmers
text was saved in the swap area when the process terminated. The advantage of u
sing this is the program is loaded into memory faster the next time.
11.What is called a page fault?

Page fault is referred to the situation when the process addresses a page in the
working set of the process but the process fails to locate the page in the work
ing set. And on a page fault the kernel updates the working set by reading the p
age from the secondary device.
12.What do you mean by u-area (user area)?

This contains the private data that is manipulated only by the Kernel. This is l
ocal to the Process, i.e. each process is allocated a u-area.
13.What are the different types of buffering is supported by UNIX?

Fuly buffered
Line buffered
Un buffered
14.What is the purpose of exec functions?

When a process calls one of the exec functions that process is completely replac
ed by the new program. The new program stats execution from main function. The p
rocessed does not change across an exec because a new process is not created.But
this function replaces the current process with new program from disk.
15.Define process group?

A process group is a collection of one or more processes. Each process group has
a unique process ID. A function getpgrp returns the process group id of the cal
ling process.
16.What difference between cmp and diff commands?

cmp - Compares two files byte by byte and displays the first mismatch.
diff - tells the changes to be made to make the files identical.
17.How many prompts are available in a UNIX system?

Two prompts, PS1 (Primary Prompt), PS2 (Secondary Prompt).
18.What are shell variables?

Shell variables are special variables, a name-value pair created and maintained
by the shell.
19.What is Block Started by Symbol?

A data representation at the machine level, that has initial values when a progr
am starts and tells about how much space the kernel allocates for the un-initial
ized data. Kernel initializes it to zero at run-time.
20.What is the command to find out todays date?

date
21.what are the different commands used to create files?

touch - to create empty files.(e.g) - touch filename
vi filename
cat>filename
.
22.What is chmod, chown and chgrp?

Chmod : It is used for to change permissions on files.
Chown : It is used for to change ownership of a file.
Chgrp : It is used for to change group of the file.
23.What are PIDs?

They are process IDs given to processes. A PID can vary from 0 to 65535.
24.What does the top command display?

Top command displays the current ammount of memory occupied by the currently exe
cuting processes and the details. In addition to memory usage top command displa
ys cpu usage and process details.
25.What is the command to send message to all users who are logged in?

Wall
26.What is Kernel?

Kernel is core part of unix o/s. It is a group of hundreds of system calls.
27.What are the different security features in Unix?

Password protection
File permissions
Encryption.
28.What does the swapping system do if it identifies the illegal page for swappi
ng?

If the disk block descriptor does not contain any record of the faulted page, th
en this causes the attempted memory reference is invalid and the kernel sends a S
egmentation violation signal to the offending process. This happens when the swap
ping system identifies any invalid memory reference.
29.How do you find out the current directory youre in?

pwd
30.What is a pipe?

A pipe is two or more commands separated by pipe char |. That tells the shell to a
rrange for the output of the preceding command to be passed as input to the foll
owing command.
31.How to close the current user account?

exit
32.What is the use of grep command?

grep is a pattern search command. It searches for the pattern, specified in the
command line with appropriate option, in a file(s).
33.which command is used to identify the type of the file?

file grep means Globally search a regular expression and print it.
34.What are the features and benefits of unix?

Portability
Machine Independent
Multi-user operations
Hierarchical file system
Unix shell
Pipes and filters
Utilities
Background Processing
Software Development Tools
Maturity
35.What is the use of break and continue statements?

The continue statement suspends execution of all statements following it, and sw
itches control to the top of the loop for the next iteration. The break statemen
t, on the other hand, causes control to break out of the loop.
36.What is single users system?

The personal computer (PC) is a small, general-purpose system that can execute p
rograms to perform a wide variety of tasks. The PC, however, was designed for us
e by one person at a time; that is, it is Single-User oriented with MS-DOS as th
e de facto standard operating system for this range of machines. Single user sys
tems became very popular due to the low cost hardware and wide range of software
available for these machines.
37. What are the key features of the Korn Shell?
- history mechanism with built-in editor that simulates emacs or vi
- built-in integer arithmetic
- string manipulation capabilities
- command aliasing
- arrays
- job control
38. What are some common shells and what are their indicators?
sh Bourne shell
csh C SHell
bash Bourne Again Shell
tcsh enhanced C Shell
zsh Z SHell
ksh Korn SHell
39. What is shell scripting in UNIX?
Shell scripting is used to program command line of an operating system. Shell Sc
ripting is also used to program the shell which is the base for any operating sy
stem. Shell scripts often refer to programming UNIX. Shell scripting is mostly u
sed to program operating systems of windows, UNIX, Apple etc. Also this script
is used by companies to develop their own operating system with their own featur
es.
40. What is a typical syntax being followed when issuing commands in shell?
Typical command syntax under the UNIX shell follows the format:
Command [-argument] [-argument] [--argument] [file]
41. What is command substitution?
Command substitution is one of the steps being performed every time commands are
processed by the shell. Commands that are enclosed in backquotes are executed b
y the shell. This will then replace the standard output of the command and displ
ayed on the command line.
42. What is a directory?
Every file is assigned to a directory. A directory is a specialized form of file
that maintains a list of all files in it.
43. What is history command in UNIX?
We use history command along with grep command in unix to find any relevant comm
and you have already executed.
44. How do you copy file from one host to other?
By using "scp" command. You can also use rsync command to answer this UNIX inter
view question or even sftp would be ok.
45. How do you find which process is taking how much CPU?
By using "top" command in UNIX.
46. How do you check how much space left in current drive?
By using "df" command in UNIX. For example "df -h ." will list how full your cur
rent drive is.
47. How do you know if a remote host is alive or not?
You can check these by using either ping or telnet command in UNIX.
48. How will you run a process in background? How will you bring that into foreg
round and how will you kill that process?
For running a process in background use "&" in command line. For bringing it bac
k in foreground use command "fg jobid" and for getting job id you use command "j
obs", for killing that process find PID and use kill -9 PID command.
49. How will you find which operating system your system is running on in UNIX?
By using command "uname -a" in UNIX
50. What is the command to list all the links from a directory?
You can answer command like: ls -lrt | grep "^l"
51. How will you create a read-only file in your home directory?
You need to create a file and change its parameter to read-only by using chmod c
ommand you can also change your umask to create read only file.
touch file
chmod 400 file
52. What is the difference between Swapping and Paging?
Swapping:Whole process is moved from the swap device to the main memory for exec
ution. Process size must be less than or equal to the available main memory. It
is easier to implementation and overhead to the system. Swapping systems does no
t handle the memory more flexibly as compared to the paging systems.
Paging:Only the required memory pages are moved to main memory from the swap dev
ice for execution. Process size does not matter. Gives the concept of the virtua
l memory. It provides greater flexibility in mapping the virtual address space i
nto the physical memory of the machine. Allows more number of processes to fit i
n the main memory simultaneously. Allows the greater process size than the avail
able physical memory. Demand paging systems handle the memory more flexibly.
53. What are filters?
The term Filter is often used to refer to any program that can take input from s
tandard input, perform some operation on that input, and write the results to st
andard output. A Filter is also any program that can be used between two other p
rograms in a pipeline.
54. Differentiate multiuser from multitask.
Multiuser means that more than one person can use the computer at the same time.
Multitask means that even a single user can have the computer work on more than
one task or program at the same time.
55. What is inode?
An inode is an entry created on a section of the disk set aside for a file syste
m. The inode contains nearly all there is to know about a file, which includes t
he location on the disk where the file starts, the size of the file, when the fi
le was last used, when the file was last changed, what the various read, write a
nd execute permissions are, who owns the file, and other information.
56. What is the significance of the tee command?
It reads the standard input and sends it to the standard output while redirectin
g a copy of what it has read to the file specified by the user.
57. What does the command $who | sort logfile > newfile do?
The input from a pipe can be combined with the input from a file . The trick is
to use the special symbol - (a hyphen) for those commands that recognize the hyphe
n as std input. In the above command the output from who becomes the std input t
o sort , meanwhile sort opens the file logfile, the contents of this file is sor
ted together with the output of who (rep by the hyphen) and the sorted output is
redirected to the file newfile.
58. What does the command $ls | wc l > file1 do?
ls becomes the input to wc which counts the number of lines it receives as input
and instead of displaying this count , the value is stored in file1.
59. Which of the following commands is not a filter man , (b) cat , (c) pg , (d)
head
Ans: man
A filter is a program which can receive a flow of data from std input, process (
or filter) it and send the result to the std output.
60. Explain the steps that a shell follows while processing a command.
After the command line is terminated by the key, the shell goes ahead with proce
ssing the command line in one or more passes. The sequence is well defined and a
ssumes the following order.
Parsing: The shell first breaks up the command line into words, using spaces and
the delimiters, unless quoted. All consecutive occurrences of a space or tab ar
e replaced here with a single space.
Variable evaluation: All words preceded by a $ are avaluated as variables, unles
s quoted or escaped.
Command substitution: Any command surrounded by backquotes is executed by the sh
ell which then replaces the standard output of the command into the command line
.
Wild-card interpretation: The shell finally scans the command line for wild-card
s (the characters *, ?, [, ]). Any word containing a wild-card is replaced by a
sorted list of filenames that match the pattern. The list of these filenames the
n forms the arguments to the command.
PATH evaluation: It finally looks for the PATH variable to determine the sequenc
e of directories it has to search in order to hunt for the command.
61. What difference between cmp and diff commands?
cmp - Compares two files byte by byte and displays the first mismatch
diff - tells the changes to be made to make the files identical
62. What is the use of grep command?
grep is a pattern search command. It searches for the pattern, specified in the co
mmand line with appropriate option, in a file(s).
Syntax : grep
Example : grep 99mx mcafile
63. What is the difference between cat and more command?
Cat displays file contents. If the file is large the contents scroll off the scr
een before we view it. So command 'more' is like a pager which displays the cont
ents page by page.
64. Write a command to kill the last background job?
Kill $!
65. Which command is used to delete all files in the current directory and all i
ts sub-directories?
rm -r *
66. Write a command to display a files contents in various formats?
$od -cbd file_name
c - character, b - binary (octal), d-decimal, od=Octal Dump.
67. What will the following command do?
$ echo *
It is similar to 'ls' command and displays all the files in the current director
y.
68. Is it possible to create new a file system in UNIX?
Yes, mkfs is used to create a new file system.
69. Is it possible to restrict incoming message?
Yes, using the mesg command.
70. What is the use of the command "ls -x chapter[1-5]"
ls stands for list; so it displays the list of the files that starts with 'chapt
er' with suffix '1' to '5', chapter1, chapter2, and so on.
71. Is du a command? If so, what is its use?
Yes, it stands for disk usage. With the help of this command you can find the disk
capacity and free space of the disk.
72. Is it possible to count number char, line in a file; if so, How?
Yes, wc-stands for word count.
wc -c for counting number of characters in a file.
wc -l for counting lines in a file.
73. Name the data structure used to maintain file identification?
inode, each file has a separate inode and a unique inode number.
74. How many prompts are available in a UNIX system?
Two prompts, PS1 (Primary Prompt), PS2 (Secondary Prompt).
75. How does the kernel differentiate device files and ordinary files?
Kernel checks 'type' field in the file's inode structure.
76. How to switch to a super user status to gain privileges?
Use su command. The system asks for password and when valid entry is made the user
gains super user (admin) privileges.
77. What are shell variables?
Shell variables are special variables, a name-value pair created and maintained
by the shell.
Example: PATH, HOME, MAIL and TERM
78. What is redirection?
Directing the flow of data to the file or from the file for input or output.
Example : ls > wc
79. How to terminate a process which is running and the specialty on command kil
l 0?
With the help of kill command we can terminate the process.
Syntax: kill pid
Kill 0 - kills all processes in your system except the login shell.
80. What is a pipe and give an example?
A pipe is two or more commands separated by pipe char '|'. That tells the shell
to arrange for the output of the preceding command to be passed as input to the
following command.
Example : ls -l | pr
The output for a command ls is the standard input of pr.
When a sequence of commands are combined using pipe, then it is called pipeline.
81. Explain kill() and its possible return values.
There are four possible results from this call:
kill() returns 0. This implies that a process exists with the given PID, and the s
ystem would allow you to send signals to it. It is system-dependent whether the
process could be a zombie.
kill() returns -1, errno == ESRCH either no process exists with the given PID, or se
curity enhancements are causing the system to deny its existence. (On some syste
ms, the process could be a zombie.)
kill() returns -1, errno == EPERM the system would not allow you to kill the specifi
ed process. This means that either the process exists (again, it could be a zomb
ie) or draconian security enhancements are present
(e.g. your process is not allowed to send signals to *anybody*).
kill() returns -1, with some other value of errno you are in trouble! The most-used
technique is to assume that success or failure with EPERM implies that the process
exists, and any other error implies that it
doesn't.
An alternative exists, if you are writing specifically for a system (or all thos
e systems) that provide a /proc filesystem: checking for the existence of /proc/PID
may work.
82. What is relative path and absolute path.
Absolute path : Exact path from root directory.
Relative path : Relative to the current path.

Das könnte Ihnen auch gefallen