In this Article we are trying to put some Interview Questions & Answers for Production Support L1 & L2 job profile. I hope it will help you a lot.

Question 1 : write single command to create directories like below.
D1/D2/D3/D4 (D1 is the parent directory ,inside D1 we have D2 directory & inside D2 we have D3 directory)
Answer : mkdir -p D1/D2/D3

Question 2 : How to print line numbers using cat command?
Answer : cat -n filename.txt

Question 3 : How to create empty file?
Answer : touch filename.txt

Question 4 : How to print first 50 lines of a file ?
Answer : head -n 50 filename

Question 5 : How to print last 50 lines of a file?
Answer : tail -50 filename.txt

Question 6 : How to monitor log file progress?
Answer : tail -nf filename.log ( n can be any number lines i.e 100,200,250 etc.)
example tail -100f filename.log

Question 7 : How to print the 11th line of a file?
Answer : cat filename.txt | head -11 | tail -1

Question 8 : Print number of lines in a file filename.txt
Answer : cat filename.txt | wc -l

Question 9 : Print number of characters in a file filename.txt
Answer : cat filename.txt | wc -c

Question 10 : Print number of words in a file filename.txt
Answer : cat filename.txt | wc -w

Question 11 : list all the files & directories, sort the result on the basis of their modification time.
Answer : ls -lrt

Question 12 : How to long listing all the files & directories including the hidden files & directories?
Answer : ls -la

Question 13 : How to change permission of a file or directory?
Answer : chmod 755 filename
chmod 755 directoryname

Question 14 : What is the default file permission in unix?
Answer : 644

Question 14 : What is the default directory permission in unix?
Answer : 755

Question 15 : How to change all file & directory permission inside a directory?
Answer : chmod -R 755 directory_name

Question 16 : How to move directly to home directory?
Answer : cd ~

Question 17 : What is absolute path?
Answer : Complete path starting from root directory.
cd /d1/d2/d3

Question 18 : What is relative path?
Answer : Path to the destination directory from current position.It start with .. .
cd ../../D1/D2

Question 19 : How to copy file & preserve the attributes of source file i.e access time,modification time,user id,permission of source file?
Answer : cp -p source_filename destination_filename

Question 20 : How to copy all the files in a directory to another directory?
Answer : cp -R source_directory_name destination_directory_name

Question 21 : How to list all the log files in a directory?
Answer : ls -lrt *.log

Question 22 : How to delete all the txt files in a directory?
Answer : rm -rf *.txt
it will forcefully delete all the txt files in a directory

Question 23 : Print a file in such a way that last line of the file will print as first line and so on.
Answer : tac filename.txt (tac is the opposite of cat)

Question 24 : Find the line numbers containing the word test in a file filename.txt
Answer : grep -n test filename.txt

Question 25 : List all the log files that contains the word “test”.
Answer : grep -l test *.log

Question 26 : Print all log file names that don’t contains the word “test”.
Ans : grep -L test *.log

Question 27 : Print the above five lines in a file where the pattern “test” is present in a file filename.txt..
Answer : grep -A5 test filename.txt

Question 26 : Print the below five lines in a file where the pattern “test” is presents in a file filename.txt.
Ans : grep -B5 test filename.txt

Question 26 : Print the below five lines & above five lines in a file where the pattern “test” is presents in a file filename.txt.
Answer : grep -C5 test filename.txt

Question 27 : How to count number of blank lines present in a file filename.txt?
Ans : grep ‘^$’ filename.txt | wc -l

Question 28 : Find all files present in the current directory whose permission level is 655 & change it to 755.
Ans : find . -type f -perm 655 | xargs chmod 755

Question 29 : Find all the log files having permission 655 in the directory d1
Ans : find d1 -name *.log -type f -perm 655

Question 30 : Find all the log files which are modified 10 days before in the directory D1.
Ans : find D1 -type f -mtime +10

Question 31 : search all the files which are modified within 10 to 15 days.
Ans : find . -type f -mtime +10 -mtime -15

Question 32 : How to get all the current running process in the unix server.
Answer : ps -aef

Question 33 : Find all the processes running by the user “paul” in the server.
Answer : ps -aef | grep paul

Question 34 : Run a script test.sh in background.
Answer : ./test.sh &

Question 35 : How to keep running the script test.sh even if user logout from the server?
Answer : nohup test.sh &

Question 36 : how to kill a long running process having process id 1234?
Answer : kill -9 1234

Question 37 : what is softlink & hardlink in unix?
Answer : Soft link -: This is exactly works similar way like shortcuts in windows. There will be one original file & we can create multiple soft links to that file. If we delete the original file then the soft links will became useless.
Syntax to create soft link is ln -s filename link_filename
Hard link -: This type of links share the same inode number as the original file.If original file deleted still we can use the hard link file . hard links can only be created in the same file system.
Syntax to create hard link ln filename link_filename

Question 38 : How to find disk space used in the server ?
Answer : du -h

Question 39 : How to find disk space free used in the server
Answer : df -k

Question 40 : Print the 10th line of a file filename.log
Answer : sed -n 10p filename.log

Question 41 : Print the 10th & 15th lines of a file filename.log
Answer : sed -n “10p;15p” filename.log

Question 42 : Print the 10th to 15th lines of a file filename.log
Answer : sed -n “10 ~15p” filename.log