Friday, December 18, 2009

[BLUG] directories named -

I posted the hint to @climagic just now about how you can use the
command:

cd -

This will take you to the previous directory you were in. I find this
very useful as a short cut to go back and forth. I thought then what
happens if you name a directory -. It turns out, you will have a lot of
trouble on the command line changing into such a named directory.

I talked to people on the #bash channel on freenode and they were also
surprised. Normally, you could use -- to a command in order to tell it
that "hey, the options are over with, the rest of the arguments are not
options", but

So here are a list of ways that don't work for getting into the -
directory. Unless of course your previous directory was the - directory:

cd -
cd -/
cd '-'
cd "-"
cd '\-'
cd "\-"
cd \-
cd \-/
cd \\-/ (Tries to go to a directory called \- (go figure)
cd -- -
cd -- -/

The following will work:

cd /full/path/to/-
cd ./-
cd ./-/
cd ~/to/- (if its a subdir of your homedir)


Of course, I was able to delete the empty - dir by simply running

rmdir -


Lesson learned, don't name directories -


--
Mark Krenz
Bloomington Linux Users Group
http://www.bloomingtonlinux.org/
_______________________________________________
BLUG mailing list
BLUG@linuxfan.com
http://mailman.cs.indiana.edu/mailman/listinfo/blug

Re: [BLUG] power off CD?

You say "powers down", you mean the computers power turns off right,
not Ubuntu goes through the whole shutdown sequence?

That's an interesting problem, could it be that you've hit the maximum
power your power supply can handle? Maybe the CD was unreadable by
Linux and it spun the drive faster drawing more power? What type of
files are in the CD and how big are they?

Searching for inserting cd shuts off computer on google yeilds a
surprising number of results, but they are all windows problems, which
isn't surprising.

On Fri, Dec 18, 2009 at 06:11:29AM GMT, David Ernst [david.ernst@davidernst.net] said the following:
> So, my wife Priscilla makes a copy of a data CD. Some friends are in
> the psychology dept at IU, and she volunteered for an experiment and
> ended up with some kind of imaging info of her brain. I don't think
> that's important to the story, but maybe. Anyway, she drags a couple
> of extra files onto the disk in Windows (Vista), and it's ready to
> give to her friend. She said to me "can you put this in you computer
> and make sure that it works?" Sure.
>
> So, we put the CD into the CD drive of my Ubuntu (Jaunty)
> machine... it spins up, and ... my computer turns off. power off. As
> if our power had gone out, but it hadn't.
>
> I turned the computer back on, it started booting, got about half way
> through the progress meter (before the login prompt) and... same
> thing. Power off.
>
> I turn the computer back on, remove the CD, and the computer boots
> normally. With no applications running besides the core and the GUI,
> I insert the CD again. It spins up, and the computer powers down
> again.
>
> I'm convinced, so I won't try it again. She takes the CD back
> to her computer, and that computer reads it just fine.
>
> We really don't need to solve this problem, but I'm curious if anyone
> has any thoughts on what's going on here. I wouldn't know how to make
> such a CD if I wanted that functionality.... Strange that it might
> somehow happen inadvertantly...
>
> David
> _______________________________________________
> BLUG mailing list
> BLUG@linuxfan.com
> http://mailman.cs.indiana.edu/mailman/listinfo/blug
>

--
Mark Krenz
Bloomington Linux Users Group
http://www.bloomingtonlinux.org/
_______________________________________________
BLUG mailing list
BLUG@linuxfan.com
http://mailman.cs.indiana.edu/mailman/listinfo/blug

Thursday, December 17, 2009

[BLUG] power off CD?

So, my wife Priscilla makes a copy of a data CD. Some friends are in
the psychology dept at IU, and she volunteered for an experiment and
ended up with some kind of imaging info of her brain. I don't think
that's important to the story, but maybe. Anyway, she drags a couple
of extra files onto the disk in Windows (Vista), and it's ready to
give to her friend. She said to me "can you put this in you computer
and make sure that it works?" Sure.

So, we put the CD into the CD drive of my Ubuntu (Jaunty)
machine... it spins up, and ... my computer turns off. power off. As
if our power had gone out, but it hadn't.

I turned the computer back on, it started booting, got about half way
through the progress meter (before the login prompt) and... same
thing. Power off.

I turn the computer back on, remove the CD, and the computer boots
normally. With no applications running besides the core and the GUI,
I insert the CD again. It spins up, and the computer powers down
again.

I'm convinced, so I won't try it again. She takes the CD back
to her computer, and that computer reads it just fine.

We really don't need to solve this problem, but I'm curious if anyone
has any thoughts on what's going on here. I wouldn't know how to make
such a CD if I wanted that functionality.... Strange that it might
somehow happen inadvertantly...

David
_______________________________________________
BLUG mailing list
BLUG@linuxfan.com
http://mailman.cs.indiana.edu/mailman/listinfo/blug

Tuesday, December 15, 2009

Re: [BLUG] Command line magic on Twitter

On Tue, Dec 15, 2009 at 08:00:30PM GMT, Robert Freeman-Day [presgas@gmail.com] said the following:
>
> Commandlinefu also has some pretty nifty items in its repository.
>
> http://www.commandlinefu.com/commands/browse
>

Thanks, that's a neat one too. Didn't know about it.

--
Mark Krenz
Bloomington Linux Users Group
http://www.bloomingtonlinux.org/
_______________________________________________
BLUG mailing list
BLUG@linuxfan.com
http://mailman.cs.indiana.edu/mailman/listinfo/blug

Re: [BLUG] Command line magic on Twitter

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tue, 15 Dec 2009, Mark Krenz wrote:

> Date: Tue, 15 Dec 2009 19:44:45 +0000
> From: Mark Krenz <mark@slugbug.org>
> Reply-To: Bloomington LINUX Users Group <blug@cs.indiana.edu>
> To: blug@cs.indiana.edu
> Subject: [BLUG] Command line magic on Twitter
>
>
> I know some of you probably don't use Twitter or scoff at it, but maybe
> its just because you haven't found anything interesting there yet. This
> may change your mind.
>
> I created a new account on Twitter called climagic, which you can
> follow here:
>
> http://twitter.com/climagic
>
> It stands for Command Line (Interface) Magic.
>
> Every day I will be posting a few command line demonstrations of
> different things you can do in bash as well as some helpful tips. I've
> categorized the demos out into easy, medium and advanced so that there
> is something for all users and will try to include various purposes.
> Hopefully you'll find new things you can do and better ways of doing old
> things.
>
> I also welcome suggestions of course.
>
> --
> Mark Krenz
> Bloomington Linux Users Group
> http://www.bloomingtonlinux.org/

Commandlinefu also has some pretty nifty items in its repository.

http://www.commandlinefu.com/commands/browse

- ---Robert Freeman-Day
- ---------------
I would really like you to be on my side,
but the side you show me isn't what I had in mind.

- -Judybats
GPG Public Key:
http:keyserver.ubuntu.com:11371/pks/lookup?op=get&search=0xBA9DF9ED3E4C7D36

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAksn6t4ACgkQup357T5MfTbO1ACfQEn62ffubldacXSh2VL7ANT2
AB4Ani2M5gp6ZCMrfHnc1rOkMBkYKFV9
=7q7S
-----END PGP SIGNATURE-----
_______________________________________________
BLUG mailing list
BLUG@linuxfan.com
http://mailman.cs.indiana.edu/mailman/listinfo/blug

[BLUG] Command line magic on Twitter

I know some of you probably don't use Twitter or scoff at it, but maybe
its just because you haven't found anything interesting there yet. This
may change your mind.

I created a new account on Twitter called climagic, which you can
follow here:

http://twitter.com/climagic

It stands for Command Line (Interface) Magic.

Every day I will be posting a few command line demonstrations of
different things you can do in bash as well as some helpful tips. I've
categorized the demos out into easy, medium and advanced so that there
is something for all users and will try to include various purposes.
Hopefully you'll find new things you can do and better ways of doing old
things.

I also welcome suggestions of course.

--
Mark Krenz
Bloomington Linux Users Group
http://www.bloomingtonlinux.org/
_______________________________________________
BLUG mailing list
BLUG@linuxfan.com
http://mailman.cs.indiana.edu/mailman/listinfo/blug

Saturday, December 12, 2009

[BLUG] Strange sort behavior fixed with LANG

I was sorting an /etc/passwd and /etc/shadow file on the same machine
for the purpose of using the join command for an ldap import. I was
puzzled when I ran into little inconsistencies in my sorted output, like
this:

excerpt of sorted /etc/passwd:

joe:x:821:821::/home/joe:/bin/bash
joebob:x:1192:1192::/home/joebob:/bin/bash

excerpt of sorted /etc/shadow:

joebob:$1$uyt4hg46$Gf1EAPxzZ/Tm7X8BEgyBe0:12687:0:99999:7:::
joe:$1$uyt4hg46$Gf1EAPxzZ/Tm7X8BEgyBe0:12687:0:99999:7:::


What? Why would it put joe before joebob in one file and joebob before
joe in the other. All I had run to generate the output was this:

sort /etc/passwd > passwd-sorted
sort /etc/shadow > shadow-sorted

It turns out that when it comes to things like colons or
non-alphanumeric characters, sort will do strange things. So what you
have to do to get the right output is set the LANG=C variable in your
command line like this:

LANG=C sort filename

I can't believe I haven't run into this before. I hate to think how
many lists I may have constructed that had little errors in it now.

(And no that isn't a real password I used above for this e-mail.)

--
Mark Krenz
Bloomington Linux Users Group
http://www.bloomingtonlinux.org/
_______________________________________________
BLUG mailing list
BLUG@linuxfan.com
http://mailman.cs.indiana.edu/mailman/listinfo/blug