1)To print working directory.
#pwd
2)To listen the file.
#ls
options.
ls -l or ll --> with attributes.
-a --> with hidden files.
-r --> reverse order.
-il --> with inode number.
-ld --> to listen perticuler file & directory attributes.
-R --> show the list of files in tree structure.
To create a files.
We can create a files by using three methods.
1)cat
2)touch
3)vi editors
################## CAT COMMAND.###########################
To create & display the files.
#cat
#cat > ram --> (>)To creat a file.
ctrl+d (save & exit)
#cat ram --> To display
#cat >> ram --> (>>)To append or edit(no remove) the file.
*To transfer the contents of file1 & file2 to file3.
#cat ram sham >> raj
################## TOUCH COMMAND ###########################
*To create a file with zero bytes as well as to change the time
stamp of file or directory.
#touch karan --> create single file.
#touch 11 22 33 --> create multiple files.
#touch (existing file name) for change the time stamp.
-rw-r--r-- 1 root root 40591 Mar 3 02:25 avera1 --> before implementing touch command.
-rw-r--r-- 1 root root 40591 Mar 3 22:25 avera1 --> after implementing touch command.
###################### VI EDITOR ##############################
*Editors are used for inserting or deleting text.
• Windows : Notepad
• DOS : Edit
• Linux/Unix
– CLI based : EX , ED , VI
– GUI based : Emacs, Gedit, nedit, nano, pico
*There are three modes of operations in VI Editor :
• Insert Mode
• Command Mode
• Execute Mode
1)How to get into Insert Mode?
i - inserts the text at current cursor position
I - inserts the text at beginning of line
a - appends the text after current cursor position
A - appends the text at end of line
o - inserts a line below current cursor position
O - inserts a line above current cursor position
r - replace a single char at current cursor position
2)At Execute Mode.
:q - quit without saving
:q! - quit forcefully without saving
:w - save
:wq - save & quit
:wq! - save & quit forcefully
:x - save & quit
Shift+ZZ - save & quit
:sh - Provides temporary shell
:set number - Setting line numbers
:se nu - Setting line numbers
:set nonumber - Removing line numbers
:se nonu - Removing line numbers
:84 - Press enter goes to line 84
3)How to get insert mode & execute mode into command mode.
Press ESCAPE key.
*Delete/Copy/Paste/Undo in command mode.
dd - Deletes a line
2dd - Deletes 2 lines
yy - Copy a line
2yy - Copies 2 lines
p - After deleting or copying, by pressing
‘p’ the deleted or copied contents will
be pasted below the position of cursor.
u - Undo (can undo 1000 times)
Ctrl+r - Redo
G - Moves cursor to last line of file
5G - Moves cursor to 5th line of file
########################################################
*To create a directory.
#mkdir amar
*To create multyple directory.
#mkdir aa bb cc
*To create nested directories
#mkdir -p a1/a2/a3
##########################################################
Navigation of Directories.
1)To change the directory
#cd
#cd /root/Desktop --> example.
2)To change directory one level back.
#cd..
3)To change directory two levels back.
#cd ../..
4)To change directory to last working directory.
#cd -
5)To change directory to home directory.
#cd ~ (or) cd
#############################################################
*Removing a File or Directory.
*To remove a file.
#rm avera1 -->(file name).
To remove empty directory.
#rmdir raj --> (directory name).
To remove directory recursively and forcefully.
#rm -rf vinay --> directory name.
#############################################################
*Copying a File or Directory.
*To copy a file.
#cp
Ph. No. 9967413230
email:-vikasjk3@gmail.com
No comments:
Post a Comment