首页 行业资讯 宠物日常 宠物养护 宠物健康 宠物故事

Ubuntu 如何删除资料夹及它的子资料夹和档案

发布网友

我来回答

1个回答

热心网友

ubuntu中删除命令一般使用rm,但是rm误删之后,想恢复比较麻烦,所以今天我们还介绍另外一种删除方法,trash,文件删除是放到回收站,这样误删之后还有挽回的机会。
1.rm命令
最简单最有效最权威的看命令的方法就是看--help,
1.1 --help
Usage: rm [OPTION]... FILE...Remove (unlink) the FILE(s). -f, --force ignore nonexistent files and arguments, never prompt -i prompt before every removal -I prompt once before removing more than three files, or when removing recursively. Less intrusive than -i, while still giving protection against most mistakes --interactive[=WHEN] prompt according to WHEN: never, once (-I), or always (-i). Without WHEN, prompt always --one-file-system when removing a hierarchy recursively, skip any directory that is on a file system different from that of the corresponding command line argument --no-preserve-root do not treat '/' specially --preserve-root do not remove '/' (default) -r, -R, --recursive remove directories and their contents recursively -d, --dir remove empty directories -v, --verbose explain what is being done --help display this help and exit --version output version information and exitBy default, rm does not remove directories. Use the --recursive (-r or -R)option to remove each listed directory, too, along with all of its contents.To remove a file whose name starts with a '-', for example '-foo',use one of these commands: rm -- -foo rm ./-fooNote that if you use rm to remove a file, it might be possible to recoversome of its contents, given sufficient expertise and/or time. For greaterassurance that the contents are truly unrecoverable, consider using shred.
简单的翻译一下:
使用方法:rm [选项].. 文件..
删除(unlink)文件
-f,--force 强制删除文件,无论文件是否存在,都不会提示确认 (和-i的作用刚好相反)
-i 在删除文件前给确认提示
-I 比-i提示的要少,只当文件多于3个或者删除有递归的文件的时候才提示,但也能阻止很多错误。
--interactive[=WHEN] 根据WHEN来决定提示:never,once(-I)或者always(-i)。如果没有WHEN,默认为always。
--one-file-system 递归删除一个层级时,跳过所有不符合命令行参数的文件系统上的文件 (这个我暂时还不懂)
--no-preserve-root 不特殊对待'/'

--preserve-root 不去删除'/'
-r,-R,--recursive 删除文件夹以及它下面递归的文件
-d,--dir 删除空文件夹
-v,--verbose 详细解释每一步删除
--help 显示帮助,并退出
--version 输出版本信息
默认,rm不会删除文件夹。使用--recursive(-r or -R)选项去删除文件夹以及它下面的目录文件
删除一个文件,例如删除-foo,可以使用rm如下
rm -- -foo
rm ./-foo

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com