背景:删除文件时吧 /root/ 里面的文件删除了.过程如下:
[root@localhost x86_64]# ll
total 534136
-rwxr-xr-x 1 www www 6227876 May 4 13:45 amoeba-2.1.0-160504134426.el6.x86_64.rpm
-rwxr-xr-x 1 www www 149892 Apr 26 18:11 apcu-php56-4.0.11-160426181109.el6.x86_64.rpm
-rwxr-xr-x 1 www www 114160 May 5 11:12 apcu-php70-5.1.3-160505111247.el6.x86_64.rpm
-rwxr-xr-x 1 www www 25338712 May 27 15:40 berkeleydb-6.2.23-160527153833.el6.x86_64.rpm
-rwxr-xr-x 1 www www 27203008 Jun 23 14:57 elasticsearch-2.3.3-160623145745.el6.noarch.rpm
drwx------ 3 root root 4096 Jul 15 15:20 $HOME
rm -Rf '$HOME'
[root@localhost x86_64]# rm -Rf $HOME
[root@localhost x86_64]# echo $HOME
/root
[root@localhost /]# ls /root
ls: cannot access /root: No such file or directory
cd /data/www/yum/centos/7/x86_64
rm -Rf usr
rm -Rf lib
rm -Rf lib64
rm -Rf boot
rm -Rf data
rm -Rf dev
rm -Rf etc
rm -Rf home
rm -Rf '$HOME'
rm -Rf lost+found
rm -Rf media
rm -Rf mnt
rm -Rf opt
rm -Rf proc
rm -Rf repodata
rm -Rf root
rm -Rf root_901
rm -Rf run
rm -Rf sbin
rm -Rf srv
rm -Rf sys
rm -Rf tmp
rm -Rf usr
rm -Rf zabbix
rm -rf bin
rm -Rf selinux software var
rm -Rf lamp
rm -Rf scp.sh screenquit.sh temp.retry web.retry mysql.retry mountIrdcBackUp.sh irdcops.retry install.sh install.log.syslog install.log id_rsa debug.retry crontab_ntpdate anaconda-ks.cfg monitor.sh
rm -Rf a getip
============================================================
解决办法:
.mkdir /root
cp -a /etc/skel/.[!.]* /root
主要是吧 /etc/skel/里面的文件拷贝回去就行了~~~哈..
cp -r /etc/skel/.bash
.bash_logout .bash_profile .bashrc
法一:
cp -a /etc/skel/.[!.]* /root
chown -R root /root
chmod -R 700 /root
法二:从别的linux上拷贝一个root过来,后面删除时注意一下:
带你飞(39345****) 11:37:21
@回忆未来-向东-Jàck rm '$HOME'
加个引号就行了
参考:http://blog.csdn.net/wlqf366/article/details/50081389
[root@localhost x86_64]# ll
total 534136
-rwxr-xr-x 1 www www 6227876 May 4 13:45 amoeba-2.1.0-160504134426.el6.x86_64.rpm
-rwxr-xr-x 1 www www 149892 Apr 26 18:11 apcu-php56-4.0.11-160426181109.el6.x86_64.rpm
-rwxr-xr-x 1 www www 114160 May 5 11:12 apcu-php70-5.1.3-160505111247.el6.x86_64.rpm
-rwxr-xr-x 1 www www 25338712 May 27 15:40 berkeleydb-6.2.23-160527153833.el6.x86_64.rpm
-rwxr-xr-x 1 www www 27203008 Jun 23 14:57 elasticsearch-2.3.3-160623145745.el6.noarch.rpm
drwx------ 3 root root 4096 Jul 15 15:20 $HOME
rm -Rf '$HOME'
[root@localhost x86_64]# rm -Rf $HOME
[root@localhost x86_64]# echo $HOME
/root
[root@localhost /]# ls /root
ls: cannot access /root: No such file or directory
cd /data/www/yum/centos/7/x86_64
rm -Rf usr
rm -Rf lib
rm -Rf lib64
rm -Rf boot
rm -Rf data
rm -Rf dev
rm -Rf etc
rm -Rf home
rm -Rf '$HOME'
rm -Rf lost+found
rm -Rf media
rm -Rf mnt
rm -Rf opt
rm -Rf proc
rm -Rf repodata
rm -Rf root
rm -Rf root_901
rm -Rf run
rm -Rf sbin
rm -Rf srv
rm -Rf sys
rm -Rf tmp
rm -Rf usr
rm -Rf zabbix
rm -rf bin
rm -Rf selinux software var
rm -Rf lamp
rm -Rf scp.sh screenquit.sh temp.retry web.retry mysql.retry mountIrdcBackUp.sh irdcops.retry install.sh install.log.syslog install.log id_rsa debug.retry crontab_ntpdate anaconda-ks.cfg monitor.sh
rm -Rf a getip
============================================================
解决办法:
.mkdir /root
cp -a /etc/skel/.[!.]* /root
主要是吧 /etc/skel/里面的文件拷贝回去就行了~~~哈..
cp -r /etc/skel/.bash
.bash_logout .bash_profile .bashrc
法一:
cp -a /etc/skel/.[!.]* /root
chown -R root /root
chmod -R 700 /root
法二:从别的linux上拷贝一个root过来,后面删除时注意一下:
带你飞(39345****) 11:37:21
@回忆未来-向东-Jàck rm '$HOME'
加个引号就行了
参考:http://blog.csdn.net/wlqf366/article/details/50081389
作者:jackxiang@向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除
地址:https://jackxiang.com/post/8832/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!
最后编辑: jackxiang 编辑于2016-9-6 21:58
评论列表