In Unix, how do you remove everything in the current directory and below it?

前端 未结 10 1963
庸人自扰
庸人自扰 2021-01-29 21:57

I know this will delete everything in a subdirectory and below it:

rm -rf 

But how do you delete everything in the current d

10条回答
  •  深忆病人
    2021-01-29 22:28

    Use

    rm -rf *
    

    Update: The . stands for current directory, but we cannot use this. The command seems to have explicit checks for . and ... Use the wildcard globbing instead. But this can be risky.

    A safer version IMO is to use:

    rm -ri * 
    

    (this prompts you for confirmation before deleting every file/directory.)

提交回复
热议问题