20150830 after-school exercises to be perfected

Source: Internet
Author: User

First, homework (exercise) content:

1, summarize the text editing tool vim use method;

Vim

(1). Command Explanation: Patterned editor

(2). There are a number of different modes:

Edit mode: Command mode

Input mode: Insert mode

Last-line mode: Vim has many built-in commands that act as an interface to the command

Edit mode ===== Input mode:

I: Convert to input mode at the current cursor position

I: Convert to input mode at the beginning of the current cursor line

A: At the rear of the current cursor, convert to input mode

A: The end of the line at the current cursor is converted to input mode

O: Create a new blank line below the current cursor line and convert to input mode

O: Create a new blank line above the line at the current cursor and convert to input mode

Input mode =====> edit mode: ESC

Edit mode ====> Last-line mode: ":"

Last-line mode ====> edit mode: ESC

(3). Exit Vim

Last-line mode:

Q! Force quit, do not save edited content exit

Wq Save exit

X Save exit

xq!  X! Force Save exit

Edit mode:

ZZ Save exit

(4). Edit command

Cursor Movement:

Move between characters:

H: Cursor moves left

L: Move the cursor to the right

K: Move Cursor up

J: Move the cursor down

Move between words:

W: Move to the beginning of the next word

E: Move to the ending of the next word

B: The first word of the current or previous word

#: Jump N Words at a time

Jump at the end of the beginning line:

0: Jump to the absolute beginning of the Non-tab character

^: Jump to first non-whitespace character

$: Jump to absolute end of line

Jump between sentences:

): Jump to the beginning of the next sentence

(: Jump to the first sentence

Move between paragraphs:

}: Jump to next paragraph

{: Jump to previous paragraph

Fast movement between lines:

#G #表示想要跳转的行数

G: Article tail

1 G: Article header

Last-line mode: n jumps to n rows

Edit operation:

X: Delete the character at the cursor location

#x: Delete the # characters that are at the cursor and backwards

R: the character at which the cursor is replaced

D: Delete command:

DD: Delete the line where the cursor is located #dd: Delete the line with the cursor and the total # line of the downstream:

Use with Jump commands

d$: Delete the contents of the cursor at the end of the line; D: Same

d^: Delete the contents of the cursor at the beginning of the line

DW,DE,DB: These 3 commands support using # to indicate the number of words covered

P: Paste:

Line level:

P: Paste below the line where the cursor is located

P: Paste above the line of the cursor

Y: Copy

YY: Copy cursor row Y: Copy a whole row

#yy: Copy cursor row and line total # line

d$: Copy the contents of the cursor at the end of the line

d^: Copy the contents of the cursor at the beginning of the line

YW,YE,YB: These 3 commands support using # to indicate the number of words covered

C: Modify

CC: Deletes the entire line of the cursor and immediately transitions to input mode

#cc:

C$,c,c^,c0,cw,cb,ce

Undo Action:

U: Undo

#u: Undo # Operations

Cancel the last action:

Ctrl+r

Repeat the previous command

(5). Visualization mode:

V: Select the content at the left of the cursor line cursor

V: Select the content on the right side of the line where the cursor is located

(6). Flip Screen command in edit mode

CTRL+F: Flip a screen to the end of the file

CTRL+B: Flip a screen to the file header

Ctrl+d: Turn half screen at the end of the file

Ctrl+u: Turn half screen to file header

(7). Text Lookup

/pattern

? PATTERN

N: Find text trailing

N: Finding the Text header

(8). Text substitution

Last-line mode: Built-in command interface with command history function

There are some built-in commands for editing operations, which can be done using the address-bound method

Address delimitation

Startline[,endline]

#: Line #

.: When moving forward

$: Last line

%: Full text

Relative delimitation:

+#: Down # lines from a specified position

-#: Up # lines from a specified position

Text substitution command: s

s/what to look for/replace with content/modifiers

/: Delimiter, used to split "what to find" and "Replace with": This delimiter can use other characters, such as @, #等:

What to look for: You can use regular expressions: This section can be referenced in the "Replace with Content" section later using the "&":

What to replace: The regular expression is not available, generally normal text, but you can use the \1,\2 in regular expressions,.... What's Saved

Modifier:

I: Case insensitive when looking for characters

G:global, global substitution;

(9). Multi-File Mode:

Open File:

Vim [OPTION] ... [FILE] ...

+#: Quickly navigate to # lines

+/pattern quick position to the first match to the line by the pattern

Multiple files:

Vim FILE1 FILE2 FILE3 ...

Last-line mode:

: Next Next

: Prev Previous

: Last One

: First One

Exit All Files:

Wqall Save All and exit

Wall Save All

Qall Quit all

Multiple windows:

-O horizontal Split window ctrl+s horizontally split document

-O vertical Split window Ctrl + V vertically split document

(10). Interface Features

Turn off line display:

Set nu

Set Nonu

To turn on the syntax highlighting feature:

Synatx (On|off)

To turn on the search highlighting feature:

Set Hlsearch

Set Nohlsearch

To turn on the Auto indent feature:

Set Autoindent:set AI

Set Noautoindent:set Noai

Character Case Sensitivity:

Set Ignorecase:set IC

Set Noignorecase:set Noic

(11). configuration file

Global:/ETC/VIMRC

Personal: ~/.VIMRC

2, summarize the document Search command find use method;

Find

(1). Order Explanation:

Implements a file that finds properties that match the specified criteria by traversing the specified target directory

(2). Command syntax:

Find[options] [Find path] [find condition] [handle action]

Find path: Default to Current path

Find condition: defaults to all files under the specified path

Handling actions: Default to Print to screen

Search criteria:

-name: "File name": FileName support using globbing

650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" wps4905.tmp "border=" 0 "alt=" wps4905.tmp "src=" http://s3.51cto.com/wyfs02/M00/72/84/ Wkiom1xltmsg4qbpaabohipjx5y198.jpg "349" height= "/>"

-iname: "File name" is case insensitive

650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" wps4906.tmp "border=" 0 "alt=" wps4906.tmp "src=" http://s3.51cto.com/wyfs02/M02/72/81/ Wkiol1xltuwgpzpaaabersb1tye072.jpg "" 345 "height="/>

-user: Based on owner Lookup

650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" wps4917.tmp "border=" 0 "alt=" wps4917.tmp "src=" http://s3.51cto.com/wyfs02/M01/72/84/ Wkiom1xltmxagn5caabj0cwcuza150.jpg "" 558 "height="/>

-group: Search by Genus Group

650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" wps4918.tmp "border=" 0 "alt=" wps4918.tmp "src=" http://s3.51cto.com/wyfs02/M02/72/84/ Wkiom1xltmwjf0ssaabib8hmjog289.jpg "" 554 "height="/>

-uid: Search by UID number

650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" wps4919.tmp "border=" 0 "alt=" wps4919.tmp "src=" http://s3.51cto.com/wyfs02/M00/72/84/ Wkiom1xltmxdldqtaabbiepluqw493.jpg "" 558 "height=" "/>

-gid: According to the GID number to find

650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" wps491a.tmp "border=" 0 "alt=" wps491a.tmp "src=" http://s3.51cto.com/wyfs02/M01/72/84/ Wkiom1xltmwbffg4aabdgijf4cy465.jpg "" 538 "height=" "/>

-nouser: Finding files that are not owned by the master

650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" wps491b.tmp "border=" 0 "alt=" wps491b.tmp "src=" http://s3.51cto.com/wyfs02/M02/72/84/ Wkiom1xltmwdbyeraabyjnhdwfs547.jpg "" 558 "height=" "/>

-nogroup: Finding files that are not owned by a group

650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" wps491c.tmp "border=" 0 "alt=" wps491c.tmp "src=" http://s3.51cto.com/wyfs02/M00/72/84/ Wkiom1xltmbzpwouaabeut-jiho926.jpg "" 536 "height="/>

Combination Lookup:

With-A (find out that the/tmp directory has write permissions and is the root file:

650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" wps492c.tmp "border=" 0 "alt=" wps492c.tmp "src=" http://s3.51cto.com/wyfs02/M01/72/84/ Wkiom1xltmbtjwjuaac4oagqvea578.jpg "" 558 "height="/>

Or-O (Find the file with the name 123 in the/tmp directory, or the UID is 600

650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" wps492d.tmp "border=" 0 "alt=" wps492d.tmp "src=" http://s3.51cto.com/wyfs02/M02/72/81/ Wkiol1xltubioqadaabe33tus0i989.jpg "558" height= "/>"

Non--not (find files that are neither root nor hzm users in the/tmp directory

650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" wps492e.tmp "border=" 0 "alt=" wps492e.tmp "src=" http://s3.51cto.com/wyfs02/M00/72/81/ Wkiol1xltuadimtpaabgngaohzu625.jpg "" 558 "height="/>

3, summarize the content of bash environment variable;

4. Summarize the knowledge points of special permissions (SUID, SGID, Sticky) on Linux file system;

5, summarize the Linux Disk Management, file system related knowledge points and the use of related commands;

6, copy the/etc/grub.cfg configuration file to the/tmp directory, use the Find replacement command to delete the/tmp/grub.cfg file at the beginning of the blank character;

%s/^[[:space:]]\+//g

7. Copy the/etc/rc.d/init.d/functions file to the/tmp directory, and add a # to the beginning of the line beginning with a blank character for each line of/tmp/functions with the find replacement command; The original whitespace character is reserved;

%s/^[[:space:]]/#&/g

8, replace the/etc/sysconfig/init in/tmp/functions file is/var/log;

%s/\etc\sysconfig\init//var/log/g

9. Delete the beginning of the line in the/tmp/functions file so #, and # followed by at least one blank character #;

%s/^#[[:space:]]\+//g

10, find the/var directory is the owner of the root, and belong to the group mail all files;

Find/var-user root-a-group Mail-ls

11. Find all files that are not root, bin or hadoop under the/usr directory;

Find/usr-not-user root-o-user bin-o-user Hadoop

12. Find all files whose contents have been modified and are not root or Hadoop for the last week in/etc directory;

Find/etc-not \ (-user root-o-user hadoop \)-a-mtime-7

13. Find all files on the current system that are not owned by the master or group, and have been visited in the last week;

Find/-not-nouser-o-nogroup-a-atime-7

14. Find all files of more than 20k and type of ordinary person in/etc directory;

Find/etc-size +20k-a type-f

15, look for all the users in/etc directory do not have permission to write files;

Find/etc-not-perm +222

16. Find at least one class of users who do not have permission to execute files in/etc directory;

find/etc-not-perm-111

650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; margin:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" wps493f.tmp "border=" 0 "alt=" wps493f.tmp "src=" http://s3.51cto.com/wyfs02/M00/72/84/ Wkiom1xltmeyqo7laafsb00juik353.jpg "" 557 "height=" 162 "/>

17, find/etc/init.d directory, all users have execute permission, and other users have write permission files;

find/etc/init.d-perm-113

650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" wps4940.tmp "border=" 0 "alt=" wps4940.tmp "src=" http://s3.51cto.com/wyfs02/M01/72/84/ Wkiom1xltmerfc-raabkbyt5sbo267.jpg "" 558 "height="/>

18, so that ordinary users can use/tmp/cat to view/etc/shadow files;

19, create the directory/test/data, let a group of ordinary users have write permission to it, and all the files created by the group of directories belong to the group, in addition, each user can only delete their own files;

20150830 after-school exercises to be perfected

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.