sudo can't find "cd" command in RedHat 7.2

sudo can't find "cd" command in RedHat 7.2

Post by b » Sun, 19 Jan 2003 06:52:47



Hi,

I am using sudo for moving a tar file from one user to another.  After
moving the file I want to untar it.  However, when I do a "sudo cd
/home/user1/test" I get this error message.

sudo: cd: command not found

All other commands are okay.

Interestingly, there is no man page for cd.  Rather, it is implemented
as a bash command in Redhat Linux.  Could this be the problem?

Whatever the problem, any idea how to fix it?

Thanks.

--
Bud Beacham

 
 
 

sudo can't find "cd" command in RedHat 7.2

Post by fast » Sun, 19 Jan 2003 07:23:26



> Hi,

> I am using sudo for moving a tar file from one user to another.  After
> moving the file I want to untar it.  However, when I do a "sudo cd
> /home/user1/test" I get this error message.

> sudo: cd: command not found

> All other commands are okay.

> Interestingly, there is no man page for cd.  Rather, it is implemented
> as a bash command in Redhat Linux.  Could this be the problem?

> Whatever the problem, any idea how to fix it?

> Thanks.

Why are you issuing the cd command? Why not sudo <what/I/want/to/do>?
--
Microsoft is not the answer, it is the question. The answer is NO!!!

 
 
 

sudo can't find "cd" command in RedHat 7.2

Post by Michael Heimin » Sun, 19 Jan 2003 07:32:56



> sudo: cd: command not found
> All other commands are okay.
> Interestingly, there is no man page for cd.  Rather, it is implemented
> as a bash command in Redhat Linux.  Could this be the problem?

Yes, it's a bash built-in.

Quote:> Whatever the problem, any idea how to fix it?

Put your commands in a script and start this via sudo, the shell running
it, will be spawned as root shell.

Michael Heiming
--
Remove +SIGNS and www. if you expect an answer, sorry for
inconvenience, but I get tons of SPAM

 
 
 

sudo can't find "cd" command in RedHat 7.2

Post by BlueFo » Sun, 19 Jan 2003 17:45:55


Well, I wanted to change directories.  However, as you are suggesting,
I figured out another way to do what I wanted.  But, I still want to
be able to cd with sudo.

I thought cd was a unix command? I can't believe Redhat (or whoever)
thought that just replacing a unix command wouldn't have any
side-effects.


> Why are you issuing the cd command? Why not sudo <what/I/want/to/do>?

 
 
 

sudo can't find "cd" command in RedHat 7.2

Post by Michael Heimin » Sun, 19 Jan 2003 18:06:21



> Well, I wanted to change directories.  However, as you are suggesting,
> I figured out another way to do what I wanted.  But, I still want to
> be able to cd with sudo.
> I thought cd was a unix command? I can't believe Redhat (or whoever)

No, it's a shell built-in, put your commands in a script and start this
via sudo, you don't read other replies?

Michael Heiming
--
Remove +SIGNS and www. if you expect an answer, sorry for
inconvenience, but I get tons of SPAM

 
 
 

sudo can't find "cd" command in RedHat 7.2

Post by BlueFo » Sun, 19 Jan 2003 19:22:51


Okay.  However, I can't believe that Unix offers a mkdir
command, but doesn't provide a command to change to that dir.


> > Well, I wanted to change directories.  However, as you are suggesting,
> > I figured out another way to do what I wanted.  But, I still want to
> > be able to cd with sudo.

> > I thought cd was a unix command? I can't believe Redhat (or whoever)

> No, it's a shell built-in, put your commands in a script and start this
> via sudo, you don't read other replies?

> Michael Heiming
> --
> Remove +SIGNS and www. if you expect an answer, sorry for
> inconvenience, but I get tons of SPAM

 
 
 

sudo can't find "cd" command in RedHat 7.2

Post by Peter T. Breue » Sun, 19 Jan 2003 19:54:44



> Well, I wanted to change directories.  However, as you are suggesting,
> I figured out another way to do what I wanted.  But, I still want to
> be able to cd with sudo.
> I thought cd was a unix command? I can't believe Redhat (or whoever)
> thought that just replacing a unix command wouldn't have any
> side-effects.

Oh boy.

You have no idea how stupid this looks.


>> Why are you issuing the cd command? Why not sudo <what/I/want/to/do>?

"cd" can NEVER do anything as a separate command. Is it not completely
blazingly obvious to you that it would cd in a SUBSHELL, leaving YOUR
shell completely untouched? There has /never/ been a cd command in
unix, for that same amazingly obvious reason.

No, but your thinking really isn't thinking, is it? It's just
superstition and other untested and unthought through beliefs. Not
thinking at all. Please don't call it that. When you next want to say
"I thought", please don't. Say "I believed", and follow that up
with "but now I see that, having thought it through, my belief was
unfounded and, indeed, mistaken".

Peter

 
 
 

sudo can't find "cd" command in RedHat 7.2

Post by Ian Northeas » Sun, 19 Jan 2003 20:13:38



> Okay.  However, I can't believe that Unix offers a mkdir
> command, but doesn't provide a command to change to that dir.

Please don't top post.

Cd is not a UNIX command in any modern variant. It would not work at all
if it were. The shell runs commands as child processes. Child processes
have their own address spaces and can have no effect on their parents'
environments. So if cd were a command, the child process would change to
the new directory and terminate, returning control back to the parent
shell which is waiting for it, leaving the parent shell still in the
directory it started in. So cd has to be a shell builtin running in the
shell's own process. All shells do this, not just bash.

UNIX provides a chdir() system call. This is what the shell uses.

In this respect as in many others Linux is no different to UNIX.

Regards, Ian

 
 
 

sudo can't find "cd" command in RedHat 7.2

Post by Johan Lindquis » Sun, 19 Jan 2003 21:49:01


On Sat, 18 Jan 2003 at 11:54 GMT, gazing longingly at the horizon,

felt a deep, passionate desire to let the following be known:

[snip "why isn't there a cd command"]

Quote:> Oh boy.

> You have no idea how stupid this looks.

[..]

Quote:> "cd" can NEVER do anything as a separate command. Is it not
> completely blazingly obvious to you that it would cd in a SUBSHELL,
> leaving YOUR shell completely untouched? There has /never/ been a cd
> command in unix, for that same amazingly obvious reason.

> No, but your thinking really isn't thinking, is it? It's just
> superstition and other untested and unthought through beliefs. Not
> thinking at all. Please don't call it that. When you next want to
> say "I thought", please don't. Say "I believed", and follow that up
> with "but now I see that, having thought it through, my belief was
> unfounded and, indeed, mistaken".

Okay, now let's compare that to what another person wrote, in response
to the same article:

-----8<-----
Cd is not a UNIX command in any modern variant. It would not work at
all if it were. The shell runs commands as child processes. Child
processes have their own address spaces and can have no effect on
their parents' environments. So if cd were a command, the child
process would change to the new directory and terminate, returning
control back to the parent shell which is waiting for it, leaving the
parent shell still in the directory it started in. So cd has to be a
shell builtin running in the shell's own process. All shells do this,
not just bash.
----->8-----

You both say, more or less, the same thing, yet one of you seems to go
out of his way to be as offensive and denigrating as humanly possible.

Peter, is there /any/ chance of you not taking out all of your
personal grievances on the poor, unsuspecting public in this news
group who actually ask for advice and do not come here to get publicly
humiliated by your oh-so-superior knowledge?

Just wondering. Thanks.

--
Time flies like an arrow, fruit flies like a banana.      Perth ---> *
 13:35:29  up 42 days, 18:33,  3 users,  load average: 0.05, 0.06, 0.00
$ cat /dev/bollocks                      Registered Linux user #261729
grow global partnerships

 
 
 

sudo can't find "cd" command in RedHat 7.2

Post by Michael Heimin » Sun, 19 Jan 2003 22:38:23



> You both say, more or less, the same thing, yet one of you seems to go
> out of his way to be as offensive and denigrating as humanly possible.
> Peter, is there /any/ chance of you not taking out all of your
> personal grievances on the poor, unsuspecting public in this news
> group who actually ask for advice and do not come here to get publicly
> humiliated by your oh-so-superior knowledge?

It's just your opinion that his post was "offensive".

IMHO we have to respect what others write, there's no problem, correcting
if there's something wrong.

Just moaning about ones writing stile, doesn't help anyone. Usually it ends
up in insulting/kill-filing, which might be entertainment for others while
boosting the stats for people involved.

Wondering, why always our friend Peter T. Breuer, willing to share his deep
*nix knowledge, is *ed? You must be new here...

;)

Michael Heiming
--
Remove +SIGNS and www. if you expect an answer, sorry for
inconvenience, but I get tons of SPAM

 
 
 

sudo can't find "cd" command in RedHat 7.2

Post by Peter T. Breue » Sun, 19 Jan 2003 22:45:16



> [ptb]
>> "cd" can NEVER do anything as a separate command. Is it not
>> completely blazingly obvious to you that it would cd in a SUBSHELL,
>> leaving YOUR shell completely untouched? There has /never/ been a cd
>> command in unix, for that same amazingly obvious reason.

>> No, but your thinking really isn't thinking, is it? It's just
>> superstition and other untested and unthought through beliefs. Not
>> thinking at all. Please don't call it that. When you next want to
>> say "I thought", please don't. Say "I believed", and follow that up
>> with "but now I see that, having thought it through, my belief was
>> unfounded and, indeed, mistaken".
> Okay, now let's compare that to what another person wrote, in response
> to the same article:
> -----8<-----
> Cd is not a UNIX command in any modern variant. It would not work at
> all if it were. The shell runs commands as child processes. Child
> processes have their own address spaces and can have no effect on
> their parents' environments. So if cd were a command, the child
> process would change to the new directory and terminate, returning
> control back to the parent shell which is waiting for it, leaving the
> parent shell still in the directory it started in. So cd has to be a
> shell builtin running in the shell's own process. All shells do this,
> not just bash.
> ----->8-----
> You both say, more or less, the same thing, yet one of you seems to go
> out of his way to be as offensive and denigrating as humanly possible.

Yep. Is "denigrating" a word, btw? Oh, I see. Yes it is. Curious. It
looks as though it should not be!

Quote:> Peter, is there /any/ chance of you not taking out all of your
> personal grievances on the poor, unsuspecting public in this news

Hey, he took his grievances out on ME. He viciously attacked RH for
supposedly removing a cd command which he viewed as his right to have,
then he bombarded me with his beliefs, pretending they were facts. He
generally acted pompously and arrogantly, accusing the rest of the
universe of having got it wrong. He dismissed the helpful advice given
him and ignored it at the same time (a neat trick). All in all, he
needed a reality check.

I was happy to give him one.

I figured that ought to get through to him, at least. The original polite
response didn't seem to penetrate his hide.

Quote:> group who actually ask for advice and do not come here to get publicly
> humiliated by your oh-so-superior knowledge?
> Just wondering. Thanks.

I don't have any knowledge.

But nor do I have any beliefs.

Peter

 
 
 

sudo can't find "cd" command in RedHat 7.2

Post by Johan Lindquis » Sun, 19 Jan 2003 23:39:04


On Sat, 18 Jan 2003 at 14:38 GMT, gazing longingly at the horizon,

felt a deep, passionate desire to let the following be known:

Quote:> It's just your opinion that his post was "offensive".

You have no idea how stupid this looks. ;)

--
Time flies like an arrow, fruit flies like a banana.      Perth ---> *
 15:33:09  up 42 days, 20:31,  3 users,  load average: 0.41, 0.41, 0.24
$ cat /dev/bollocks                      Registered Linux user #261729
transform impactful e-markets

 
 
 

sudo can't find "cd" command in RedHat 7.2

Post by Johan Lindquis » Sun, 19 Jan 2003 23:39:04


On Sat, 18 Jan 2003 at 14:45 GMT, gazing longingly at the horizon,

felt a deep, passionate desire to let the following be known:


>> Peter, is there /any/ chance of you not taking out all of your
>> personal grievances on the poor, unsuspecting public in this news

> Hey, he took his grievances out on ME. He viciously attacked RH for
> supposedly removing a cd command which he viewed as his right to
> have, then he bombarded me with his beliefs,

1) You are not red hat.
2) You are not the focus of people posting to this group.

At least those are my beliefs. You just need to calm down and not take
others (in your opinion) cluelessness personal, that's all.

Quote:> I was happy to give him one.

I wouldn't have spoken up if that was the first time you "gave someone
one".

Anyroads, never mind. As I said, I was just wondering, and I got my
answer. Thanks.

--
Time flies like an arrow, fruit flies like a banana.      Perth ---> *
 15:33:36  up 42 days, 20:32,  3 users,  load average: 0.25, 0.37, 0.23
$ cat /dev/bollocks                      Registered Linux user #261729
extend cutting-edge paradigms

 
 
 

sudo can't find "cd" command in RedHat 7.2

Post by Michael Heimin » Sun, 19 Jan 2003 23:49:28



> On Sat, 18 Jan 2003 at 14:38 GMT, gazing longingly at the horizon,

> felt a deep, passionate desire to let the following be known:
>> It's just your opinion that his post was "offensive".
> You have no idea how stupid this looks. ;)

If you reread the posts, I answered the OPs question, 10h later he
insisted, that 'cd' would be a unix command. Not reading what others
reply, that's what made his post look stupid.

Hopefully, you get it now.
;)

Michael Heiming
--
Remove +SIGNS and www. if you expect an answer, sorry for
inconvenience, but I get tons of SPAM

 
 
 

sudo can't find "cd" command in RedHat 7.2

Post by Peter T. Breue » Sun, 19 Jan 2003 23:48:24



> On Sat, 18 Jan 2003 at 14:45 GMT, gazing longingly at the horizon,

> felt a deep, passionate desire to let the following be known:

>>> Peter, is there /any/ chance of you not taking out all of your
>>> personal grievances on the poor, unsuspecting public in this news

>> Hey, he took his grievances out on ME. He viciously attacked RH for
>> supposedly removing a cd command which he viewed as his right to
>> have, then he bombarded me with his beliefs,
> 1) You are not red hat.

I know I'm not.

Quote:> 2) You are not the focus of people posting to this group.

OK.  I think your country is a sewer, your town is a lice-infested
dogpound, and your house is a disgrace to a romany encampment.  Tell me
when you begin to feel that my "thoughts" ought to be rephrased as
beliefs.

Quote:> At least those are my beliefs. You just need to calm down and not take

That's fair enough. You show balance and perspective.

Quote:> others (in your opinion) cluelessness personal, that's all.
>> I was happy to give him one.
> I wouldn't have spoken up if that was the first time you "gave someone
> one".
> Anyroads, never mind. As I said, I was just wondering, and I got my
> answer. Thanks.
> Time flies like an arrow, fruit flies like a banana.      Perth ---> *

Quiz. Meetings between the Rev. Canaan Banana and WHO ELSE were always
reported as "fruitful", and why?

Peter

 
 
 

1. sudo can't find "cd" command in RedHat 7.2

I am using sudo to move a tar file from one user to another on a
Redhat Linux 7.2 PC.  After I move the file I want to untar it.
However, when I enter the command "sudo cd /home/user1/temp" I get
this error message:

sudo: cd: command not found

If I do a "find . -name <any unix command>" they are in /bin, except
for cd.  It is not on the system.  There is not even a man page for
cd.  It appears that Redhat has implemented cd as a bash command.

Is this why sudo can't find it?  Whatever the reason, how do I get
sudo to use this command?

Thanks.

--
Bud Beacham

2. unable to see server

3. command not found after RH 7.2 kernel upgrade via "Upgrade Agent"

4. disable finger

5. is the Redhat 7.2 have been remove "linuxconf" this command for this version ?

6. Automatic remailers: Where?

7. Why doesn't echo "text" 'command' "more text" work?

8. fdisk question...

9. """"""""My SoundBlast 16 pnp isn't up yet""""""""""""

10. Where can I find sources to "sudo" command?

11. STARTX: "No Screens Found"/"Can't find Display"

12. Tcl script can't find command "sleep" under RedHat 3.03