Search human readable files in unix

I would like to find human-readable files on my Linux machine without limiting the file extension. These files should be files with information about a person, such as text files, configurations, html, source code, etc. Could you suggest a way to filter and search.

+5
source share
3 answers

Find and file are your friends here:

find /dir/to/search -type f -exec sh -c 'file -b {} | grep text &>/dev/null' \; -print

this will find any files (NOTE: it will not find symlinks of socket directories, etc. only regular files) in / dir / to / search and run sh -c 'file -b {} | grep text &> / dev / null '\; which looks at the file type and searches for text in the description. if it returns true (i.e. the text is in a string) then it prints the file name.

. -b , grep. , -b gettext .

,

root@osdevel-pete# find /bin -exec sh -c 'file -b {} |  grep text &>/dev/null' \; -print
/bin/gunzip
/bin/svnshell.sh
/bin/unicode_stop
/bin/unicode_start
/bin/zcat
/bin/redhat_lsb_init
root@osdevel-pete# find /bin -type f -name *text*
/bin/gettext

EDIT:

, --uncompress . . man file

+6

find /dir/to/search -type f | xargs file | grep text

find .

xargs file file .

+10

    file directory/to/search/* 

, , :

    file home/* 

, ASCII

-1

All Articles