Vim usage, file permissions and find tool

Source: Internet
Author: User

1. Summary of the use of the text Editing tool vim

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/72/A4/wKiom1Xpq2-CsSpzAAXcWbe4sX4262.jpg "title=" Vim usage Diagram "alt=" Wkiom1xpq2-csspzaaxcwbe4sx4262.jpg "/>

2. File Find command Summary of Use method

The Find command uses an explanation:

Find [OPTION] ... [Find Path] [Search Criteria] [Handling Action]

Find path: Default to the current path;

Search criteria: The specified search criteria, can be based on the file name, size, genus of the main group, type, etc., by default to find all the files under the specified path;

Handling actions: What to do with the eligible files; By default, output to the screen;


Search criteria:

to find by file name:

-name "file name", wildcard characters are available in the string such as *,?, [] etc.

-iname "file name": Character case insensitive, wildcard characters are supported;

-regex "pattern": matches the entire file path string with pattern, not just the file name;

According to the genus, the genus Group looks for:

-user USERNAME: Find files belonging to the owner of the specified user;

-group GROUPNAME: Finding files of the specified genus group

-uid UserID: Find the file of the specified UID;

-gid GroupID: Finding files for a specified GID

-nouser: Find files that are not owned by the master;

-nogroup: Find files without a group;

To find by file type:

-type type:f: Normal file \\d: Directory \\l: Symbolic link \\b: Block device \\c: Character device \\p: Named pipe \\s: Socket

Combination Lookup criteria:

and Conditions:-A: Connect two different conditions (two conditions must be met at the same time)

or condition:-o: Connect two different conditions (two conditions satisfy one)

Non-conditional:-not,! : The reverse of the condition

The following two examples require attention 1,! A-o! B =! (A-a B) 2,! A-a! B =! (A-o B)

Depending on the file size, look for:

-size [+|-] #UNIT units: K, M, G

#UNIT: (#-1,#]: If #unit is 3, then-size 3 means that the file size is greater than or equal to 3 and less than 4

+ #UNIT: (#,+oo): If #unit is 3, then-size +3 means that the file is greater than or equal to 3

-#UNIT: [0,#-1]: If #unit is 3, then-size-3 means that the file is greater than 0 and less than or equal to 3

To find by time stamp:

in "Days" as the unit

-atime [+|-]#: Follow the file access time to find

#:[#,#+1)

+#: [#+1,oo]

-#: [0,#]

-mtime: Follow the file change time to find

-ctime: Follow the file creation time to find

In "Minutes" units

-amin

-mmin

-cmin

To find according to permissions:

-perm [/|-]mode

MODE: exact permission match, 0 means all available,

/mode: Any one of a class of objects (U,g,o) is eligible, implied or conditional,-mode: Every permission specified for each class of object must be in the same party for the same condition; Thing

When you use a lot of logical options, you can enclose these options in parentheses. In order to avoid the shell itself being misunderstood, it is necessary to add the escape character "\" to remove the meaning of the parentheses before the session number. Example: Find \ (–name ' tmp ' –xtype c-user ' inin ')

Handling actions:

-Print: Default processing action

-ls: Similar to the "ls-l" operation for each file found;

-delete: Delete the found file;

-fls/path/to/somefile: The detailed path information of the found file is saved to the specified file;

-ok command {} \; executes the corresponding shell,{} represents the result set of the lookup, which requires the user's prior confirmation before executing the specified command on each file;

-exec COMMAND {} \; no user confirmation required;

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;

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;

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

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

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

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

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

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;

14. Find all files that are larger than 20k and type ordinary files in/etc directory;

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

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

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

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;

Second, completion time:

Before September 7, 2015.

Third, the way of submission:

Please submit your job's post link address in the form of a comment blog. Formats such as:

Student number + name http://mageedu.blog.51cto.com/4265610/1687589


Vim usage, file permissions and find tool

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.