Linux: search for files using the terminal

Every person in his life wants to have time to do as many things as possible. Unfortunately, it is not he who decides. Time is what each of us always lacks. However, people have come up with a huge number of ways to speed up an operation or a certain action.

linux file search




This is not about global, but rather petty, in some ways even necessary. About how Linux searches for files. About how to speed up this process several times and how to automate the search for necessary files to the limit.

Simple file search

Now we will consider the case when on Linux you need to search for files, knowing only some of its properties (name, format or size). Knowledgeable people already realized that for this you need to use the find command.

, , , - , , «.jpg», , .

, find, :

find /home -name ".jpg" -print

. , . «/home» , . «-name» , , . «-print» .





linux search text in files




, . :

find /home -name "*" -print

«*». , «», , .

, «.jpg», :

find /home -name "*.jpg" -print

, . , Linux .

, , Word , Linux - .

«find», . «grep». , .

, , « » , : «/home/user». , , :









grep " " /home/user/*.txt

. grep , , , .

linux search for large files




Linux , , .

, . , , .

linux duplicate file search




:

find / -size +1G -print

, «+1G», , 1 , , , . : , , .

:

find / -mount -type f -ls 2> /dev/null | sort -rnk7 | head -10 | awk '{printf "%10d MB\t%s\n",($7/1024)/1024,$NF}'

, . .

«sudo su», , root.

, . , . , , , , , Linux .

, , , .

:

sudo apt-get install fslint

, , .

search string in linux files




, , . .

, , , , , . , , .

, , . , , , , . .

, Linux. LibreOffice . Ctrl+F .

, , . , .

As you can see, on Linux, you can search for files in various ways. Some of them are better, some are worse, it all depends on the situation. In any case, after reading this article, you can now do it. Using the command line for a while, you will remember most of the commands and then you can speed up the process several times.




All Articles