In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you "how to recover a deleted file in Linux", the content is simple and easy to understand, organized clearly, I hope to help you solve doubts, let Xiaobian lead you to study and learn "how to recover a deleted file in Linux" this article bar.
Create an alias for deletion as rm -i
When the-i option is used with the rm command (and other file processing commands such as cp or mv), a prompt appears before deleting files.
The same applies when copying, moving, or renaming a file where a file with the same name already exists.
This prompt will give you a second chance to consider whether you really want to delete the file-if you choose OK on this prompt, the file is deleted. In this case, I'm sorry, but this technique doesn't prevent carelessness.
To replace rm with rm -i alias, do this:
alias rm='rm -i'
Running alias confirms that rm is now aliased:
Add alias to rm
However, this only works on the current shell of the current user. In order to *** change, you must save it to ~/.bashrc as shown below (some versions of Linux may be ~/.profile).
*** Adding aliases in Linux
For changes made in ~/.bashrc(or ~/.profile) to take effect immediately, run the file from the current shell:
. ~/.bashrc
Activating aliases in Linux
Forensic Tools-Foremost
Hopefully you are careful with your files and when you want to recover lost files from an external disk or USB device, you just need to use this tool.
However, when you realize you accidentally deleted a file from your system and panic-don't worry. Let's take a look at foremost, a forensic tool used to handle this situation.
To install Foremost in CentOS/RHEL 7, you need to first enable Repoforge:
# rpm -Uvh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm # yum install foremost
However, in Debian and its derivatives, you need to do this:
# aptitude install foremost
After installation, let's do a simple test. First delete an image file named nosdos.jpg from the/boot/images directory:
# cd images # rm nosdos.jpg
To recover this file, use forehost as shown below (first identify the partition-in this case,/boot is located in the/dev/sda1 partition).
# foremost -t jpg -i /dev/sda1 -o /home/gacanepa/rescued
Where/home/gacanepa/rescued is a directory on another disk-remember, it's not wise to restore files to the disk where they were deleted.
If the disk partition where the deleted file was located is occupied during the recovery process, it may not be possible to recover the file. Also, do not do anything else until the file recovery operation is performed.
When foremost is complete, the recovered files (if recoverable) will be found in the directory·/home/gacanepa/rescue/jpg`.
The above is "How to recover a deleted file in Linux" all the content of this article, thank you for reading! I believe that everyone has a certain understanding, hope to share the content to help everyone, if you still want to learn more knowledge, welcome to pay attention to the industry information channel!
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.