Five query commands in Linux and five commands in Linux

Source: Internet
Author: User

Five query commands in Linux and five commands in Linux

1. find

Use the find path command action

For example, find.-name a.txt is a file named a.txt in the current directory.


You can also add the time parameter:

-Atime access time

-Ctime: the time when the status is changed.

-Mtime modification time

Usage: Add a Time Parameter later, for example

-Mtime n: File <A1> <AF> s data was last modified n * 24 hours ago.

More specific:

Fing./-mmin 2: Files modified in the last two minutes.

Find./-mtime 0: returns the file modified in the last 24 hours.
Find./-mtime 1: the first 48 ~ Files modified within 24 hours. Instead of files modified within 48 hours.

Find./-mtime-2: Files modified in two days.

Find./-mtime + 3: File Modified three days ago.

Find./-empty: empty file or file directory in the system.


2. locate

It is equivalent to find-name, but it is faster, because it does not go to the directory but to the database (var/lb/locatedb ). Linux automatically creates the database and updates it once a day. If you want to find the latest file, you can first updatedb and then locate

Example: locate-I ~ /M is to find all files starting with m in the main directory and ignore the case sensitivity.


3. whereis

It can only be used for program name search, and is limited to binary files (parameter-B), man files (parameter-m), and source code files (parameter-s)


4. which

Check whether the command exists and the output address

For example, which java can tell which java version is used


5. type

Check whether the command is built-in (built-in)

For example, type grep


Reference:

Http://www.ruanyifeng.com/blog/2009/10/5_ways_to_search_for_files_using_the_terminal.html

Http://tech.sina.com.cn/c/2001-10-29/6739.html


How to view all commands in linux

You can use man, -- help, Or info to view adduser and enter
Man adduser: This is comprehensive and has examples.
Adduser -- help: This shows you some common parameters.
Info adduesr

In linux, how do I use commands to view the version?

This command is applicable to all linux versions, including Redhat, SuSE, Debian, etc. How can I view the system version uname-a for each user? How can I view the historical command history uname?

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.