SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
It seems 'rm -r .*' works. Though I don't have a cue what's really to be erased. With normal files, I can always do, say 'ls y*' and see the output. Then, just replacing ls by rm I possitively know exactly what will be erased.
It seems 'rm -r .*' works. Though I don't have a cue what's really to be erased. With normal files, I can always do, say 'ls y*' and see the output. Then, just replacing ls by rm I possitively know exactly what will be erased.
try
echo .*
"*" is for globbing, a shell thing (i think this is called shell expansion, not sure)
think of it as half arsed regex
bdw unlike regex, shell doesn't take "." as any char, "?" means any char in shell
ignore . (this directory) and .. (parent directory) since you can't remove a dir that is in use (you are in it)
PS don't use -f with rm, it's rare when you really have to use it
also as always, take care when not sure 'cuz ".." can give you headaches (weird links also)
Just a quick question (and not an answer to your question - others have given enough of that):
Just _WHY_ would you want to delete all the dot-files/directories? That's where all your setup is.
That would be like creating a completely new user! (well, almost)
Which is why I never use my home-directory for 'personal' files - dot-files/dirs are not always portable across distros ...
Just _WHY_ would you want to delete all the dot-files/directories?
That is the REAL question.
Anyway, it always good kung.fu to test operations like this, so I advise "echo" before any real rm'ing to "see" what will be removed, first.
Think of it as a "dry run" as there's undo button except for backups, and you have those, right?
Just a quick question (and not an answer to your question - others have given enough of that):
Just _WHY_ would you want to delete all the dot-files/directories? That's where all your setup is.
That would be like creating a completely new user! (well, almost)
Which is why I never use my home-directory for 'personal' files - dot-files/dirs are not always portable across distros ...
I would politely answer you that's my business. As a side note, "creating" a new user is what it is about.
No it won't. "-d" doesn't do what you think it does. It will list any files or directories in the current directory starting with a '.'
szboardstretcher said "It will list any directories/files starting with a '.'. I think it's the superior choice. 'ls -d .*' will show exactly what will be erased by 'rm -r .*', because there's only one interpretation of '.*', namely, that of the shell. Hence, typing 'ls -d .*' you can then recall the command from the keyboard buffer (arrow key), press <Home>, delete the first five chars and type 'rm -r', in this way there being no room for typing errors. It would be easier if there would be some means of placing the keyboard in replace mode.
szboardstretcher said "It will list any directories/files starting with a '.'.
Not when I posted it didn't. If you were paying attention you would have seen that it's been edited since my comment.
Quote:
Originally Posted by stf92
I think it's the superior choice.
Paulo2's "find" solution is the safer choice. The use of ".*" wildcards should be avoided because of their tendency to match the "." and ".." directory links. You may get away with it in the case of 'rm' but you might not be so lucky when used with other commands and end up with unexpected results. IMO the ".*" pattern is dangerous and best avoided completely.
But, as the Paul Simon song goes: "Who am I to blow against the wind."
Last edited by GazL; 05-17-2014 at 08:12 AM.
Reason: speeling. ;)
Distribution: Slackware64 15.0 (started with 13.37). Testing -current in a spare partition.
Posts: 950
Rep:
I suggested find with -mount option because if, for some strange reason,
you mount some device at let's say, ~/.my-hidden-device and you remove
all hidden directories with that device mounted, you will erase it too.
Quote:
Originally Posted by GazL
But, as the Paul Simon song goes: "Who am I to blow against the wind."
From Graceland? Very good album, I have a vinyl copy
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.