Find files fast and without “permission denied” warning
How to find file in Linux (Ubuntu) system (clean way)? FILE_NAME – name of looking of file $ find . -name FILE_NAME -print 2>/dev/null | grep -v "Permission denied" How to find files fast in Linux systems? – looking of string $ sudo apt install parallel $ find . -type f | parallel -k -j150% -n 1000 -m

How to find file in Linux (Ubuntu) system (clean way)?
FILE_NAME
– name of looking of file
$ find . -name FILE_NAME -print 2>/dev/null | grep -v "Permission denied"
How to find files fast in Linux systems?
STRING
– looking of string
0
string represent what do you searchx
$ sudo apt install parallel $ find . -type f | parallel -k -j150% -n 1000 -m grep -H -n STRING {}
To grep
a big file in parallel use --pipe
:
... < bigfile parallel --pipe grep STRING
Depending on your disks and CPUs
it may be faster to read larger blocks:
... < bigfile parallel --pipe --block 10M grep STRING
You can use grep -ilR
:
$ grep -Ril "text-to-find-here" /
i
stands for ignore case (optional in your case).R
stands for recursive.l
stands for “show the file name, not the result itself”./
stands for starting at the root of your machine.
Performing Actions based on Find Output
The -exec
command allows you to execute an action against all the files that are output from the find command.
Find a file named file1
and change permissions to 644
:
$ find / -name "file1" -exec chmod 664 {} \;
Karol PreiskornDecember 4th, 2020linux 0 comments on Find files fast and without “permission denied” warning178bash, files, find, grep, linux
Related Posts
Subscribe
Login
0 Comments
Newest
Oldest
Most Voted
Inline Feedbacks
View all comments