Dir gone - how to get it back?

rikona rikona at sonic.net
Fri May 17 05:59:16 UTC 2013


Hello tv,

Thursday, May 16, 2013, 12:04:34 AM, tv wrote:

> On 16/05/2013 03:45, rikona wrote:
>> Wednesday, May 15, 2013, 4:40:35 PM, tv wrote:
>> 
>> [trim]
>> 
>>> You could play with find like this:
>> 
>>> find ~ -size +0k -type f -print0 | xargs -0 sha1sum 2> /dev/null >
>>> SomeName.txt
>> 
>> Thanks. I'll have to think that through to understand what it does.
>> I'm not really a CLI person, but I'm slowly learning, bit by bit, as
>> it is needed for stuff like this.

> I can only commend you for that, never run some command grabbed from
> the Internet without actually looking it up, this way you learn and
> stay safe.

Agreed. Also learned that some older suggestions may not work well, or
maybe not at all, now, even if I understand them. I learned that the
hard way... :-)

> Here "find" searches "~" (alias for /home/user directory) for files
> (-type f) of size strictly superior to zero kilobytes (-size +0k). The
> result is processed to handle spaces and weird stuff in file names
> (-print0) and passed-on ("piped" | )to "xargs" which is told to handle
> the output of "-print0" (-0 option) and execute "sha1sum" on it. Errors
> from "sha1sum" (stderr, here called with it's numeric form "2") are sent
to the bit bucket (>> /dev/null) to avoid polluting the results. Finally
> we write the output to a text file (> SomeName.txt).

> "find" is a huge beast, not easy to handle properly but very useful. It
> may be in the top ten of the commands which requires looking up the
> manual every time you need to write something new...
> See webcomic https://xkcd.com/1168/ for another example ;-)

Thanks for the clear explanation!! It's this [ here called with it's
numeric form "2" ] kind of thing that sometimes make things hard to
understand.

Some time ago I remember a contest. A very small section of C code
would be published. The winner was the person who could describe what
it actually did . :-)) So maybe I'm not the only one who has
trouble... 

[trim]

>>[My big problem is remembering *exactly* what I
>> did, 2-3 years from now, when I might have the same situation again.]

> We all have this problem! Use some kind of scrapbook or note-taking
> program to store those useful bits of information which get lost
> over time. Maybe a blog or cloud service can help in case the main
> computer is wrecked.

Yep. I store it as text files, and search it with recoll [a very nice
search pgm], but keep it in semi-sorted dirs. And - I keep a copy on
another box, and if all else fails, as an archive.

Biggest problem is the 'aging' of the info, some of which no longer
works, or may even mess up things.

And many thanks again!! I appreciate the help.

-- 

 rikona        





More information about the ubuntu-users mailing list