In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to use grep to recover deleted text files in linux", the explanation in the article is simple and clear, easy to learn and understand, please follow the ideas of Xiaobian slowly, together to study and learn "how to use grep to recover deleted text files in linux"!
First create a temporary text file vpsee.log for testing, and then delete this file:
$ echo "important log file for vpsee.com" > vpsee.log
$ cat vpsee.log
important log file for vpsee.com
$ rm vpsee.log If you can remember a keyword in the file you just deleted, you can use grep to search the entire/dev/sda1, the-a flag means to treat the partition/dev/sda1 as text (the partition itself is binary), and the-B 10 -A 100 means to print the first 10 and last 100 lines of the keyword if you find it:
# grep -a -B 10 -A 100 'vpsee.com' /dev/sda1 > tmp.txt Find what we just deleted among the @:
$ vi tmp.txt
...
@$^@^@^@^@^@^@^@^@^@^@^@^A^@^@^@^@^@^@^@Ç^@^@^@^A^@^@^@^@^@^@^@^@^@^@^@È^K^@^@^@
^@^@^@^@^@^@^@^@^@^@^@^A^@^@^@^@^@^@^@^Q^@^@^@^C^@^@^@^@^@^@^@^@^@^@^@È^K^@^@×^@
^@^@important log file for vpsee.com
@
@
... Of course, if you delete binary, doc, png/jpg/gif files by mistake, you can use some third-party ext2/ext3 file recovery tools to help recover files, such as TestDisk, PhotoRec, etc.
Thank you for reading, the above is "linux how to use grep to recover deleted text files" content, after the study of this article, I believe that everyone on linux how to use grep to recover deleted text files this problem has a deeper understanding, the specific use of the situation also needs to be verified by practice. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.