CentOS 7命令问题 懂Linux大神进怎么删除在tmp命令下的文件,是敲啥命令删除
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOS 7命令问题 懂Linux大神进怎么删除在tmp命令下的文件,是敲啥命令删除相关的知识,希望对你有一定的参考价值。
参考技术A root用户可以强制删除的; rm -rf 文件追问rm无法删除
追答如果看你的图片的话, 那么你图片中的用户根本不是root用户; root用户的标志是# ;
而$是普通用户;
rm无法删除当前文件夹?怎么回事
追答无法删除就是权限不够。
追问那么怎么操作呢
追答方法有
1、使用有权限的帐号删除,比如用root帐号删除;
2、使用有权限的帐号更改文件权限。比如chmod 777 * 可以把当前目录下所有文件权限更改成所有用户都有权限
哦明白了,我知道怎么做了
linux系统误删文件怎么办!使用extundelete恢复数据
一:环境搭建
1.下载http://extundelete.sourceforge.net/
2.安装e2fsprogs和e2fsprogs-libs
yum install e2fsprogs e2fsprogs-libs -y
3.上传文件至linux主机
put C:/Users/CPIC/Desktop/extundelete-0.2.4.tar.bz2
4.安装软件
tar jxvf extundelete-0.2.4.tar.bz2 cd /root/extundelete-0.2.4 ./configure make & make install
报错: (1)configure: error: in `/root/Desktop/extundelete-0.2.4‘: configure: error: C++ compiler cannot create executables 解决:yum install gcc* -y (2)Configuring extundelete 0.2.4 configure: error: Can‘t find ext2fs library 解决:yum install e2fsprogs* -y
二:实验
mkdir /shiyan #创建挂载目录 fdisk /dev/sdb #划分为一个主分区 n-p-1-w mount /dev/sdb1 /shiyan #挂载 cp -a /etc/passwd /shiyan/ #复制文件 cd /shiyan rm -rf passwd #删除文件 umount /shiyan #卸载文件系统 [[email protected] /]# extundelete /dev/sdb1 --inode 2 #查看inode信息,重要!! NOTICE: Extended attributes are not restored. Loading filesystem metadata ... 8 groups loaded. Group: 0 Contents of inode 2: 0000 | ed 41 00 00 00 10 00 00 7c 8f ed 59 77 8f ed 59 | .A......|..Yw..Y 0010 | 77 8f ed 59 00 00 00 00 00 00 02 00 08 00 00 00 | w..Y............ 0020 | 00 00 00 00 03 00 00 00 49 00 00 00 00 00 00 00 | ........I....... 0030 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................ 0040 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................ 0050 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................ 0060 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................ 0070 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................ 0080 | 1c 00 00 00 00 19 23 02 00 19 23 02 dc ff 9c b1 | ......#...#..... 0090 | 33 8f ed 59 00 00 00 00 00 00 00 00 00 00 00 00 | 3..Y............ 00a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................ 00b0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................ 00c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................ 00d0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................ 00e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................ 00f0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................ Inode is Allocated File mode: 16877 Low 16 bits of Owner Uid: 0 Size in bytes: 4096 Access time: 1508740988 Creation time: 1508740983 Modification time: 1508740983 Deletion Time: 0 Low 16 bits of Group Id: 0 Links count: 2 Blocks count: 8 File flags: 0 File version (for NFS): 0 File ACL: 0 Directory ACL: 0 Fragment address: 0 Direct blocks: 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 Indirect block: 0 Double indirect block: 0 Triple indirect block: 0 File name | Inode number | Deleted status . 2 .. 2 lost+found 11 Deleted passwd 12 Deleted
恢复单个文件:extundelete /dev/sdb1 --restore-file 原来文件存储的相对路径
原来文件的存储路径为/data/passwd ,那么参数后面直接指定passwd;如果原来的文件路径为/data/test/passwd,那么参数后面test/passwd.
恢复单个目录:extundelete /dev/sdb1 --restore-directory /aaa
原来存储目录路径为: /data/aaa
恢复所有删除的数据:extundelete /dev/sdb1 --restore-all
最后在当前目录下的RECOVERED_FILES目录中找到误删的文件。
注意:删除的第一时间要卸载文件系统。
本文出自 “独上高楼,望尽天涯路” 博客,请务必保留此出处http://nxyboy.blog.51cto.com/10511646/1975244
以上是关于CentOS 7命令问题 懂Linux大神进怎么删除在tmp命令下的文件,是敲啥命令删除的主要内容,如果未能解决你的问题,请参考以下文章
懂Linux 进,CentOS7.3设置定时重启的命令是啥??
Linux系统:第十三章:centos误删文件如何恢复文件数据