Linux find commands

In this article, we’ll cover the basic usage of the find command in Linux. Usually, it’s syntax is:

find directory [options]

find by type

You can search for only files or folders with the following options:

find / -type d #finds directories
find / -type f #finds files

find by name

You can directly find a file by it’s name

find / -name "myFilename"

find by size

You can list all files that are larger than a given value

find / -size +2M #finds files above 2 megabytes
find / -size -2M #finds files below 2 megabytes

find and execute

You can run other commands on files that you find

find / -name "myFile" -exec chmod 0755 {} \; #changes the permissions of any file called myFile to 0755
  • 0 Korisnici koji smatraju članak korisnim
Je li Vam ovaj odgovor pomogao?

Vezani članci

Linux tar Command

The Linux tar command is used to compress and extract files to and from an archive. In this...

Linux file command

The file command is used to check a file’s type and contents in Linux environment. It is most...

Linux export command

When you’re managing your shell’s variables and you wish to save them to your environment you can...

Linux su command

The su command is most commonly used to switch to another user. You will then be able to run...

Linux wc command

If you’re interested in finding the word count or lines of a file in your Linux environment you...

Powered by WHMCompleteSolution