Introduction to UNIX interview questions and answers
UNIX is basically one secure operating system which most popular in the banking sector or especially those organization who are preferring secure system. It actually replacing Windows operating system mainly for server location or environment.
UNIX interviewer is mainly asking or concentrating on UNIX commands which are very much well known and common command for all. The person who will attain the interview has to be stronger in UNIX command or shell script. Common UNIX command is explained below:
ls —> all the available files display by executing the same.
ls -l —> mainly use to lists the files in long format, it contains more information like size of the file, owners detail, and rights or permission for other user and provided last modified data.
ls -a —> Mainly using to display those files which are starting with dot.
more filename —> displaying some part of file how much it can adjust in one screen. Hitting on space bar will display more data from that file, q can be used for quit. For searching the text inside the file searching text can be put after /.
4.6 (3,144 ratings)
mv filename1 filename2 —> just move the file or cut the file. Normally used to move one file from one directory to another.
cp filename1 filename2 —> Copy the file with content in the same location.
rm filename —> using to remove the file from the directory. There has one option to use rm –I, which provide one confirmation text to the user before delete, possible to make this behavior as default for any deleting activity by adding one alias in a .cshrc file.
diff filename1 filename2 —> Using for compare both the file and give the result with different.
wc filename —> Given details of a number of lines, words or characters in a file.
chmod options filename —> Mainly using for providing permission on specific script or file. Default permission to the creator for reading and edit. But anyone needs that specific file to be read, write and executable then chmod command need to be used. We mainly user 3 number at the time of executing chmod.
First Number 7 = Provide access read, write and execute for the user.
Second Number 5 = Provide access read and execute for the group.
Third Number 4 = Provide access one read for other
|0||No permissions at all||—||000|
|3||Write and execute||-wx||011|
|5||Read and execute||r-x||101|
|6||Read and write||rw-||110|
|7||Read, write, and execute||rwx||111|
gzip filename —> compressing multiple files, similar to ZIP file concept of windows.
gunzip filename —> mainly to uncompress zip file which is compressed by gzip.
lpr filename —> mainly used for print, want to specify different printer name rather than default printer than –P option can be used.
mkdir dirname —> command to create the new directory in command executable location. Duplicate directory name will not be allowed, and all the names are case sensitive.
cd dirname —> Mainly using for changing the directory, it will help to move in another directory and find all the file name in the new directory (ls –lrt command will help to display all the files under this directory). Move back to the previous directory normally use cd .., and move back to multiple parent directory normally execute cd .. / .. / .., which help to move directly in 3 top directories by executing one command. Cd directory name is also very much use in windows command script. Normally when one user logged in UNIX box he moves to a home directory, then they have to use the cd command to move in proper directory to execute any other require command.
pwd —> Always presenting the current location of the user.
Preparing for a job interview in UNIX. I am sure you want to know the most common UNIX Interview Questions that will help you crack the UNIX Interview with ease. Below is the list of top UNIX Interview Questions and answers at your rescue.
Part 1 – UNIX interview questions and answers (Basic)
This first part covers basic UNIX interview questions and answers
1. Command to find out those files which are hidden in the current directory
$ ls -lrta
2. Command to find out existing active running process currently in the UNIX system?
$ ps -ef
Now if we know the name of the process we can add grep after ps –ef like below:
$ ps –ef | grep java
Let us move to the next UNIX interview questions
3. How one can determine memory utilization by an entire process in UNIX box?
This is the basic UNIX interview questions that are asked in an interview.
By using the $ top command.
top command provides all the details including memory usage, process ID, and others. Commands display should be like below:
4. Explain command to find out Exception in application log file, suppose log file name is server.log?
$ grep ‘Exception’ server.log —> will give the expected result.
$ grep ‘Exception’ server.log | wc –l —> will give the proper count of exception in total application server log file.
5. Command to find all the files exist in the same directory or subdirectory which contains a name like ‘Java’?
$ find. -name ‘Java’
Part 2 – UNIX interview questions and answers (Advanced)
This first part covers Advanced UNIX interview questions and answers
6. How is Shell script accepting command line arguments for internal processing in shell script logic?
Arguments pass from the command line can be easily accepted in the shell script by using $ (dollar sign). It always followed argument numeric position on a command line.
7. Display or present last 200 lines of an existing file in UNIX box.
$ tail -200f newfile.txt
Let us move to the next UNIX interview questions
8. Command to find out remaining disk space in UNIX/Linux server.
$ df –kl
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/vg0-root 41153856 6322928 32733776 17% /
tmpfs 4029268 100 4029168 1% /dev/shm
/dev/sda1 487652 33803 428249 8% /boot
20511356 6900920 12561988 36% /database1
10190136 4346232 5319616 45% /database2
10190136 7615792 2050056 79% /database3
5029504 3549988 1217372 75% /backup
9. Provide access to any script file for executable.
$ chmod 755 *.sh
This is the advanced UNIX interview questions that are asked in an interview. If the requirement is to script should be readable, writable and executable for any user, then the command can be chmod 777 *.sh
10. How can we able to kill one process in UNIX box?
$ kill -9 #pid —> pid can be found by executing ps –ef command.
This has been a guide to List Of UNIX interview questions and answers so that the candidate can crackdown these UNIX interview questions and answers easily. You may also look at the following articles to learn more