SED (which stands for Stream EDitor) is a simple but powerful computer program used to apply various pre-specified textual transformations to a sequential stream of text data.
It reads input files line by line, edits each line according to rules specified in its simple language (the sed script), and then outputs the line.
AWK is a complete pattern scanning and processing language, it is most commonly used as a Unix command-line filter to reformat the output of other commands.
For example, to print only the second and sixth fields of the date command (the month and year) with a space separating them, at the Unix prompt, you would enter:
date | awk ‘{print $2 ” ” $6}’
Access rights (read/write/execute) on a directory means:
->read indicates that it is possible to list files in the directory.
->write indicates that it is possible to delete or move files in the directory.
->execute indicates that it is possible to read files in the directory provided we must have read permission on individual files of that directory.
QNO:8 How do u determine disk usage?
The disk usage can be determined by using the command,du.THis command outputs the number of kilobytes used by each sub-directory.
11. What is the difference between binaries in /bin, and /usr/bin?
/bin - would contains the binaries frequently used by the normal user (as well as system administrator)
/usr/bin - would contains the binaries rarely used by the normal user (as wel as system administrator)
12. What is a dynamically linked file?
soft link (created with ln -s). Source and destination files will have the different inode. If dest removed source will be available. If source removed dest also will available but no where to go.
13. What is a statically linked file?
hard link (created with ln). Source and dest will have the same inode. Making two different copies causes more disk space due to redundancy.
11. What is the difference between binaries in /bin, and /usr/bin?
Under Solaris, there is no difference. /bin is a symbolic link pointing to /usr/bin. Under Linux (RHAS3) /bin is seemingly for standard unix programs like vi, cp, mv, rm which you’d need in a single user environment where as /usr/bin contains programs you’d want for a multiuser environment. Keep in mind that sometimes /usr is a different disk partition and when you start up in single user mode you only have / mounted.
The /sbin directories are *supposed to* contain statically linked programs. This mas morphed into the idea of bin for user programs, sbin for admin programs.
12. What is a dynamically linked file?
This is confusing because of the use of the word ‘file’. A dynamically linked program is one that, when executed, loads shared libraries from /lib or /usr/lib in order to execute. The idea is that most programs use many of the same functions, so include a copy of a common function in *every* program on the file system. Instead, the function is placed in a shared library and when the program starts executing, the library is loaded which provides the program access to the function.
13. What is a statically linked file?
As above, confusing due to the use of the word ‘file’. A statically linked program is one that contains all the information (libraries) it needs to run. It does not need to load additional libaries in order to execute.
Mutex:
Short for mutual exclusion object. In computer programming, a mutex is a program object that allows multiple program threads to share the same resource, such as file access, but not simultaneously. When a program is started, a mutex is created with a unique name. After this stage, any thread that needs the resource must lock the mutex from other threads while it is using the resource. The mutex is set to unlock when the data is no longer needed or the routine is finished.
INode:
a unique number associated with each filename. This number is used to look up an entry in the inode table which gives information on the type, size, and location of the file and the userid of the owner of the file.
Access rights (read/write/execute) on a directory means:
execute permission allows a user to enter the directory and perform read/write/execute files according to the permissions of the file. But you cannot ‘ls’ the directory until you have a read permission.
It means you should know the filename.
eg:
[amar@darkstar ~]$ ls -l | grep Book
d–x—— 6 amar amar 4096 Sep 5 11:27 BookScripting # directory only has
execute permission
[amar@darkstar ~]$ ls -l BookScripting/ # no read permission
ls: BookScripting/: Permission denied # so ‘ls -l’ denied
20 Comments on General UNIX interview questions
QNo:10. What is SED?
SED (which stands for Stream EDitor) is a simple but powerful computer program used to apply various pre-specified textual transformations to a sequential stream of text data.
It reads input files line by line, edits each line according to rules specified in its simple language (the sed script), and then outputs the line.
AWK is a complete pattern scanning and processing language, it is most commonly used as a Unix command-line filter to reformat the output of other commands.
For example, to print only the second and sixth fields of the date command (the month and year) with a space separating them, at the Unix prompt, you would enter:
date | awk ‘{print $2 ” ” $6}’
Access rights (read/write/execute) on a directory means:
->read indicates that it is possible to list files in the directory.
->write indicates that it is possible to delete or move files in the directory.
->execute indicates that it is possible to read files in the directory provided we must have read permission on individual files of that directory.
QNO:8 How do u determine disk usage?
The disk usage can be determined by using the command,du.THis command outputs the number of kilobytes used by each sub-directory.
QNO 2:
Browse the following URL to get information about ‘route’ command
http://linux.about.com/od/commands/l/blcmdl8_route.htm
Q NO:4) To know about iostat command,browse the following url:
http://www.scit.wlv.ac.uk/cgi-bin/mansec?1M+iostat
Q.no:5) TO know about vmstat command,browse the following url:
http://www.scit.wlv.ac.uk/cgi-bin/mansec?1M+vmstat
Q.no:6) TO know about netstat command,browse the following url:
http://userpages.umbc.edu/~jack/ifsm498/netstat.html
comment 3 on directory execute permissions is incorrect;
Execute permission on a directory means you can list the files in that directory.
11. What is the difference between binaries in /bin, and /usr/bin?
/bin - would contains the binaries frequently used by the normal user (as well as system administrator)
/usr/bin - would contains the binaries rarely used by the normal user (as wel as system administrator)
12. What is a dynamically linked file?
soft link (created with ln -s). Source and destination files will have the different inode. If dest removed source will be available. If source removed dest also will available but no where to go.
13. What is a statically linked file?
hard link (created with ln). Source and dest will have the same inode. Making two different copies causes more disk space due to redundancy.
Comment #10 is in error with all answers
11. What is the difference between binaries in /bin, and /usr/bin?
Under Solaris, there is no difference. /bin is a symbolic link pointing to /usr/bin. Under Linux (RHAS3) /bin is seemingly for standard unix programs like vi, cp, mv, rm which you’d need in a single user environment where as /usr/bin contains programs you’d want for a multiuser environment. Keep in mind that sometimes /usr is a different disk partition and when you start up in single user mode you only have / mounted.
The /sbin directories are *supposed to* contain statically linked programs. This mas morphed into the idea of bin for user programs, sbin for admin programs.
12. What is a dynamically linked file?
This is confusing because of the use of the word ‘file’. A dynamically linked program is one that, when executed, loads shared libraries from /lib or /usr/lib in order to execute. The idea is that most programs use many of the same functions, so include a copy of a common function in *every* program on the file system. Instead, the function is placed in a shared library and when the program starts executing, the library is loaded which provides the program access to the function.
13. What is a statically linked file?
As above, confusing due to the use of the word ‘file’. A statically linked program is one that contains all the information (libraries) it needs to run. It does not need to load additional libaries in order to execute.
What is MUTEX? I need answer for this question
What is INODE?I need answer for this question
Ans 7: kill -TERM 1
for comment no: 12
Mutex:
Short for mutual exclusion object. In computer programming, a mutex is a program object that allows multiple program threads to share the same resource, such as file access, but not simultaneously. When a program is started, a mutex is created with a unique name. After this stage, any thread that needs the resource must lock the mutex from other threads while it is using the resource. The mutex is set to unlock when the data is no longer needed or the routine is finished.
INode:
a unique number associated with each filename. This number is used to look up an entry in the inode table which gives information on the type, size, and location of the file and the userid of the owner of the file.
Regards,
Virat
Access rights (read/write/execute) on a directory means:
execute permission allows a user to enter the directory and perform read/write/execute files according to the permissions of the file. But you cannot ‘ls’ the directory until you have a read permission.
It means you should know the filename.
eg:
[amar@darkstar ~]$ ls -l | grep Book
d–x—— 6 amar amar 4096 Sep 5 11:27 BookScripting # directory only has
execute permission
[amar@darkstar ~]$ ls -l BookScripting/ # no read permission
ls: BookScripting/: Permission denied # so ‘ls -l’ denied
[amar@darkstar ~]$ ls -l BookScripting/test.sh
-r-x—— 1 amar amar 37 Sep 5 11:27 BookScripting/test.sh
[amar@darkstar ~]$ BookScripting/test.sh
you can execute
[amar@darkstar ~]$
quota -v
Shows current disk usage and limits
Typical usage of route:
/sbin/route -n:
DISPLAY KERNEL ROUTING TABLES.
whats the diff between mutex and semaphores ?
where INODE will be stored?
Inode is stored in File Management system ie in the Secondary Memory where os is stored