Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Recently I have seen one issue with a cache problem. The problem comes with broken hash and that could be fixed with

sudo rm -rf /var/lib/apt/lists/*

and

sudo rm /var/lib/apt/lists/* -vf

But I am not understanding the difference between these two. Can somebody explain the difference?

share|improve this question
1  
As noted in the answers, these are 3 separate arguments, r, v, and f. But not noted in the answers is that they can also be combined in different ways: -rv (what I usually use) and -rvf when you need all three. –  Izkata Sep 18 '12 at 19:46
add comment

2 Answers

up vote 8 down vote accepted

from the man Page:

-r, -R, --recursive

remove directories and their contents recursively i.e. Folders inside them will be removed also.

-v, --verbose

explain what is being done or show what is happening.

For the -f

-f, --force ignore nonexistent files, never prompt

You will not be promoted whether to remove the file or not. In other words: You will not be asked this question "Do you want to remove the files? Yes or No"

share|improve this answer
add comment

-rf:

  • The -r argument stands for "recursive." It will remove what you ask, as well as all files and directories underneath it.
  • The -f argument stands for "force." It will ignore nonexistent files and never prompt.

-vf:

  • The -f again stands for "force."
  • The -v argument stands for "verbose." It will print all items it deletes.

The biggest difference is this: -rf will remove all files and directories under the location you asked for, and print nothing. -vf will NOT remove non-empty directories and print everything it does delete.

Note that this information comes from the man page:

$ man rm
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.