restore the contents of a deleted file for which a descriptor is still available

N="filepath" ; P=/proc/$(lsof +L1 | grep "$N" | awk '{print $2}')/fd ; ls -l $P | sed -rn "/$N/s/.*([0-9]+) ->.*/\1/p" | xargs -I_ cat $P/_ > "$N"
Note that the file at the given path will have the contents of the (still) deleted file, but it is a new file with a new node number; in other words, this restores the data, but it does not actually "undelete" the old file. I posted a function declaration encapsulating this functionality to http://www.reddit.com/r/programming/comments/7yx6f/how_to_undelete_any_open_deleted_file_in_linux/c07sqwe (please excuse the crap formatting).

5
By: laburu
2009-02-21 02:31:24

What Others Think

Wow, excellent post. I'd like to draft like this too - taking time and real hard work to make a great article. This post has encouraged me to write some posts that I am going to write soon. ?????
KayGasaway · 31 weeks and 1 day ago
I really thank you for the valuable info on this great subject and look forward to more great posts. Thanks a lot for enjoying this beauty article with me. I am appreciating it very much! Looking forward to another great article. Good luck to the author! All the best! chute roto closer
KayGasaway · 30 weeks and 6 days ago
I think this is an informative post and it is very useful and knowledgeable. therefore, I would like to thank you for the efforts you have made in writing this article. ?????
KayGasaway · 30 weeks and 2 days ago
Kampala International University is a leading international private university in Uganda offering world class learning to students around the world. KIU Alumni
goxah55535 · 29 weeks ago
To check KBC Lottery Winner 2022 List WhatsApp or if you want to check KBC lottery number online please visit this KBC official website 2022. KBC WhatsApp Lucky Draw 2022
nakav51247 · 29 weeks ago
Please continue this great work and I look forward to more of your awesome blog posts. ??????
KayGasaway · 26 weeks and 3 days ago
If you are looking for most powerful backlinks for your website then you are on right place : 100 Unique Domain
nakav51247 · 26 weeks ago
Nice blog, I will keep visiting this blog very often. Nft opensea
KayGasaway · 25 weeks and 3 days ago
Theatmangroup is an online news company focused on covering the most important business and breaking news in US and around the globe. 500 toothed dinosaur
Audrey10 · 25 weeks and 1 day ago
It's a very good guide, Bless you designed for issuing all of us this post. Continue advertisment. http://mehfeel.net/mehfeel/blogs/post/322629">Sunset cruise muscat
nakav51247 · 24 weeks and 1 day ago
This is a lot of information to take in, but I am enjoying the thought process. I really am impressed with your article. Thank you. Porto Attractions tickets offers
fomajob · 23 weeks and 6 days ago
You there, this is really good post here. Thanks for taking the time to post such valuable information. Quality content is what always gets the visitors coming. spy phone app install
Audrey10 · 22 weeks ago
I’ve been surfing online more than three hours today, yet I never found any interesting article like yours. It’s pretty worth enough for me. In my opinion, if all webmasters and bloggers made good content as you did, the web will be a lot more useful than ever before. snowmobile storage box
Audrey10 · 20 weeks and 6 days ago
The website is looking bit flashy and it catches the visitors eyes. Design is pretty simple and a good user friendly interface. kanom456 pg
Audrey10 · 19 weeks ago
That is the excellent mindset, nonetheless is just not help to make every sence whatsoever preaching about that mather. Virtually any method many thanks in addition to i had endeavor to promote your own article in to delicius nevertheless it is apparently a dilemma using your information sites can you please recheck the idea. thanks once more. http://stmatthieuciteverte.com/ideal-laptop-brand/">this website
Audrey10 · 17 weeks and 5 days ago
This is a smart blog. I mean it. You have so much knowledge about this issue, and so much passion. You also know how to make people rally behind it, obviously from the responses. Sbobet m
Audrey10 · 16 weeks and 6 days ago
To check KBC Lottery Winner 2022 List WhatsApp or if you want to check KBC lottery number online please visit this KBC official website 2022. KBC WhatsApp Lucky Draw 2022 KBC Lottery Number Check KBC Lottery Number Check Online 2022
kbcwinner11 · 16 weeks and 6 days ago
Our Affiliate Programs is FREE to Join and requires no special knowledge!.We’ll supply you with a range of banners to put on your website. Let us know what kind of commission type you want, and we’ll send you a percentage of the money we make from your link. It’s as simple as that. https://onohosting.com/
nakav51247 · 14 weeks and 6 days ago
So if the whole Rashard Lewis thing is true, then God must really hate LeBron James.|Only_Lightning| simply buzzes
STEPHEN007 · 12 weeks and 3 days ago
Pug Puppies for Sale Near Me pugs puppies for sale teacup pugs for sale pug puppies for sale by owner pug puppies ohio PUG PUPPY FOR SALE NEAR ME PUG PUPPIES FOR SALE pug puppies for sale in kentucky Pug Puppies for Sale Under $500 Near Me pug puppies for sale in texas pug puppies for sale $200 pugs for sale near me under $500 pugs for sale under $400 near me pugs for sale near me puppies for sale near me under $500 pug puppies for sale under $1,000 near me pug for sale pug puppies for sale under $300 Brindle Pug Pitbull Pug Mix Pugs for sale cheap Cheap pug affordable pug puppies for sale near me black pugs for sale near me White Pugs for sale pug dog for sale free pug puppies pug puppies for sale in my area mn pug breeders pug puppies indiana pugs for sale michigan PUG PUPPY ADOPTION Pug puppies for sale Pug puppies for sale near me Pug puppies near me Pug Puppies for Sale Under $500 Near Me Cute Pug Puppies Black pug puppies Black pug puppies for sale pug puppies for adoption black pug puppies for sale near me chihuahua pug mix puppies how much is a pug puppy teacup pug puppies baby pug puppies pictures of pug puppies pug puppies for sale in Ohio pug puppies price pug mix puppies teacup pug puppies for sale best food for pug puppy newborn pug puppies pug puppies craigslist pug puppies for sale craigslist adorable pug puppies how much does a pug puppy cost Pitbull pug mix puppies pug pit mix puppy pug puppies for sale $200 pug puppies for sale in NJ Pug puppies for sale in Wisconsin pug puppy cost pug puppy food royal canin pug puppy royal canin pug puppy food fawn pug puppy pug puppies for sale florida pug puppies for sale in Indiana pug puppies for sale in KY pug puppies for sale in NC pug dog puppy AKC Registered Pug Puppies For sale cheap pug puppies for sale near me cheap pug puppies for sale in California cheap pug puppies for sale in nj Black Pug Puppies for sale pugs puppies for sale
rahimhh21 · 12 weeks ago
And since we're based in Australia, we understand how to effectively develop a cable sizing calculator app that's based on AS/NZS 3000 and AS/NZS 3008. cable sizing calculator
fomajob · 11 weeks and 6 days ago
To check KBC Lottery Winner 2022 List WhatsApp or if you want to check the KBC lottery number online please visit this KBC official website 2022. KBC WhatsApp Lucky Draw 2022 KBC Lottery Number Check [url=https://www.kbclotterywinneronlinecheck.com/]KBC Lottery Winner Check Online 2022[/url]
cassiefox699 · 11 weeks ago
To check KBC Lottery Winner 2022 List WhatsApp or if you want to check the KBC lottery number online please visit this KBC official website 2022. KBC WhatsApp Lucky Draw 2022. KBC Lottery Check Online 2022
cassiefox699 · 11 weeks ago
Since 2008, Perfect House Pug Puppies has been the leading Pug puppy breeder in the US, providing premium Pug puppies for sale. Each puppy exhibits the professionalism and knowledge that have set Perfect House Pug puppies apart from other pug puppy breeders. The professionals at Perfect House Pug Puppies are dedicated about finding their puppies loving, beloved homes where they can enjoy long, healthy lives. A companion that has been produced for quality, health, and temperament that satisfies the breed standard is guaranteed by Perfect House Pug puppies, the pug breeder that has set the benchmark for exceptional customer satisfaction. If you are looking to buy a baby pug, Black and white pugs, Mini pug puppies for sale, Black and tan pug for sale, Teacup pug puppies for sale, Female pug puppies, pug puppies for sale, pug puppies for sale near me, pug puppies for sale under $500 near me. Pug Puppies for Sale Near Me pugs puppies for sale teacup pugs for sale pug puppies for sale by owner pug puppies ohio PUG PUPPY FOR SALE NEAR ME PUG PUPPIES FOR SALE pug puppies for sale in kentucky Pug Puppies for Sale Under $500 Near Me pug puppies for sale in texas pug puppies for sale $200 pugs for sale near me under $500 pugs for sale under $400 near me pugs for sale near me puppies for sale near me under $500 pug puppies for sale under $1,000 near me pug for sale pug puppies for sale under $300 Brindle Pug Pitbull Pug Mix Pugs for sale cheap Cheap pug affordable pug puppies for sale near me black pugs for sale near me White Pugs for sale pug dog for sale free pug puppies pug puppies for sale in my area mn pug breeders pug puppies indiana pugs for sale michigan PUG PUPPY ADOPTION Pug puppies for sale Pug puppies for sale near me Pug puppies near me Pug Puppies for Sale Under $500 Near Me Cute Pug Puppies Black pug puppies Black pug puppies for sale pug puppies for adoption black pug puppies for sale near me chihuahua pug mix puppies how much is a pug puppy teacup pug puppies baby pug puppies baby pug puppies for sale pictures of pug puppies pug puppies for sale in Ohio pug puppies price pug mix puppies teacup pug puppies for sale best food for pug puppy newborn pug puppies pug puppies craigslist pug puppies for sale craigslist adorable pug puppies how much does a pug puppy cost Pitbull pug mix puppies pug pit mix puppy pug puppies for sale $200 pug puppies for sale in NJ Pug puppies for sale in Wisconsin pug puppy cost pug puppy food royal canin pug puppy royal canin pug puppy food fawn pug puppy pug puppies for sale florida pug puppies for sale in Indiana pug puppies for sale in KY pug puppies for sale in NC pug dog puppy AKC Registered Pug Puppies For sale cheap pug puppies for sale near me cheap pug puppies for sale in California cheap pug puppies for sale in nj Black Pug Puppies for sale pugs puppies for sale
Perfecthomepugs · 3 weeks and 6 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: