Marco Education 7th Day Find, special permissions, Crontab, Facl, while

Source: Internet
Author: User

7.1.1: File lookup: According to the various properties of the file to find the corresponding file. File lookup is divided into: (Real-time lookup, non-real-time lookup) Locate: Non-real-time lookup (dependent on the index, and the index building is quite a resource: the creation of the index will occur when the system is idle, manually update the updatedb, query speed, Fuzzy Lookup),
7.1.2, find: Real-time lookup (accurate, accurate lookup, slow) use format: Find [option] ... [Find Path] [Search Criteria] [Handling action]. -name "file name" Example: Find/etc-name "p*[0-9]*",-iname: Ignores character case as name,-user,-group,-uid,-gid,-nouser (Find files with no master),- Nogroup (Find non-group files): example Find/etc-user root. Can do non-(-not), with (-a), or (-O) Example: Find/etc-not-user root-a-name "p*[0-9]*"-ls
7.1.3, File type Find-type (f: Normal file, D: Directory file, L: Link file, B: Block device, C: Character file, S: Socket file, p: Named pipe, Example: Find-type f-name "*[0-9]*"), File size lookup-szie ([+|-] #unit commonly used unit{k, M, g}, Example: LS-HDL $ (find-size +1k)), timestamp lookup: Divided into 2 kinds of days to find and in minutes to find (in days looking for atime, Mtime, CTime), Find in minutes (Amin, Mmin. cmin) format for [+|-]#, Example: find/opt/-mtime +60-name "* *"-exec RM-RF {} \;
7.1.4, Permissions lookup-perm ([+|-]mode Exact lookup, example: Find-perm 644, + indicates that any given permission is included,-indicates that each class of user must contain the specified permission), processing action:-exec COMMAND {} \; ({} Represents the previously found information \; Fixed format, for example: Find./-perm-001-a-type f-a-name "*[0-9]*"-exec ls-lk {} \; or: Find./-perm-644-a-type F-a -not-name "*.sh"-exec mv {} {}.txt \;),-ok and-exec are just the same as prompting the user for an example before the command executes: Find./-perm-644-a-type f-a-name "*.txt"-ok ls -l {} \; can pass if the command parameter is too long to execute, find | Xargs Command mode execution

7.2.1, Linux Special permissions: The process runs as a user, the process is the agent that initiates the user of this process, Suid:set UID: If such a file has an executable condition, when any user runs such a command, the process's valid identity is not the initiator itself but the owner of the process. Modified by: chmod u+s file, when ls-l view will appear [s|s],s indicates that the original file has Execute permission, s indicates that the original file does not have permission to execute (such files cannot be executed)
7.2.2, Sgid:set gid set directory owner is Sgid, all users create files under this directory belong to the group of this directory, chmod g+s file
7.2.3, Sticky: Sticky bit, chmod o+t file, restrict users to only delete their own created files.

7.3.1, mail view the current user's Mail Help view assistance List view use the command to enter a number directly to view the contents of the message
7.3.2, at one-time execution of the task at (support a lot of times format), for example: at Now+10min command after Ctrl+d: Submit a task, at-l view the non-performing task at-d #删除任务 # indicates the task sequence number.
7.3.3, cron: View the running status service Crond status,service crond start Start, Chkconfig Crond on the next boot from the boot,
system cron: defined in/etc/crontab. User cron: defined in/var/spool/cron/each user has a file with the same name as the user name (note: If the task defined in Cron is a script, each command in this script follows the CRON PATH environment variable definition; Test the problem-free script at the command line, not necessarily in cron;)
7.3.4, crontab format (minutes, hours, days, months, weeks, command),-L: Lists all tasks that have been defined,-e: Opens the Edit Interface definition task,-r: Deletes All tasks (note: If you use% in crontab user commands, To escape) Example: 0 */4 * * * [-d/backup] | | Mkdir/backup; /bin/cp-a/etc/backup/etc-$ (date + '%y%m%d%h ')

7.4.1, Sleep adds a second-level task method to Cron, for example: for i in {1..6}; do echo '/bin/date +%y-%m-%d-%h-%m-%s ' >>/tmp/test.txt; sleep 10; Done
7.4.2, Facl (File access control list) An ordinary user can individually set a user or group access to a file, not by modifying the owner or group, lsattr display Extended properties, chattr Modify extended Properties, Getfacl Display file control list, Setfacl set file Control list (-m Set additional user access authorization mechanism without changing the original attribute U:username:mode file, example: Setfacl-m u:test:rw-test.txt | | Setfacl-m g:test:rw-test.txt Modify group permissions,-X Cancel additional set permissions-X U:username FILE, example: Setfacl-x-u:test test.txt, set permissions on the directory can be executed with-R recursion)
7.4.3, loop while and until (while applies to loops where the number of cycles is unknown, or if it is inconvenient to use the for direct generation of a larger list when using the judgment to enter the loop: while test condition; Do loop body done, test condition is true, then into the loop, Until and while opposite, judging as false into the loop) example
650) this.width=650; "Src=" https://note.wiz.cn/api/document/files/unzip/cf6fe2dc-e32d-4bb9-8618-5c7c32315798/ D0cf976d-1ffe-2cb6-08d2-ef98c7fcc23b.3483/index_files/7042a957b4bce3638127cdbbff557259.png "style=" border:0px; font-family: ' Microsoft Yahei UI ', ' Microsoft Yahei ', SimSun, ' Segoe UI ', Tahoma, Helvetica, Sans-serif, ' Microsoft Yahei ', Georgia, Helvetica, Arial, Sans-serif, ' song Body ', PMingLiU, Serif;font-size:14px;line-height:21px;white-space:normal; "Alt = "7042a957b4bce3638127cdbbff557259.png"/>Mode of taking the mold650) this.width=650; "Src=" https://note.wiz.cn/api/document/files/unzip/cf6fe2dc-e32d-4bb9-8618-5c7c32315798/ D0cf976d-1ffe-2cb6-08d2-ef98c7fcc23b.3483/index_files/b3ae9f48bd0125ba876d6362c21353c5.png "style=" border:0px; font-family: ' Microsoft Yahei UI ', ' Microsoft Yahei ', SimSun, ' Segoe UI ', Tahoma, Helvetica, Sans-serif, ' Microsoft Yahei ', Georgia, Helvetica, Arial, Sans-serif, ' song Body ', PMingLiU, Serif;font-size:14px;line-height:21px;white-space:normal; "Alt = "B3ae9f48bd0125ba876d6362c21353c5.png"/>
receive a parameter to determine if the user is valid, if it is the display ID and bash otherwise prompt without the user, enter Q or quit when the exit
650) this.width=650; "Src=" https://note.wiz.cn/api/document/files/unzip/cf6fe2dc-e32d-4bb9-8618-5c7c32315798/ D0cf976d-1ffe-2cb6-08d2-ef98c7fcc23b.3483/index_files/2851d8a066a40354b19fd5533922d275.png "style=" border:0px; font-family: ' Microsoft Yahei UI ', ' Microsoft Yahei ', SimSun, ' Segoe UI ', Tahoma, Helvetica, Sans-serif, ' Microsoft Yahei ', Georgia, Helvetica, Arial, Sans-serif, ' song Body ', PMingLiU, Serif;font-size:14px;line-height:21px;white-space:normal; "Alt = "2851d8a066a40354b19fd5533922d275.png"/>



Marco Education 7th Day Find, special permissions, Crontab, Facl, while

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.