Tuesday 4 October 2016

Frequently asked Top 10 Unix interview questions

1. List 10 commands that you use daily in your work?
   1. ps -ef : To check the process status
   2. top -c : to check memory and CPU details
   3. df -h : To check the mount point details
   4. sed :  string editor
       options: n -> To edit particular line 'n'
                     'nq' -> To quit after reading 'n' number of lines.
                     'np' -> To display n lines
                       5. scp : Secured copy between two hosts
   6. grep : string matching
       options: i -> To ignore case
                     v -> To reverse the matching
                     e -> Extended grep, to give more options
                     n -> display line numbers
                     c -> Count lines containing pattern
                     l -> Display file name
                     f -> Taking pattern from file
   7. du -hs : To check the disk usage of files and directories.
   8. gzip/gunzip : Top zip the files or directories
   9. netstat : to check the network statistics
  10. iostat : To check disk usage

2. How run a job in the background and how to bring it to foreground?
    To run job in background:jobname &
    To list all the jobs running in background: jobs
    To bring job from background to foreground: fg job_name/job_number

3. How to kill a process?
    kill -9 job_id
4. How to search for a string in vi editor?
     /string and press 'n' for next
5. how to create a child process?
    fork(); it creates one child process so total two processes will be running, parent and child.

6.  How to create an empty file or a file with 0kb?
     touch file_name

7. How    

No comments:

Post a Comment