[NTLUG:Discuss] Really Basic

./aal al_h at technologist.com
Tue Aug 5 12:05:59 CDT 2008


On Tue, Aug 5, 2008 at 10:38 AM, Kenneth Loafman <kenneth at loafman.com> wrote:
> Allen Meyers wrote:
>> I grew tired of asking questions so I decided on an online organized linux course. Who am I kidding I have more questions now then I did before.
>> We are on the linux shell and they are giving comman line codes to put into the terminal to familiarize ones self with command line.
>> Example cd / nothing happens
>
> What distro are you running?  Your prompt should change if you actually
> change directories.  It will on Redhat and Debian based distros, at
> least the new ones will.
>
>> So got innovative sudo cd / and asked for password hey felt like I was getting somewhere no such command
>> So what is it about terminal and command line I do not know. The enter key is the trigger is it not.
>> Please advise and thanks
>
> OK, here you'll need a bit of explanation to see what happened.  sudo
> expects to see an executable command as the option.  What you gave it
> was a shell command, which is not executable in itself.  To sudo a cd
> shell command, you would need to do:
>
>  sudo /bin/sh -c cd /
>
> but this will not accomplish what you want, which is to change the
> working directory of your current shell to '/'.  This command will just
> return, having cd'ed its instance of the shell to '/', and will not
> affect the current shell.
>
> To explore this further, execute the following.
>
>  cd ~
>  pwd
>
> and you should see '/home/meyers', or whatever your login name is.
>
> If you execute the command:
>
>  ls
>
> you should see a listing of the home directory.  Now back to the sudo
> command above.  To prove that it has gone to '/', execute this:
>
>  sudo /bin/sh -c 'cd / ; ls'
>
> This tells sudo to execute /bin/sh as root with the command 'cd / ; ls',
> which is a compound command of 'cd /' followed by 'ls'.  The listing you
> see should be of the '/' directory.
>
> Hope this helps.
>
> ...Ken
>
> _______________________________________________
> http://www.ntlug.org/mailman/listinfo/discuss
>



also
I highly recommend
"A Practical Guide to Linux"
 by Mark G Sobel

Sobel also wrote "A Practical Guide to Unix"
This is the book Linux Torvalds cites as a pivotal tome in his
creation of Linux.
Linus even wrote the forward for the book. (I have the second edition)

-- 

Calvin Trillin  - "Health food makes me sick."



More information about the Discuss mailing list