
The command will return all files that have 777 permissions. It checks âtmpâ files that have the file name âfile.php.âįind / -type f -name tmp.php Find Files/Folders by Permissions 7. The command will allow users to find all PHP files with a specific name such as âaskâ in a working directory.įind. For example, the title to search is âputtygen,â then the user has to type the below command.įind / -type d -name puttygen 5. The command searches directories with a specific name such as â puttygenâ in the root folder. Search All Directories for a Particular File Therefore the result will display all results that match the file name.įind /home -iname putty.txt 4.

The command seeks to look for all files irrespective of the case, i.e., uppercase or lowercase in the /home directory. Find Files in /Home Directory Regardless of Case Sensitive For example, the below command is to look for the name âputty.txt.âįind /home -name tecmint.txt 3. The command searches the current working directory for the file name âputty.txtâ However if a user wants the â find commandâ to return only files and not the directories then one has to add -type f at the end of the command.įind. Below are examples of the âfindâ command on Linux: Find Files by Name using find command 1. There are several ways one can use the file command to make tasks easier.
Linux find file location how to#
In this article, we have studied the find command in detail and learned how to search files by name, type, size and modification time. The shared script is very useful in archiving and removing logs. As we do not want the shell to interpret the semicolon, we escape it with \. # Script to move from logs older than 7 days to backup logs path: /app/backup_logs/ESB0*įind /logs/esb01/audit -name "*.tar.gz" -mtime +7 -exec mv is the placeholder which holds the results of the command. We can create a script and schedule it with cron. From there, it deletes log files older that older than 30 days. Let's say we want to create a script that moves log files older than 7 days to a backup path. We can combine find with rm or mv to create meaningful bash scripts that can be automated. -name is the name of the file type that you want to search.ĪDVERTISEMENT Practical examples of find with bash scripts.
Linux find file location drivers#
Drivers communicate with block devices by sending and receiving entire blocks of data. Files that are used to access block devices are called block device files. Examples include keyboards, sound cards and mouse.ī – Block devices. Drivers communicate with character devices by sending and receiving single characters (bytes, octets). Files that are used to access character devices are called character device files. Symbolic links point to files and are similar to shortcuts.Ĭ – Character devices. These are the folders under consideration. They can be any of the below:į – Regular file such as text files, images and hidden files.ĭ – Directory.

Searching for files is relatively easy when you are using a GUI.
