Important Unix General Interview Questions
Q – 1 Using Unix command how to display no of records in oracle?
Ans- >wc -l filename
Example:
cat>file
1 abc 100
2 def 200
3 ghi 300
4 ijk 500
wc -l file
4 file
Q – 2 How to find multiple string?
Ans- Use extended grep command egrep ‘searchstr1 | searchchstr2’ file.txt
Q – 3 How do display only hidden files in Unix?
Ans- Hidden files will start a period (.) in their names. To
list them use -a option of ls command.
like, ls -ltra
Q – 4 How to know the ip address of user system?
Ans- nslookup
e.g: nslookup ibm6
Q – 5 How to list all the hidden files?
Ans- ls -ald (In solaris)
ls – ltra (In unix)
Q – 6 What is a “parameter card” and what is useful for?
Ans- parateter card is a type of card used to provide voice digital communication to radio stations for therir FMs
Q – 7 What is difference between SSH V1 and SSH V2? What are drawbacks of SSH V2?
Ans- V1: less secure , lacks a strong mechanism for ensuring the integrity of the connection.
if machine name user ogged in from is present in one of the follwing file then connection is established. $HOME/.rhosts, $HOME/.shosts, /etc/hosts.equiv, or
/etc/shosts.equiv,
V2:More secure provides additional mechanisms for confidential- ity
Q – 8 What are the general Commands in using Unix OS for a beginner?
Ans- cat command:used to create and displaying the information
present in the files.
Syntax for file creation: cat>(filename)
Syntax for displaying information in those file: cat
(filename)
Syntax for Appending data in that files: cat>>(filename)
ls command: to list the files present in the system.
ls :will list all the files present in that directory.
ls -l:for long listing of the files.
ls -a:to view hidden files.
ls -ld:to get the permission for the current directory.
ls -ltr:to get the latest file in the directory.
man command:to know more information about the cmds.
Syntax:man
eg:man ls
touch: is also used to create the multiple empty files at a
time.
Syntax:touch f{1..10}:creates 10 empty files with names
f1,…f10.
pwd:is used to know present working directory.
cd f1 :to changed to the directory f1.
mkdir :to create new directory.
rmdir :to remove directory when it is empty
only.
rm :to remove the files.
rm -r :to remove the files in that
directory recursively.
rm -f :to remove the files in that directory
forcebily.
cp : to copy the contents of one file
to another
Q – 9 How to use grep command to list find the records of a file containing 10 different strings?
Ans- grep ‘word1|word2’
Q – 10 What is the difference between NFS 3 and NFS 4? What are new features added in NFS4?
Ans- nfsv3 acces through udp protocol whereas nfsv4 acces through
TCP/IP protocol
Q – 11 What will be the result if we run the command #find /tmp -mtime -2 and #find /tmp -mtime +2?
Ans- find /tmp -mtime n where n can be +ve or -ve
+n says, file modified in last n days
-n says, file modified more than n days ago
ex. if today is 5th of a month
file1 has mtime 3rd
file2 has mtime 2nd
then find . -mtime 2 will report file1
then find . -mtime -2 will report file2 only
Q – 12 Suppose i have one column with data smith micale the o/p should be smith,john, michale how we do in unix?
Ans- Suppose they are asking for displaying just one of the columns in a directory, make a note of that column number
as it appears when we do a ls -lrt. Then we can use awk to just display the one columns as o/p.
If column number is n, then do this: ls -lrt | awk ‘{print $n}’
Q – 13 What is grep|sort give example?
Ans- grep stands as Globally Search for Regular Expression and Print.
It is used for displaying the pattern matching lines from requested file or files .
Q – 14 How to move a background job to forward?
Ans- ./test.pl&
jobs — get job id of the above process
[3] Running ./test.pl &
fg 3
Q – 15 Explain command to display different lines that are found when compare two files?
Ans- diff file1 file2
Above command will display all the lines which r diff in file1 & file2 whereas, cmp will only display 1st occurance
of difference.
Q – 16 Explain command to show the space allocation of files?
Ans- df -h—– it shows the space alocation for oracle dsata file. olny for space alocation execute command ll -lrth.
Q – 17 Explain command to view process running?
Ans- use ps command “process status”. I will use “ps -ef” to list every process in detail.
Q – 18 Finding the presence of a word in a list of n files (pattern matching)?
Ans- sed -n ‘/matchingpattern/g’ file1 file2…