sudo: <command> command not found

I would like to use sudo instead of su or su -, as twice this week I’ve forgotten to logout of root.

However, sudo returns

sudo: *<command>*: command not found

if <command> is in /sbin or /usr/sbin (eg init). This post seems to fix this:

but I must confess I don’t know what a .zshrc file is or where I find it (it’s not in ~/ and google sheds no light). What are the security/safety implications of making this change?

Joban

Simple question. Do you have the sudo RPM installed?

Yes I do, sudo zypper is running right now in fact :slight_smile:

Sorry, misunderstood your first post.

That post was for zsh. For bash, the corresponding file is ~/.bashrc.

You could also use sudo -i, which gives you root’s environment, and hence PATH.

Thank you!
I added

alias sudo="PATH=$PATH:/sbin:/usr/sbin sudo"

to ~/.bashrc and now sudo works for everything!

Thanks for your help

I would like to use sudo instead of su or su -, as twice this week I’ve forgotten to logout of root.

May I suggest another solution? A timeout for root-shells should do the trick. Add this to /etc/bash.bashrc.local:

if  "`id -u`" -eq 0 ]; then
  IDLELOGOUT=300
  echo "
Automatic logout after five minutes without input or job
"
  export TMOUT=$IDLELOGOUT
fi

[In case you don’t have a /etc/bash.bashrc.local yet, just create it.]

You can configure ‘IDLELOGOUT’ as you please of course. The timeout will be reset whenever there is a job running or input happening.

kalle@hoppers:~> su -
Password: 

Automatic logout after five minutes without input or job

hoppers:~ # timed out waiting for input: auto-logout
kalle@hoppers:~>

hi guyz,

i’m a newbie here.
I try to run several commands but I face the problem.

for example:
zahian@linux-9h2w:~> $tar -xvzf RT2870_Linux_STA_V2.3.0.0.bz2
If ‘-xvzf’ is not a typo you can use command-not-found to lookup the package that contains it, like this:
cnf -xvzf
zahian@linux-9h2w:~> cnf -xvzf
-xvzf: command not found

could anyone please tell me what should I do…

tq.

zahian wrote:
> for example:
> zahian@linux-9h2w:~> $tar -xvzf RT2870_Linux_STA_V2.3.0.0.bz2
> If ‘-xvzf’ is not a typo you can use command-not-found to lookup the
> package that contains it, like this:
> cnf -xvzf

this is crazy, i know…but, is tar installed? what do you get with


which tar

if the which shows tar in your path, then ???
-is it executable?
-if not, why not?
-what happens if you use YaST (or zypper) to replace your tar?

do you have any other problems? i mean, maybe you have an all around
faulty install, from a disk full of errors (or only one: a bogus tar)
did you:

  1. get your install image from http://software.opensuse.org/112/en ?
    (if not, then where?)
  2. check the md5sum of the downloaded iso?
  3. burn as slow as you can
  4. do this http://tinyurl.com/yajm2aq before install attempt?

if you answered “no” (or “don’t know”) to any of those then see the
following cites before you start over:
http://en.opensuse.org/Download_Help
http://tinyurl.com/yhf65pv
http://tinyurl.com/ycly3eg


DenverD (Linux Counter 282315)
CAVEAT: http://is.gd/bpoMD
posted via NNTP w/TBird 2.0.0.23 | KDE 3.5.7 | openSUSE 10.3
2.6.22.19-0.4-default SMP i686
AMD Athlon 1 GB RAM | GeForce FX 5500 | ASRock K8Upgrade-760GX |
CMedia 9761 AC’97 Audio

Hello zahian,

First of all welcome to the community!:slight_smile:

I think you’re problem lies in the fact that you run this command:

**$**tar -xvzf RT2870_Linux_STA_V2.3.0.0.bz2

But you should have used this command instead:

tar -xvzf RT2870_Linux_STA_V2.3.0.0.bz2

In the first command the “$” will let bash think you mean a variable like $PATH, $PWD, $HOME etc.
But the variable $tar is empty so bash will execute the command:

-xvzf RT2870_Linux_STA_V2.3.0.0.bz2

And -xczf isn’t a command as far is I know.

If you’ve got any question feel free to ask.

Good luck!:wink:

zahian wrote:

>
> hi guyz,
>
> i’m a newbie here.
> I try to run several commands but I face the problem.
>
> for example:
> zahian@linux-9h2w:~> $tar -xvzf RT2870_Linux_STA_V2.3.0.0.bz2

Looks like you have an extra ‘$’ in there - should just be tar -xvzf …

> If ‘-xvzf’ is not a typo you can use command-not-found to lookup the
> package that contains it, like this:
> cnf -xvzf

When you entered ‘$tar’, the shell thought that was a variable name. There
is no variable named ‘tar’, so it defaulted to a null string. Then it took
the first non-null field (’-xvzf’) to be the command name and couldn’t find
it.
>
> zahian@linux-9h2w:~> cnf -xvzf
>
> -xvzf: command not found
>
> could anyone please tell me what should I do…
>

Beside that: please do not highjack threads like this. Your question is offtopic here, next time open a new thread.