LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-27-2015, 10:50 PM   #1
rblampain
Senior Member
 
Registered: Aug 2004
Location: Western Australia
Distribution: Debian 11
Posts: 1,288

Rep: Reputation: 52
find with hexedit


I accidentally deleted a directory, most files that were modified since the last backup have been recovered using "foremost" but there are about 4 to 6 files "foremost" or "scalpel" did not find including one that was just created (no backup), I'd like to recover them if there is any chance, they are all text files in an ext4 partition and I know specific words used in the file that has no backup. I have also copied (with dd) the entire 5G partition to a file (called devsda9) in a larger partition with the same file system.

It seems I could recover with "hexedit", I had a look at the man page but it is too complex to learn, I have never used it and normally have no use for that sort of software.

My question is: can I search the file "devsda9" (which is itself a collection of files) with "hexedit" in a way that it stops when a given string is found so that the surrounding text is visible and can be copied and if it is not the wanted text, continue till the next occurence of the string?

If so, could someone give me the exact command to do this? Again, I have no need to learn this software.

There may also be a more suitable program but I am completely ignorant of what could be used.

Thank you for your help.
 
Old 05-27-2015, 11:11 PM   #2
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
The KDE hex editor - Okteta is very good for this. Though it's a X GUI program.
 
1 members found this post helpful.
Old 05-28-2015, 04:22 AM   #3
millgates
Member
 
Registered: Feb 2009
Location: 192.168.x.x
Distribution: Slackware
Posts: 852

Rep: Reputation: 389Reputation: 389Reputation: 389Reputation: 389
In the terminal you can use dhex.
Another possibility would be to use strings and grep.
 
1 members found this post helpful.
Old 05-28-2015, 09:44 AM   #4
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Have you just tried PhotoRec?
 
1 members found this post helpful.
Old 05-30-2015, 09:27 PM   #5
rblampain
Senior Member
 
Registered: Aug 2004
Location: Western Australia
Distribution: Debian 11
Posts: 1,288

Original Poster
Rep: Reputation: 52
Thank you all for your answers.

Using hexedit is one of those things you find are extremely simple when you try the only problem was it's too slow for that sort of work (inspecting a 5GB file one byte at a time), looking for a single string was still showing no result after 20 minutes of disk activity so I had to abandon the idea. I also found the file with no backup was not in the directory deleted after all which contributed to my decision.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Old School -- gdbmtool & dbmutil -- can't find RPMs and can't find Source spudzy Linux - Software 3 09-27-2014 06:29 AM
Hexedit - Slackware installation - C compiler cannot create executables vanqyard Slackware - Installation 3 04-28-2014 06:27 PM
[SOLVED] Bash Issue with Find Script: find paths must precede expression: *.txt JockVSJock Programming 4 01-06-2014 09:03 PM
[SOLVED] Find URL in Debian package index via awk/sed (=find a line, then search from there) maddes.b Linux - Software 11 06-28-2013 07:37 AM
linux hexedit layout trying to understand deleted07 Linux - Newbie 3 01-18-2013 06:45 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:41 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration