Unix Interview2
Unix Interview2
- grep .Debug. *.confHere grep uses the string .Debug. to search in all files with extension..conf. under current directory.
5. Display the last newly appending lines of a file during appendingdata to the same file by some processes ?
- tail .f Debug.logHere tail shows the newly appended data into Debug.log by some processes/user.
6. Display the Disk Usage of file sizes under each directory in current Directory ?
8. Display the all files recursively with path under current directory ?
- export DISPLAY=`eval ‘who am i | cut -d”(” -f2 | cut -d”)” -f1′`Here in above command, see single quote, double quote, grave ascent is used. Observe carefully.
10. Display the processes, which are running under your username ?
- Ctrl+l . Clears the Screen. Ctrl+r . Does a search in previously given commands in shell. Ctrl+u - Clears the typing before the hotkey. Ctrl+a . Places cursor at the
beginning of the command at shell. Ctrl+e . Places cursor at the end of the command at shell. Ctrl+d . Kills the shell. Ctrl+z . Places the currently running process
into background.
14. How to know the date & time for . when script is executed ?
- Add the following script line in shell script.eval echo “Script is executed at `date`” >> timeinfo.infHere, .timeinfo.inf. contains date & time details ie., when script is
executed and history related to execution.
- iostat -E
- du -k
- quot -af
- ps -ef | grep -i $@
21. Display the page size of memory ?
- pagesize -a
- arp -a
- netstat -i
- ipcs
- top .b 1
- prstat -a
/sbin/route -n:
Or
or
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 ~]$
7. What is the most graceful way to bring a system into single user mode?
The disk usage can be determined by using the command, du.This command outputs the number of kilobytes used by each sub-directory.
9. What is AWK?
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}’
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.
/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)
Or
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.
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.
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.
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.
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.
Inode is stored in File Management system ie in the Secondary Memory where os is stored