Vi Editor:
x Delete character at cursor
X Delete character before cursor
Y or yy Yank (copy) current line into "unnamed" storage buffer.
p Paste unnamed storage buffer after current line.
P Paste unnamed storage buffer before current line.
r Replace character
R Overwrite characters from cursor onward
s Substitute one character under cursor continue to insert
S Substitute entire line and begin to insert at beginning of line
J Join current and following line into one line
- Use command: ":e filename"
- Find/Replace:Example:
:%s/fff/rrrrr/g - For all lines in a file, find string "fff" and replace with string "rrrrr" for each instance on a line.
:%s/fff/rrrrr/gc - For all lines in a file, find string "fff" and replace with string "rrrrr" for each instance on a line. Ask for confirmation
:%s/fff/rrrrr/gi - For all lines in a file, find string "fff" and replace with string "rrrrr" for each instance on a line. Case insensitive.
:%s/fff/rrrrr/gi - For all lines in a file, find string "fff" and replace with string "rrrrr" for each instance on a line. Case insensitive.
Extract or Unpack a tar File:
- To extract tar file of type:
- To extract .tar.gz (gzip) file
tar -xzvf <file name>.tar.gz - To extract .tar.bz2 (bzip2) file
- To extarct single file from tar file
tar -xzvf file.tar.gz foo.txt
tar -xjvf file.tar.bz2 foo.txt
Where,-x : Extract a tar ball.
-v : Verbose output or show progress while extracting files.
-f : Specify an archive or a tarball filename.
-j : Decompress and extract the contents of the compressed archive created by bzip2 program (tar.bz2 extension).
-z : Decompress and extract the contents of the compressed archive created by gzip program (tar.gz extension).
cplusplus programming example codes to write programs
ReplyDeletec++ code To Know the Day of Birth from Date of Birth