3, Grep,vim, compression function detailed

Source: Internet
Author: User

Morning Order

Less abc.txt Viewing the ABC file can be turned upside down

LS--help | More (view the file in more ways)

Cat abc.txt View ABC file

Head-5 abc.txt View Top Five Elements

Tail-5 abc.txt View Tail Five Elements

head-10/etc/passwd | Tail-4 view six to 10 rows of files

Tail-f Abc.txt Viewing files dynamically

More Abc.txt View Abc.txt Press Q to exit press ENTER to display the next line Go home page DOWN Press B to page up

Ls-l/etc/*.conf | Wc-l See how many lines are there for. conf files under Etc files

Find/etc-name *.conf-a-type F | Wc-l See how many lines are there for all files with. conf under Etc files

WC/ETC/PASSWD (display line word byte)

Wc-l etc/passwd (show lines only)

grep--color 127.0.0.1/etc/hosts (find 127) s

Grep-i--color 127.0.0.1/etc/hosts (-i means case insensitive)

Grep-iv--color line/etc/hosts (-v take reverse)

Grep-e "127.0.0.1|network"/etc/hosts--color (Extended find 127 and net)

grep "^$"/etc/hosts.allow (^$ = blank line)

Grep-v "^$"/etc/hosts.allow (except for empty lines)

grep--color ^root/etc/passwd (Find the ^ at the beginning of root to indicate what starts with what)

grep--color bash$/etc/passwd (indicates what ends with a $ in bash)

DMESG | grep ETH--color (find main information at boot time)

Grep-v ^#/etc/hosts (get rid of the message with # Open head)

Grep-c/bin/bash$/etc/passwd (count the number of users using/bin/bash as the login shell)


Special Symbol Letter Summary

(^) Start ($) End (^$) line number with blank line (-e) extension (-c)

(-D) Extract (-i) Non-size (-V) inverse (-l) Display line


PM Order

echo 11111 > Test.txt or echo 1111 >/home/test.txt (enter content before new content is deleted)

echo 11111 >> test.txt or echo 1111 >>/home/test.txt (Append new content does not delete previous content)

GZIP ABC (compressed ABC) BZIP2 compression same as Gzip method

BZIP2-D ABC (decompression) bzip2 decompression Same as Gzip method

Zip AAA ABC (intermediate ZIP name followed by file name) (source file exists)

Unzip-d CCC Aaa.zip (unzip and create folder)

TAR-CVF Abc.tar ABC (c means package V to see the process is optional F indicates an inductive document is necessary)

TAR-XF Abc.tar (x = unzip)

TAR-TF Abc.tar (t = View Compressed package file)

TAR-ZCF home.tar.gz Home (compressed folder is in gzip tar format package)

TAR-ZXF Home.tar.gz-c/Home (unzip the gzip Tar-formatted package to a path)

TAR-JCF home.tar.gz Home (compressed folder is Jzip tar format package)

TAR-JXF home.tar.gz-c/Home (unpack Jzip tar-formatted package to a path)

TAR-JTF home.tar.gz (View contents of compressed package)

(c means packing F means archive x means extracting J means bzip2 Z means gzip t means view-C indicates which path to extract to)

redhat6.4 no matter bj2 or GZ direct AXF decompression TAR-AXF xxx.tar.gz


VIM ABC (open ABC text editor)

Page PgDn PgUp (page up and down)

In-line jump (home end)

Jump cursor between rows (press 1 shift+g to jump to the first row shift+g the last row)

YY (copy one line of the cursor) p (sticky large p cursor before small p cursor)

del or x delete dd Delete one row press 2 and then press DD to delete the next two lines of the cursor

Press D and Press shift+^ (the beginning of the deletion from the cursor)

Press D and Press shift+$ (the end of the line removed from the cursor)

/word (look backwards for characters suffering from "word")

Wrod (look forward for characters suffering from "word")

N, N (jumps to the next/previous found character)

U (undo last Action)

U (undo all modifications to the current line)

J (merge current row and next row)

X (Set Password)

!ifconfig (You can add one before you exit the other command command in the editor!)

Ctrl+r (cancels the current operation)

Ctrl+zz Save and exit the Vim editor

Go to the editor W/home/abc Save as an ABC under the home folder

Enter the editor R/HOME/CAD to load the CAD under the home file into the current editor

Enter editor e/home/opt to replace the opt file under the home file with the current document open

W Save Q Quit! Force x Save plus exit

R! blkid/dev/sda1. Write uuid to file

G jumps to the last line or crtl+g

Press number N and press Crtl+g

C cursor to the end of the line is deleted and into the editing mode

M #跳到屏幕中间

Press the number key and then press the left and right healthy head #身左右跳转几个位置

0 #回到行首

X #保存退出

In the vi Editor, in command mode, type O to add a new line under the current line of the cursor

In the vi Editor, in command mode, delete the character at the current cursor using the x command.

In the vi Editor, in command mode, repeat the last action on the edited text, which you can use. Command.


Find Features

Replaces the first "old" s/old/new of the current line

Replaces all "old" s/old/new/g of the current line

Replace all "old" n,ms/old/new/g of line N-m

Replace all "old"%s/old/new/g in the file

Replace with C, each time users need to confirm%S/OLD/NEW/GC


Vim ~/.VIMRC is located in the user's home directory to pre-set some vim parameters

Set Nu Add line number set Nonu Cancel line number

Set Nohlsearch original look-up mark minus can be shortened to set HLS

Set Autoindent (start indent) can be abbreviated as set AI



3, Grep,vim, compression function detailed

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.