Under Linux, sometimes we only want to keep one file in a certain file, and want to delete the rest. How can we do it quickly?
For example, the following one.
Delete all files in the current directory, but keep the file kahn.bak
ls |grep -v 'kahn.bak' |xargs rm -rf