Re: [Trisquel-users] Just lost every important files in my Trisquel Linux!!!! Very serious!

2016-09-24 Thread energy . d

One thing you could do to prevent such accidental data loss
in the future is changing the default behaviour of the rm command for example  
with aliases.


This is what i have in my /etc/bash.bashrc to do this job:

 alias rm='rm -div'
alias rrm='\rm -IRv'

 alias mv='mv -iv'

 alias cp='cp -iv'
alias cpr='cp -r'

I've never had any problems with these.
There is also to mention the package safe-rm in the repository, but i never  
tried it.
Take a look at the info or man pages of rm, mv and cp to see what exactly all  
these options do.


Re: [Trisquel-users] Just lost every important files in my Trisquel Linux!!!! Very serious!

2016-09-22 Thread dguthrie

yay! please stay
join irc for stuff like this and talk to us on #trisquel, #fsf, and #gnu on  
freenode :-)


Re: [Trisquel-users] Just lost every important files in my Trisquel Linux!!!! Very serious!

2016-09-22 Thread mkl80

Thanks I will continue to make questions if there are any. Abracao


Re: [Trisquel-users] Just lost every important files in my Trisquel Linux!!!! Very serious!

2016-09-22 Thread Adonay Felipe Nogueira
Don't worry mate, I accept your apologies.

I'm glad that you didn't insist on calling me like that again and again
(I know some people that are really difficult to deal with because of
this).

We all know that humans experience pressure due to external factors, and
everyone reacts differently everytime.

Just remember to share your questions regarding free/libre software
movement or free/libre software in general, even if you might already
have an answer for them. :)


signature.asc
Description: This is a digitally signed message part


Re: [Trisquel-users] Just lost every important files in my Trisquel Linux!!!! Very serious!

2016-09-21 Thread Adonay Felipe Nogueira
Thank you very much! :)


signature.asc
Description: This is a digitally signed message part


Re: [Trisquel-users] Just lost every important files in my Trisquel Linux!!!! Very serious!

2016-09-19 Thread mkl80

Thank you all for the replies, thank you very much!
But first of all I want to apologise to ADFENO. What I said it was not right,  
i Admit. Even if I was furious due to that event it was no way an excuse to  
talk to somebody like that. Sorry ADFENO and sorry to all the Forum.
Desculpa colega, voce tem ajudado sempre aqui no forum e eu fui ingrato e mal  
educado com voce. ao deveria nunca ter dito o que disse: Desculpa.


Re: [Trisquel-users] Just lost every important files in my Trisquel Linux!!!! Very serious!

2016-09-19 Thread martin

Or you could use:

find -name '*.c' -exec rm {} +

Which should be even better.


Re: [Trisquel-users] Just lost every important files in my Trisquel Linux!!!! Very serious!

2016-09-19 Thread martin

To add to what jbar suggests, it's even better to write:

find -name '*.c' -print0 | xargs -0 rm

Doing it this way should be even safer since names may have new lines in them  
(almost never in reality, but it's possible).


I would also suggest adding an echo before rm or any other command you run in  
this way, so you can see what's going to be done before doing it:


find -name '*.c' -print0 | xargs -0 echo rm



Re: [Trisquel-users] Just lost every important files in my Trisquel Linux!!!! Very serious!

2016-09-18 Thread jbar
By default xargs uses both spaces and newlines as item delimiters. The -d  
"\n" option tells xargs to use only newlines as delimiters, thus avoiding  
this problem in this context.

$ find ./ -name "*.c" | xargs -d "\n" rm



Re: [Trisquel-users] Just lost every important files in my Trisquel Linux!!!! Very serious!

2016-09-18 Thread greatgnu
Actually his photo is very nice and he is a very nice dood. I cannot say the  
same of you. Spitting out nonsense shit on someone who tries to help you  
speaks loud of yourself, and you should maybe not write at all here, not  
until you learn some common decency anyway.


Re: [Trisquel-users] Just lost every important files in my Trisquel Linux!!!! Very serious!

2016-09-18 Thread legimet . calc
You probably have spaces in your filenames (perhaps your home directory). In  
this case, not using -rf would have mitigated the damage.
But, you shouldn't use xargs with find. Instead, use the -exec option like  
this:

 $ find . -name '*.c' -exec rm {} \;
That way, you don't have to worry about spaces.

If you have a backup, just use that. Otherwise, try using photorec:  
http://www.cgsecurity.org/wiki/PhotoRec


Re: [Trisquel-users] Just lost every important files in my Trisquel Linux!!!! Very serious!

2016-09-18 Thread firefoxbugreporter

If you create a directory and a file like this
mkdir 'x ./'
touch 'x ./ x.c'
and try the find command, you will have a match
x ./ x.c
Now if you pipe this into xargs rm you don't have just one path. You have  
three

x
./
x.c
The middle one is the current directory. So all will be gone.

You are right. The command is not safe.

But you should anyway understand a command before using it.

The sudo command seems pointless here. Giving recursive flag (-r) to rm  
doesn't make sense since you seem to have been only trying to delete files,  
not whole directories. In the example I gave having rm without the flag would  
only delete the .c file.


Hope you get your files back.


Re: [Trisquel-users] Just lost every important files in my Trisquel Linux!!!! Very serious!

2016-09-17 Thread Adonay Felipe Nogueira
Readers must note: The message to which I'm replying to has more content
than what appears in the forums, see the same comment in the
trisquel-users mailing list for the complete message (with more command
options):



signature.asc
Description: This is a digitally signed message part


Re: [Trisquel-users] Just lost every important files in my Trisquel Linux!!!! Very serious!

2016-09-17 Thread Adonay Felipe Nogueira
Sorry, I know I'm dumb in most things (and slow also, :D), but I
wouldn't go that far as to call someone a dumb/donkey person. Besides,
my portrait is indeed not ideal, but it's the best I have for now. :)

So, regarding the incident: Perhaps I know what happened... Although I'm
not sure how your .bashrc got into the mess...

The issue is that, when xargs receives the path names, the spaces are,
by default, field separators. E.g.:

find -name "*copyright.markdown"

... would find the following paths, starting from my home directory:

./Público/Vídeos/Direito autoral e copyright.markdown
./Público/Documentos/Direito autoral e copyright.markdown

Since xargs understands spaces as field separators, and since find
doesn't put quotes every time it prints a path, then if we would pass it
to xargs, it would understand the following:

"./Público/Vídeos/Direito" "autoral" "e" "copyright.markdown"
"./Público/Documentos/Direito" "autoral" "e" "copyright.markdown"

What we could have done is:

while read -r each_path; do
  rm -rf "$each_path"
done <

signature.asc
Description: This is a digitally signed message part


Re: [Trisquel-users] Just lost every important files in my Trisquel Linux!!!! Very serious!

2016-09-17 Thread mkl80

Sirs are you joking with me?
this command is a blue print of my history file. here it is again:
416  sudo find . -name "*.c" | xargs rm -rf
There is no "c*" nor "*c*"!!! Common! If I had used such a command it was in  
the history file! More it would then had removed all files and not just  
Documents and Download directories! And this is not a strange command is a  
simple one that I have used before just was trainning to remenber how to use  
a find command if I wanted to delete a file! Brazuca burro com mania de  
esperto, tira essa foto estupida do teu perfil!




Re: [Trisquel-users] Just lost every important files in my Trisquel Linux!!!! Very serious!

2016-09-17 Thread Adonay Felipe Nogueira
I tested your command with:

find -name "*.c" | less

... And got every good match, except ".bashrc".

You must have used:

find -name "*c"

... to result in such a mess.

Every time I work with the command line, I do multiple tests to make
sure things would work as expected, and since I'm slow, it takes some
hours to get things running the way I intend them to. Still, even after
testing, some times they work as intended, and other times I have to
test again.
--- Begin Message ---
I am still in chock! The last thing i know i was training with find command  
using xarg to remove files, like explaining in this page:

ekstuff.com/2013/12/xargs-examples/
I was in using this command to erase some *.c files that i created in porpose  
and then I shut down my system. Later on when I started my machine my  
Document and Download folder were gone. Auto-completion and color ls were  
also not working, so I assume bashrc file was gone too wich I confirmed so  
far!
This is incredible I lost important files! This is serious! How this is  
possible only by training some find command. this is my last command from my  
history command before all broke down:

463  sudo find . -name "*.c" | xargs rm -rf
Why this happened? Is it possible to regain my losted files? This is a very  
serious thing if happens with somebody else!



p.s. I have backups from my files luckily it is not so bad! But still is a  
very serious issue if happens to somebody who don't make regularly backup  
files!



--- End Message ---


signature.asc
Description: This is a digitally signed message part


Re: [Trisquel-users] Just lost every important files in my Trisquel Linux!!!! Very serious!

2016-09-17 Thread dguthrie

Recover with photorec/testdisk.
Don't run weird commands without understanding them. I have no idea what the  
command does. It looks strange though.
If the bashrc file is gone as well as documents you probably did "*c*"  
instead of "*.c".
Make frequent backups. Always. 


[Trisquel-users] Just lost every important files in my Trisquel Linux!!!! Very serious!

2016-09-17 Thread mkl80
I am still in chock! The last thing i know i was training with find command  
using xarg to remove files, like explaining in this page:

ekstuff.com/2013/12/xargs-examples/
I was in using this command to erase some *.c files that i created in porpose  
and then I shut down my system. Later on when I started my machine my  
Document and Download folder were gone. Auto-completion and color ls were  
also not working, so I assume bashrc file was gone too wich I confirmed so  
far!
This is incredible I lost important files! This is serious! How this is  
possible only by training some find command. this is my last command from my  
history command before all broke down:

463  sudo find . -name "*.c" | xargs rm -rf
Why this happened? Is it possible to regain my losted files? This is a very  
serious thing if happens with somebody else!



p.s. I have backups from my files luckily it is not so bad! But still is a  
very serious issue if happens to somebody who don't make regularly backup  
files!