Day 03 File n folder management
Day 03 File n folder management
=================================
Vi
Visual Instrument
Tools to Create file
Cat Vim
concatenate Visual Instrument iMproved
nano gedit
touch Gvim
Graphical vim
1) cat
====
cat(concatenate) command allows us to create single file, view
contents of file, concatenate files and redirect output in terminal or files.
2) touch
=======
The touch command is the easiest way to create new, empty files that is 0kb
file.
3) vi (Visual Instrument)
===================
Is a screen-oriented text editor originally created for the Unix operating
system.
# vi filename
# vi .filename
#vim filename
# vim .filename
5) nano
======
This is command line note pad
# nano filename
6) gedit
======
This is graphical based note pad
# gedit file name
7) Gvim Graphical vim
==================
GUI version of vim.
Touch :- command is to create the 0 kb file and we can create several file at the
same time. If file is already existing, it will update the time stamp. If the file does
not exist, then '#touch filename' creates a new file with 0 KB file size.
Cat :- However, cat command help to create the file in writable format. Once you
write 'cat > file name' it will allow you to type the text, enter ctrl+d to save and
exit. If you will check with the commandn # cat filename it will show the content
of the file. Cat command dumps the contents of the file to the standard output , if
no options specified.
Vim :- Basically 'vim' is an Text editor which opens a blank file which you can edit
and save it. By using vim editor file content can be encrypted.
Advantages of vi
============
Speed :- Do more with key strokes.
Availability :- Included with most Unix like OS.
No dependency on mouse.
• Command Mode :- default mode. In this mode we can copy, paste and
delete.
U --> undo
ctrl + r --> redo
To move cursor in command mode
=========================
j k l h
) --> moves the cursor downward direction line by line only if there is space
between lines
( --> moves the cursor upward direction line by line only if there is space
between lines
• Insert Mode :- content write mode which is needed to modify the file
:wq! --> forcefully save and quite (it will modify the time stamp )
:x --> save and quite but it will not modify the time
VISUAL MODE
=============
Here we can create split the screen in vim editor.
To Create a Directory
File
===
# cp -f source to destination
EXAMPLE
--------------
# touch /var/ftp/pk
# cp -f /var/ftp/pk /root/Desktop
Folder
=====
# mkdir /etc/httpd/pkk
#touch /etc/httpd/pkk/files{1..10}
Example
FILE
=====
# rm -f filename
Folder
======
# rm -rf foldername