Tips for quickly finding files in Linux via instructions

Use simple commands to quickly find files based on type, content, etc. under Linux.

If you are a non-experienced user of Windows or OSX, you may use the GUI to find files. You may also find the interface limited, frustrating, or both, and learn to organize the files and remember the exact order. You can also do this in Linux - but you don't have to.

One of the benefits of Linux is that it provides multiple ways to handle it. You can open any file manager or press Ctrl+F, you can also use the program to manually open the file, or you can start typing letters, it will filter the current directory list.

Tips for quickly finding files in Linux via instructions

Screenshots of Finding Files in Linux Using Ctrl+F

But if you don't know where your files are, don't you want to search the entire disk? Linux is suitable for this and other situations.

Find program location by command name

If you're used to putting files as you like, the Linux file system can seem daunting. For me, one of the hardest things to get used to is where to find the program.

For example, which bash usually returns /bin/bash, but if you download a program and it doesn't appear in your menu, the which command is a good tool.

A similar tool is the locate command, which I found to be useful for finding configuration files. I don't like to enter program names because simple programs like locate php usually provide a lot of results that require further filtering.

For more information on locate and which, see the man page:

Man which

Man locate

Find

The find tool provides more advanced features. The following is an example of a script that I have installed on many servers. I used to ensure that a specific pattern of files (also known as globs) existed for only five days, and all files that were older than that were deleted. (Scores are used to retain deviations of up to 240 minutes since the last modification)

Find. /backup/core-files*.tar.gz -mTIme +4.9 -exec rm {} \;

The find tool has many advanced uses, but the most common is to execute commands on the results rather than chaining files by type, creation date, modification date.

Another interesting use of find is to find all executable files. This helps to ensure that no one is installing the Bitcoin mining program or botnet on your expensive server.

Find / -perm /+x

For more information on find, use the man find reference man page.

Grep

Want to find files by content? Linux has already been implemented. You can use many Linux tools to efficiently search for files that match the pattern, but grep is a tool I often use.

Suppose you have a program that issues code references and stack trace error messages. You need to find this in the log. Grep is not always the best method, but if the file is a given value, I often use grep -R.

More and more IDEs are implementing lookups, but if you are accessing a remote system or have no GUI for any reason, or if you want to recursively look up in the current directory, use :grep -R {searchterm} or support egrep On the system, simply add the -e flag to the command egrep -r {regex-pattern}.

I used this technique when patching dhcpcd5 in Raspbian last year so that I could continue to operate the network access point while the Raspberry Pi Foundation released a new Debian.

What tips can help you search for files more efficiently on Linux?

Gold Finger Slot Connector

Gold Finger Slot Connector,Dual Contact Gold Finger Slot Connector,High Current Slot Power Connector,Gold Finger Slot Power Connector

Dongguan SOLEPIN Electronics Co., Ltd , https://www.wentae.com

Posted on