Tips tagged find


59

Tip #232   Deleting difficult filenames

To delete a file who's file name is a pain to define (eg. ^H^H^H) find it's inode number with the command "ls -il". Use the line below to find and delete the file.
Read more »

20

Tip #882   Find last modified files on a filesystem

To find the last modified files in a directory you can use ls -ltr. To find the last modified file on a file system it will not work, but the following command will work:

Read more »

20

Tip #173   Count files by type

To find out the number of files of each type in your current directory try the following:

Read more »

18

Tip #181   Remove empty directories

To remove empty directories (even if filenames or dirnames contain spaces or weird characters) from a tree you can do:

Read more »

14

Tip #147   Find and Grep

Find all files with given name (you can use Bash expansion if you'd like), and Grep for a phrase:
Read more »

13

Tip #209   Directory Tree

The following alias will print the directory structure from the current directory in tree format.

Read more »

11

Tip #300   Find and replace on specific files

Selective content replace on files. For example to replace '<?' with '<?php' in all PHP files:
Read more »

11

Tip #294   Mass-renaming files

Mass-renaming files using find and sed:
Read more »

10

Tip #190   dos2unix all files in a directory

dos2unix requires the name of an input and output file so it can be hard to run on a list of files. The following gets around this and will run dos2unix on all files in a directory:

Read more »

10

Tip #199   Find files by modified time

When specifying time with find options such as -mmin (minutes) or -mtime (24 hour periods, starting from now), you can specify a number n to mean exactly n, -n to mean less than n, and +n to mean more than n. 2 For example:

Read more »