rm -rf 命令带来的恶梦 修改rm命令;让rm 命令删除的文件到回收站
2014-12-14 21:39
381 查看
今天,哎,悲剧的一天。。。。。上午在linux下删除火狐浏览器的时候,用错了命令我想把/usr/目录下面的带mozilla的文件都删除掉,结果用这个命令rm -rf mozilla *意思就是执行了rm -rf mozilla 然后又执行了rm -rf * 所以我的/usr/啥都没了,所以回到解放前了,我查了一下网上关于通过rm -rf误删除的文件进行恢复的方法,发现我现在因为/usr目录下面的文件全部删除。所以全不能恢复的可能性不大了,只好重装系统.并且等我吃饭回来的时候连系统文件也进不去了,只好通过ext2explore
软件,在windows下把Linux系统中的主文件里面的东西都copy到windows的桌面上。
简单说一下重装系统的艰苦过程:
1 听一哥们说,装ubuntu14.04的,然后通过在计算机-管理-然后再磁盘管理里面,选择到F盘右键,然后压缩,我弄出了大概40GB的空间给了LINUX.。弄完后就用那个u盘开始装。发现装完之后,这个版本的输入法非常的垃圾,不适用,就开始自己各种折腾。大概折腾了有3、4个小时还是没有把输入法折腾好。我估计是在我安装的时候没有联网的原因,最好可以联网。
2 怎么办呢,继续装呗。然后自己在网上找了个下ubuntu 12.04 32位版本
mirrors.163.com/ubuntu-releases/precise/ubuntu-12.04.5-desktop-i386.iso
安装完后,然后用ultaral iso软件把iso刻录到U盘里面,然后又重新装,电脑启动的时候 狂按del键,然后再按F12,然后选择USB,直接覆盖安装就OK了。这个版本就可以啊,。输入法是正常的。
再说一下,修改rm命令,让rm删除http://0x55aa.sinaapp.com/linux/1156.htmlhttp://www.cnblogs.com/jtf-china/archive/2011/05/27/2059872.html
1 Install trash-cli
2. Set up the script
In Ubuntu enter this in a terminal:
注意:12.04以上的版本,把最后一行的trash换成trash-put。
执行权限
3. Create an alias for "rm" to use "trash-rm"
In Ubuntu, run this in a terminal:
and enter this at the end of the file:
and save it.
Then reload bashrc by running the following command in a terminal:
That's it! Now try it out by deleting files the way you always do, using "rm" and "rm -r".
Final trash-cli tips
Since you've installed the trash-cli utility, now you can use the following commands for manipulating the trash from the command line (the names are self explanatory):
Update: to get this to work for "sudo rm" as well, copy
wilo108's sudo wrapper in your ~/.bashrc file. Without it, this will not work when "rm" is used with "sudo"!
软件,在windows下把Linux系统中的主文件里面的东西都copy到windows的桌面上。
简单说一下重装系统的艰苦过程:
1 听一哥们说,装ubuntu14.04的,然后通过在计算机-管理-然后再磁盘管理里面,选择到F盘右键,然后压缩,我弄出了大概40GB的空间给了LINUX.。弄完后就用那个u盘开始装。发现装完之后,这个版本的输入法非常的垃圾,不适用,就开始自己各种折腾。大概折腾了有3、4个小时还是没有把输入法折腾好。我估计是在我安装的时候没有联网的原因,最好可以联网。
2 怎么办呢,继续装呗。然后自己在网上找了个下ubuntu 12.04 32位版本
mirrors.163.com/ubuntu-releases/precise/ubuntu-12.04.5-desktop-i386.iso
安装完后,然后用ultaral iso软件把iso刻录到U盘里面,然后又重新装,电脑启动的时候 狂按del键,然后再按F12,然后选择USB,直接覆盖安装就OK了。这个版本就可以啊,。输入法是正常的。
再说一下,修改rm命令,让rm删除http://0x55aa.sinaapp.com/linux/1156.htmlhttp://www.cnblogs.com/jtf-china/archive/2011/05/27/2059872.html
1 Install trash-cli
In Ubuntu enter this in a terminal:
#!/bin/bash # command name: trash-rm shopt -s extglob recursive=1 declare -a cmd ((i = 0)) for f in "$@" do case "$f" in (-*([fiIv])r*([fiIv])|-*([fiIv])R*([fiIv])) tmp="${f//[rR]/}" if [ -n "$tmp" ] then #echo "\$tmp == $tmp" cmd[$i]="$tmp" ((i++)) fi recursive=0 ;; (--recursive) recursive=0 ;; (*) if [ $recursive != 0 -a -d "$f" ] then echo "skipping directory: $f" continue else cmd[$i]="$f" ((i++)) fi ;; esac done trash "${cmd[@]}"
注意:12.04以上的版本,把最后一行的trash换成trash-put。
执行权限
In Ubuntu, run this in a terminal:
Then reload bashrc by running the following command in a terminal:
Final trash-cli tips
Since you've installed the trash-cli utility, now you can use the following commands for manipulating the trash from the command line (the names are self explanatory):
wilo108's sudo wrapper in your ~/.bashrc file. Without it, this will not work when "rm" is used with "sudo"!
相关文章推荐
- 修改rm命令为移动文件到回收站
- Linux 终端命令 rm 删除的文件进入回收站实现方法
- 删除文件到回收站rm命令
- Linux 终端命令 rm 删除的文件进入回收站实现方法
- ubuntu 修该rm命令使删除文件到回收站
- Linux使用命令rm -rf 删除文件后的恢复
- liunx系统 自己制作一个回收站,rm -rf 命令执行后 文件难恢复问题
- [小技巧] 将 rm 命令删除的文件放在回收站
- linux下如何恢复rm命令删除的文件
- Ext2文件系统如何恢复RM命令删除文件
- 用ext3grep恢复rm -rf 误删除的文件
- linux ext3 ext4文件系统下 恢复 rm -rf 误删除文件
- Ubuntu_Ubuntu/linux 下删除文件命令 RM
- mkdir命令(建立一个目录) rmdir命令(删除一个目录) rm命令(删除文件)
- 将linux下的rm命令改造成移动文件至回收站
- 使用testdisk恢复误删文件【rm -rf 命令】
- linux下如何恢复rm命令删除的文件
- linux下rm命令删除文件名中包含特殊字符的文件(包括乱码文件名)
- 用 find 命令结合 rm 命令删除大量文件
- 将rm删除的文件,放到回收站