Home > Net >  remove with verbose option
remove with verbose option

Time:02-24

I've following directory structure,

test/{test00.txt..test99.txt}

If I use rm -v -rf test,

rm -v -rf test

removed 'test/test00.txt' 
removed 'test/test01.txt' 
removed 'test/test02.txt' 
removed 'test/test03.txt' 
removed 'test/test04.txt'
removed 'test/test05.txt' 
removed 'test/test06.txt' 
.... 
removed 'test/test96.txt' 
removed 'test/test97.txt' 
removed 'test/test98.txt'
removed 'test/test99.txt' 
removed directory: 'test'

Is there a way to hide all the verbose output generated from below test folder?

CodePudding user response:

Try something like

rm -v -rf test | grep -v 'test/test'

Explanation

rm -v -rf output is followed by | to grep, which by inverse selection (-v switch) deletes everything, what it matches.

CodePudding user response:

Maybe, you just want to disable verbose mode so no non-error output is given back by rm.

To do so, just delete switch -.

Your command will become

rm -rf test
  • Related