Find command, file name suffix, and Linux and Windows inter-pass files

Source: Internet
Author: User

Find Command

File Lookup:

1.which (typically used to find the absolute path of a command)

2.whereis (not used)

3.locate (non-real-time lookup, based on a pre-defined database.) Fuzzy Lookup, Find Fast. This command must be installed before use yum-y install Mlocate, and it is best to update the database updatedb before each use)

Locate-i: The lookup is not case-sensitive.

4.find (real-time lookup, exact lookup, slow lookup)


Use of the Find command:

To find by name:

Find path -name "file name": In ... Directory to find the name ... The file.

Find -iname: Case insensitive.

If there is no write path behind find, it is located in the current directory.


To find by type:

Find path -type file type-name "file name": Find by type named ... The file.


To find by time stamp:

The file has three time: Atime, Mtime, CTime. (In days)

Atime: The last time to be visited.

Mtime: The last time the file content was modified.

CTime: The last time the file attributes (size, permissions, ownership, and so on) were modified.

Amin, Mmin, Cmin: in minutes.

Find/etc -mtime -1: Find files that have been modified within 1 days under/etc.

Find/root -ctime + 5: Look under/root for files that have changed properties 5 days ago.


Multiple query criteria for find can be used together, and they are "and" relationships. If you want them to become "or" relationships, use the-o option between conditions.

To find by Inode number:

Find/ -inum inode number: Look for inode numbers ... The file. (Used to find hard links)


To find by size:

Find/etc -size 10M: Look for files in the/etc directory with a size of 10M.

Find/etc-size +10m: Find files larger than 10M in the/etc directory.

find/etc-size-10m: Find files less than 10M in/etc directory.

M is uppercase, K is lowercase, respectively represents the unit "trillion" and "thousand".


Find the file and then execute the command:

Find/root-type f-mmin-60 -exec mv {} {}.bak \;  : Look for files that have been modified within one hours under the/root directory, and rename them to "file name. bak". (where-exec is an option for find, which is used to take two commands before and after.) {} represents each file that is found, traversing the command following the execution. \; is the end symbol)

Find/etc-type f-perm/7000-exec ls-l {} \; : Find files with special permissions in the/etc directory and list their details.

Find/home-user user1-group user1-exec cp-a {}/root/backups \; : Look for files under the/home directory, the owner and the owning group are User1, back up to the/root/backups directory, and leave the permissions. (cp-a equivalent to Cp-r plus cp-p)


FileName suffix

In Linux, the suffix of the filename does not determine the file type, we are just used to give different files corresponding suffix, let us easier to identify.


Linux and Windows inter-pass files

1. Using the WINSCP tool


2. Using Centos7 's own commands sz and RZ

First, install LRZSZ this installation package, yum-y install Lrzsz. Then, use the "SZ file name" to pass the files on Linux to Windows. Use the RZ command to pass files on Windows to Linux (saved in the current directory by default). Must be used in conjunction with Xshell, not directly on the virtual machine to knock the two commands (will crash). This method often has problems and is not recommended for use.


3. Use the Xshell xftp tool (requires pre-installation xftp)


Find command, file name suffix, and Linux and Windows inter-pass files

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.