When you use -exec rm -rf {} \; , the rm command is executed for each file (making it slower) .
and when you use -exec rm -rf {} + , the rm command is executed once in a while (although the frequency of rm execution is not mentioned in man page).
This is basically correct. Notice that you can delete several files at once because rm takes not a single file name but a file list as an argument. Suppose you have 4 files, "a", "b", "c" and "d" you could use:
and have them deleted in one call of rm. This is why a call like
works: the shell will expand "*" to such a list of files prior to even call rm and it will happily take it.
On the other hand, command lines have a limited length and the aforementioned "*" might make the command fail once there are too many file names it expands to. Furthermore, every command can only take so many arguments. You may want to try this (in a non-destructive way): execute
in the directory with the 1.6 million files of yours you will perhaps see either a "command line too long" or a "too many arguments" error. The same would happen with rm for the same reason.
So this is why creating such a list by find and then feed it to a program (regardless of this program being rm or something else) is a bad idea. This is why the command xargs was developed and for the same reason there is the "+" device in find. Both these are designed to cut a big, unmanageable list into smaller pieces and feed these pieces to a program, one at a time.
I read the description of the less command and I'm puzzled that it says you can go backwards while using more(1). I created a large file and when I run the more command on it I can move forward with the spacebar and move backward with the letter 'b'. Granted, the less command has more command... (2 Replies)
Hi,
Is it possible to display a specific number of lines starting from a line having a particular text using grep command?
e.g. I have a text file with the contents below:
AAA
BBB
CCC
DDD
EEE
FFF
I want to display 3 lines starting with the line having "BBB" to get the result below:... (11 Replies)
Hi, can anyone answer the following questions?
1.How do you check for particular exception in a growing log file?
2.How do you terminate a long running process? What if there are multiple instances running?
Thanks
James (1 Reply)
Last week I was helped in finding certain filenames and removing them using the following command and it worked fine.
find /path/to/files -name 'WQ*' -type f -exec rm -f {} \;
This week, I need to find certain characters within a certain file. For example, I need to find scripts that... (2 Replies)
I'm using the "wget" command to get the date from Yahoo.com. So this is what I use on Solaris:
/usr/sfw/bin/wget --timeout=3 -S Yahoo!
This works well when my computer is linked to the Net. But when it's not, this command just hangs. I thought putting the timemout = 3 will make this... (2 Replies)
hi all,
My aim is to encrypt a file using 'crypt' command.
Which is the package I need to install to get this command work? (because it says, crypt: command not found )
I'm working on a NetBSD 3.1 machine..
please help (1 Reply)
find $HOME \ ( \( -name ´*.bak´ -ctime +20 \) -o \ \( -size 0 -user kurs00 \) \) -exec rm -i {} \; -print
this is the syntax, i know what -name, -ctime and so on means, but i don't know what the -o or the \\ or the () or the {} mean.
Can someone please explain?
I searched the internet, I... (4 Replies)