Tag Info

Hot answers tagged

25

Bad Things ® ™. It's (almost) the equivalent of sudo rm -rf / - it will, as root, find all files or directories starting from / and recursively descending from there, and then execute the rm command against each file/directory it finds. It won't actually delete directory entries as there's no -f or -r options passed to rm, but it will remove all ...


7

Don't run it. This will find everything (all files, directories, links, sockets etc) under / i.e. everything in the system and then it will try to remove those one at a time with rm. Note that as there is no -r option with rm, only the directory entries will not be removed, everything else will be gone.


3

Simple! This command will remove all files in your server. Don't run it!


3

It should be more like: find /home/backup/VBtest/ -name '*.sql.gz' -mtime +5 # -exec rm {} \; (remove the # from the exec part if this gives the correct results) This will scan the whole directory tree. /home/backup/VBtest/*.sql.gz by itself would get expanded by the shell (almost equivalent to the above find command with -maxdepth 1) as you can learn ...


2

From find's man page: Numeric arguments can be specified as +n for greater than n, -n for less than n, n for exactly n. -mtime n File's data was last modified n*24 hours ago. See the comments for -atime to understand how rounding affects the interpretation of file modification times. ...


2

From man find +n for greater than n, -n for less than n, n for exactly n. -mtime n File's data was last modified n*24 hours ago. See the comments for -atime to understand how rounding affects the interpretation of file modification times. So the correct line to backup files modified more than 90 days ago, will be $ find /path/to/files ...


2

for exactly 90 it should be -mtim +89


2

-mtime +90 should do the trick.


1

Starting from the premise that you want to search for PATTERN in your files, here are solutions for each of your suggested layouts: Remove the leading pathname component find . -name '*.pb*' -type f -execdir grep -Hn 'PATTERN' {} \; | cut -c3- >tmp.txt more tmp.txt When using execdir the program it references is always called from the target ...


1

I assume, from your description, that you are doing this (I broke it into four lines to avoid horizontal scrolling) >tmp.txt; find . -type f -name "*.pb*" \ -exec grep -Hn pattern "{}" ";" >>tmp.txt; cat tmp.txt | more If you are using Gnu find, you can use -execdir instead of -exec; that will cause the grep command to be executed from ...



Only top voted, non community-wiki answers of a minimum length are eligible