Use of CHMOD and find commands

Source: Internet
Author: User

Touch myfile create a file
Chmod U + W myfile: grant the execution permission to the owner
Chmod U + x myfile
Chmod u-r myfile
Chmod g + x myfile adds execution permissions to users in the same group.
Chmod o + x myfile adds execution permissions to other users
Chmod U + S myfile: Set SUID for myfile
ID to check which group you belong
Ln-S/usr/SGY/usr/lessonshell/SGY create a link to/usr/SGY in the/usr/lessonshell/SGY directory, the premise is that/usr/lessonshell/SGY must exist.

Find.-Name "*. c" print to check all *. c files in the current directory and subdirectory
Find SGY-name "*. c" print to check all the *. c files in the SGY directory and subdirectory.
Find/-name "*. c" print to check all *. c files in the root directory and subdirectory.
Find/usr/SGY-User Root-print check/usr/SGY directory and all files in the subdirectory are root files.
Find.-Group root-print: Check all files whose user groups are root in the current directory and subdirectory.
Find/usr/SGY-nouser-print check/usr/SGY directory and subdirectory all files with no owner
Find/usr/SGY-nogroup-print check/usr/SGY directory and subdirectory all files without Group
Find.-mtime-5-print: Check all files in the current directory and subdirectory that have been changed within five days.
Find.-mtime + 5-print: Check the current directory and sub-directory for all files whose change time is five days ago.
Find.-newer pipeline. C! -Newer echoserver. c print
Check all files in the current directory and subdirectory that are newer than pipeline. C but earlier than echoserver. C.
Find.-type D-print: Query all directories in the current directory and subdirectory
Find. Size + 1000c-print query all files larger than 1 K in the current directory and subdirectory
Find. Size + 1000c-exec LS-l {}/; check all the files larger than 1 K in the current directory and subdirectory and list them with LS. Be sure not to drop commas.
Find. Name "*. c"-exec LS-l {}/; check all. c files in the current directory and sub-directories and list them with LS. Be sure not to drop commas.
Find. Name "*. c" | xargs LS-l query all. c files in the current directory and sub-directories, and list them with LS (note the use of xargs, which is recommended)
Find. Name "*. log"-mtimes + 5-exec RM {}/; check the current directory and subdirectory for all log files 5 days ago, and delete the files (no prompt, use it with caution)
Find. Name "*. log"-mtimes + 5-OK RM {}/; check the current directory and subdirectory for all log files 5 days ago, and delete the files (with a prompt)
Find. Name "*. c" | xargs grep "fork" query all the *. c files in the current directory and subdirectory that contain fork.
Find. Name "*. c" | xargs LS-l query all. c files in the current directory and subdirectory, and use ls to list them.

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.