[Novalug] ls -d

James Ewing Cottrell III jecottrell3@comcast.net
Wed Oct 19 20:08:16 EDT 2016


***WARNING*** Be *VERY* Careful when using .*

QUESTION: Suppose as root in a someone's home directory trying to remove 
all their directories beginning with .

So you do something like:

	cd /home/dtrump
	sudo rm -rf .*

ANSWER: Guess What? You have just Destroyed the Entire Republican Party!

Why? Because .* includes .., which is /home, and you have just wiped out 
/home/bcarson, /home/pryan, /home/tcruz, etc.

On second thought...Good Work!

What you REALLY want to use is ".??*", which is Almost Good Enough. It 
does miss things like .a and .1, but how many of those do you have? To 
catch those too, use ".[^.]"

JIM

P.S. You don't think we Democrats would store our files there, do you? 
No, we've got our Own Server.

On 10/16/2016 4:19 PM, Gary Knott via Novalug wrote:
>   in Bash,  "  ls -d  .*/  "   outputs the one-level directories whose
> names start with " . "   And "  ls -d   .*/   */   "  lists all
> the  directories.    Thanks, everyone, for a lot of elucidation.
>
> There really needs to be a proper book.  (with
> tee, xargs, quoting and &, shell-language
> in general and all the obscure stuff  well, but
> not laboriously, explained.  Is there?
> **********************************************************************
> The Novalug mailing list is hosted by firemountain.net.
>
> To unsubscribe or change delivery options:
> http://www.firemountain.net/mailman/listinfo/novalug
>



More information about the Novalug mailing list