Linux-find command

Source: Internet
Author: User

Rights Management Commandschmod:Change the permissions of a file or directory;Chown: Change the owner of the file or directory;Chown[User] [file/filename]; only the root user can use thechgrp: Change the group to which the file or directory belongs;chgrp[Group] [file/filename]; umask:The default permissions of the new file, and the executable permission of the newly created file is removed from Linux;#View default Permissions[[Email protected] ~]#umask-su=rwx,g=rx,o=Rx#change the initial value[[email protected] tmp]#umask 023[[email protected] tmp]#umask-su=rwx,g=rx,o=r File Search command: Find filepath-name FileName:Find by file name#find files with file name init[[email protected] tmp]#find/etc/-name Init/etc/Init/etc/sysconfig/Init#find files with init in the file name[[email protected] tmp]#find/etc/-name *init*/etc/Inittab/etc/init.D/etc/Init#-iname indicates case insensitive[[email protected] tmp]#find/etc/-iname Init/etc/INIT/etc/Init/etc/sysconfig/Initfind filepath-size +/-(+ = greater than-indicates less than no write representation equals) size; Search based on file size; The unit of this size is the data block. 1 DATABASE =512 bytes#find files larger than 100M 1024*100/512[[email protected] tmp]#Find/-size +204800Find filepath-user/-group Username:find files that belong to a specified user (group)#find files that users belong to Lingzhiling[[email protected] tmp]#Find/-user lingzhiling/home/lingzhiling/home/lingzhiling/.Bash_profile/home/lingzhiling/.Bash_logout/home/lingzhiling/.BASHRC#Find by Time attributeFind Filepath-cimin (file attributes)/-amin (Access time)/-mmin (ask price content) +/-N#find files that have been accessed within 10 minutes[[email protected] tmp]#find/etc-amin-10#Complex Queries-a denotes and; -o indicates or#files larger than 800*5/1024m and less than 263840*5/1024[[email protected] tmp]#find/etc/-size +800-a-size-263840#-type F (file)/d (directory)/L (software connection)#Find etc File init start and type for file[[email protected] tmp]#find/etc/-name init*-a-type F/etc/Inittab/etc/init/init-system-dbus.conf/etc/sysconfig/Init/etc/sysconfig/network-scripts/init.ipv6-Global/etc/iscsi/initiatorname.iSCSI/etc/selinux/targeted/contexts/Initrc_context#for the results of the lookup by-exec/-ok the difference between OK and exec is OK to ask. [[email protected] tmp]#find/etc/-name init*-a-type f-exec ls-l {} \;-rw-r--r--. 1 root root 884 November 4 20:17/etc/Inittab-rw-r--r--. 1 root root 130 March 2014/etc/init/init-system-dbus.conf-rw-r--r--. 1 root root 1154 November 4 20:17/etc/sysconfig/Init#-inum Some files with strange file names, such as "Test 1", and find hard links through the I node[[email protected] tmp]#find.-inum 407198./test 1#Locate the I-node 407198 file and delete it[[email protected] tmp]#find.-inum 407198-exec rm {} \;        

Linux-find command

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.