find is a command line utility to search for files in a directory hierarchy
5
votes
2answers
87 views
du command show a slash after directories?
How to use du command show a slash after directories?
For example:
du -ab /root/test/php-5.4.8/
Result:
1781 /root/test/php-5.4.8/main/internal_functions.c.in
973596 ...
1
vote
2answers
50 views
Extracting a multiline regex without leading tabs
I've been trying to hack a little code extraction script together, but I can't get it to work.
My goal is to examine all .txt files in a directory. If it contains a line which doesn't start with a ...
1
vote
3answers
54 views
Compacting `find` name patterns
I am using
find . -name '*.[cCHh][cC]' -exec grep -nHr "$1" {} ';'
find . -name '*.[cCHh]' -exec grep -nHr "$1" {} ';'
to search for a string in all files ending with .c, .C, .h, .H, .cc and .CC ...
2
votes
2answers
72 views
Bash: How to read one line at a time from output of a command?
I am trying to read the output of a command in bash using a while loop.
while read -r line
do
echo "$line"
done <<< $(find . -type f)
The output I got
ranveer@ranveer:~/tmp$ bash ...
2
votes
0answers
69 views
Web front-end to find/grep/ack
In my lab, we are trying to build a web that allows the user to enter queries for find, ack, grep on a specific directory. The web would return an HTML with a table of a list of clickable files (click ...
5
votes
1answer
59 views
Find files that were not installed by the package manager
I'd like to get a list of all files in my Gentoo Linux system that were not installed by the package manager (Portage). This is because I want to keep my system as clean as possible, removing all ...
4
votes
1answer
60 views
find . -size -1GB in Centos
In Centos, I have a text file in my home directory.
The command find . -size -1M doesn't show my file but find . -size -1000k does show it. This problem just seems to be happening when I use the ...
4
votes
4answers
124 views
Executing user defined function in a find -exec call
I'm on Solaris 10 and I have tested the following with ksh (88), bash (3.00) and zsh (4.2.1).
The following code doesn't yield any result:
function foo {
echo "Hello World"
}
find somedir -exec ...
10
votes
3answers
179 views
How to combine 2 -name conditions in find?
I would like to search for files that would not match 2 -name conditions. I can do it like so :
find /media/d/ -type f -size +50M ! -name "*deb" ! -name "*vmdk"
and this will yield proper result ...
0
votes
1answer
38 views
Finding files created 1 hour before or after a particular file [closed]
Possible Duplicate:
How to list files that were changed in a certain range of time?
Finding files created 1 hour before or 1 hour after a particular file (for example fileX) has been ...
2
votes
1answer
54 views
How to find files compared to the time of a specific file
How can I search for files that were modified or changed 5 minutes before and 5 minutes after, a certain file. I have tried
mint@mint ~/Desktop $ touch -t 201210101315 /tmp/timestamp
mint@mint ...
1
vote
4answers
60 views
Syntax error in a bash script that calls find
Where is the error in this script please:
#!/bin/bash
rep="git"
files=`find' ${rep} '-type f`
for f in ${files} do
echo $f
done
When i run find git -type f alone in the shell, it works!
3
votes
5answers
132 views
How do I perform an action on all files with a specific extension in subfolders in an elegant way?
My current best bet is:
for i in $(find . -name *.jpg); do echo $i; done
Problem: does not handle spaces in filenames.
Note: I would also love a graphical way of doing this, such as the "tree" ...
2
votes
2answers
69 views
How can I enhance the output of find and grep?
I really don't look forward to having to do find/grep because the output, as returned by
find . -exec grep sometext {} \; -print
is just not very easy to read even when you dump it in a file. What ...
3
votes
2answers
67 views
List files created on Sundays
How do I list/find all the files created on Sundays or Mondays?
How do I use the date parameter to display them?
Something like :
ls -f date + %a
or
find -type f | date +%A
or
find -type f ...