Sie sind auf Seite 1von 3

Unix command to remember:

1) To copy all contents from a folder or Directory to any another directory/fold


er is:
>> cp -a /Source path/. /Target path/
Note sapce must be there inbetween cp to -a, -a to /Source path, and from source
path./ to /Target path.
Only all contents from the folder will be copied not folder itself.
2) To go back to previous directory like /USR/SAP/SID/SYS/Profile
now if you would like to goback to previous directory eg: /USR/SAP/SID/SYS only
then follow below command.
>> cd where - is hypen
3)To create a folder/Directory then follow below command:
>> mkdir
4)To delete the folder/Directory then follow below command:
>> rm -rf imran(ie folder name)
5)To copy a folder then follow below command:
>> cp -r folder name to be copied(eg:imran) /tartget folder path(eg:USR/SAP/SID/
IRFAN)
Here imran and irfan are folders taken as examples.. and there should be space b
etween cp and -r and also inbetween -r to folder name.
6) To delete only file or text file then follow below command:
>> rm filename(eg rm imran.txt)
where imran.txt is a file name.
7)To find any file or workprocess from any directory then follow below commands:
>> find . -name filename.* -print(eg imran.txt.*) or ps -ef|grep filename.*
Note: .* at the end of file name will search all the files with that name presen
t in directory.
8)To find any file end with .exe follow below command:
>> find / -name '*.exe'
Note: make sure ' ' is maintained inbetween exe, it will find all the files endi
ng with .exe from that directory.

9)To find a folder eg Windows folder or Usr folder then follow below command:
>>find . -name filename(Windows)
this will list all the folders starts as Windows.But you need to search in any p
articular mount point.
10)To know mount points and its sizes:
>> df -h or df-k
where h shows the size in GB and k shows the mount size in KB
11)To know the sizes of any folder then go to the respective directory and :
>> du -h/k imran(where imran is the folder or directory or text file)
12)To move the contents of the file from 1 dirctory/folder to another directory/
folder:
>> mv foldername/*(eg imran/*) /Target foldername path(eg:USR/Sap/Sid/Foldername
(egirfan)
Note:both folders must be in same directory.
VI EDITOR COMMANDS:
1) To open a file:
>> vi filename(eg.imran.txt)
2)
>>
>>
>>
>>

To move the cursor in the imran.txt


h (for left side move on the line)
l (for righ side move on the line)
j (to move down side of the line)
k (to move up side of the line)

>>> A (to move end of the line)


3) To replace text from whole file:
>> :%s/imran/irfan
here irfan replaces imran word in a file.
4) To find/search any text:
>> :s/imran
here imran is the word searched in file.
5)To save a file:
>> :w
6) To save and exit from the editor:
>> :wq

7) To quit forcefully
>> :q!
8)To insert any text:
>> i
9)To change any mode:
>>> press Esc button on the keyboard
10)To delete any line then :
>>> DD for 1 line
>>> 2DD for 2 lines
>>> nDD for number of lines.

Das könnte Ihnen auch gefallen