Unix commands

Unix commands Interview questions

unix commands :-


1.Search a file from root directory.(filename = sample.txt)
  find / -name sample.txt

2.Display the numbers in sorted order
   sort -nu

3.Display the updated lines in file
  tail -f filename

4.How to zip a Directory
  gzip -r /hom/bea/app

5.How to kill a prosess.
   kill -9 pid

6.Display all java process in unix.
    ps -ef |grep java

7.How to delete 10 lines in vi editor.
    10dd

8.How to search a string and replace tin  vi editor.
     :"%s/old string /new string/ gi"

9.How to search a string in vi editor from bottom to top.
     ?string name

10.How to insert a line above the current line in vi editor .
      esc+o

11.How to rename a file .
     mv file1 file2

12. copy the content one directory to another directory.
        cp -r dir1/file1 dir2/file2

13. How can delete blank lines in directory.
      grep -v "^$" sample > temp
      mv temp sample

14.How can replace astring in unix.
     sed "s/oldstring/newstring/g" filename

15.Syntax for zip and unzip afile.
     gzip filename
     guzip filename.gz

16.How can display top 10 disk usage files.
  du -sh *|sort -nr|head -10

17.How to retrive a field in a file.
   cut -f 1,2 stud.

18.what is command search a string in a file.
     grep

19).How to goto the end of the line in Vieditor?
     G

20).Copy 10 line in vi editor?
      10yy

21).How to go to insert mode in vi editor?
      Esc+i

22).How to search a string in a file(filename=sample,string=weblogic)?
     grep weblogic sample

23).How to copyfile from one unix to other unix system and syntax (file=sample.txt,target host=192.168.11.128,target file path=/home/bea)?
     scp -rp sample.txt username@192.168.11.128:/home/bea

24).Copy file from path to other tree structure is given below?

25).How to find out CPU utiligation?
      top

26).How to execute ascript using nohup(script name=startweblogic.sh)?
      nohup ./startWeblogic.sh &

27).Which command is used to search and replace a string?
       sed

28).wich command is used to search astring in multiple files?
      fgrep

No comments:

Post a Comment