Linux CentOS 7 Find command, three time, accelerator, and file type

Source: Internet
Author: User
Tags clear screen

A. Find command

Locate find a command to find a file from a locally generated database

If you do not have the locate command, install the package: Mlocate

[Email Protected]_46_188_centos ~]# which locate/usr/bin/locate[[email protected]_46_188_centos ~]# rpm-qf/usr/bin/ Locatemlocate-0.26-5.el7.x86_64[[email Protected]_46_188_centos ~]#
Shortcut keys:
    • CTRL + D phase is of course logout logoff

    • CTRL + L Clear Screen

    • CTRL + C abort

    • CTRL + U Delete the contents before the cursor

    • Ctrl + K Delete the cursor after the content

    • CTRL + E to position the cursor to the end

    • CTRL + A to position the cursor to the very beginning

Three time:

stat 2.txt view 2.txt Files of three time

atime: Recent access to content Cat view

ctime recently changed the Inode information touch

changed the contents of the file, Mtime CTime will change. Changes the file CTime, Mtime does not change.

[[email protected]_46_188_centos ~]# stat 2.txt  file:  ' 2.txt '    size: 0         blocks: 0           io block: 4096   regular empty filedevice:  fd01h/64769dInode: 131211      Links: 1Access:  (0664/- rw-rw-r--)   Uid:  (    0/    root)    gid:   (    0/    root) access: 2017-07-12 23:21:57.265143288  +0800Modify: 2017-07-12 23:21:57.265143288 +0800Change: 2017-07-12  23:21:57.265143288 +0800 birth: -[[email protected]_46_188_centos ~]#

MV is renamed:

[[email protected]_46_188_centos ~]# stat 2.txt  file:  ' 2.txt '    size: 7         blocks: 8           io block: 4096   regular filedevice: fd01h/ 64769dinode: 131211      links: 1access:  (0664/-rw-rw-r--)    Uid:  (    0/    root)    Gid:  (     0/    root) access: 2017-08-10 21:44:43.123521346 + 0800modify: 2017-08-10 21:46:39.547587309 +0800change: 2017-08-10 21:46:39.649587367  +0800 birth: -[[email protected]_46_188_centos ~]# mv 2.txt 22.txt[[ email protected]_46_188_centos ~]# stat 22.txt   file:  ' 22.txt '    size: 7         blocks: 8           IO Block: 4096   regular fileDevice: fd01h/64769dInode:  131211      links: 1access:  (0664/-rw-rw-r--)   Uid:  (     0/    root)    Gid:  (    0/     root) access: 2017-08-10 21:44:43.123521346 +0800modify: 2017-08-10  21:46:39.547587309 +0800change: 2017-08-10 21:50:32.438719259 +0800
Find command:
  1. find/etc/-type d-name "FXQ" Find a Directory

  2. find/etc/-type f-name "Fxq" to find files

  3. find/etc/-type c-name "FXQ" Find character device files

  4. find/etc/-type b-name "fxq" Find block file

  5. find/etc/-type s-name "FXQ" Find socket file

  6. find/etc/-type l-name "fxq" Find linked files

  7. Find/-type f-mtime-1 finds files that have changed content in a day

  8. Find/-type F-mtime +1 finds files that have changed content more than one day

  9. find/etc/-type f-o mtime-1-name "*.conf" (-O is or meaning)

  10. Find/-inum inode number lookup hard link file

  11. Find/-mmin-60 within one hour

  12. Find/-type f-mmin-120-exec ls-l {}; List all files that are less than 2 hours in size.

  13. Find/-type f-mmin-1-exec mv {} {}.bak; Find out minutes file rename after Add. bak

  14. Find/-size +10k-type f-exec ls-l {}; List larger than 10k files

  15. Find/-size +10m-type f-exec ls-l {}; List files larger than 10M

  16. Find/etc-type F-mtime +1-mtime-30 Find files that have changed content more than 30 days in a day.

-O or For example:

[Email Protected]_46_188_centos ~]# Find/-name "my.cnf"-o-name "httpd.conf"/etc/my.cnf/backup/hszd_zabbix/bak/ httpd.conf
Second, file name suffix
    • Case sensitive

    • The suffix name is good for. txt. gz. log. conf

    • lang=en default is ZH_CN. UTF-8 Chinese, to display Chinese, the system must be installed in Chinese language support.

File to view the types of files:
Catalogue:[[email protected]_46_188_centos ~]# file /bin//bin/: directory[[email  Protected]_46_188_centos ~] #二进制文件: [[email protected]_46_188_centos ~]# file /bin/cp/ bin/cp: elf 64-bit lsb executable, x86-64, version 1  (SYSV),  dynamically linked  (uses shared libs),  for gnu/linux 2.6.32, buildid[ sha1]=9c78c9014112530b46143fe598a278c5ad792edb, stripped[[email protected]_46_188_centos ~]# Character Device [[email protected]_46_188_centos ~]# file /dev/pts/0/dev/pts/0: character  Special[[email protected]_46_188_centos ~] #链接文件: [[email protected] ~]$ ll /usr/ sbin/iptableslrwxrwxrwx. 1 root root 13 oct 20  2016 /usr/sbin/ iptables -> xtables-multi[[email protected] ~]$ file /usr/sbin/iptables/usr/ Sbin/iptables: symbolic link to  ' Xtables-multi ' [[email protected] ~]$  block file: [[email protected] ~]$  file /dev/xvda/dev/xvda: block special[[email protected] ~]$ Socket File:/dev/log[[ Email protected]_46_188_centos ~]# file /data/mysql/mysql.sock/data/mysql/mysql.sock:  socket[[email protected]_46_188_centos ~]#[[email protected]_46_188_centos ~]#  file /dev/log/dev/log: socket[[email protected]_46_188_centos ~]#


This article is from the "Feng Xiaoqing blog" blog, make sure to keep this source http://fengyunshan911.blog.51cto.com/995251/1956130

Linux CentOS 7 Find command, three time, accelerator, and file type

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.