Re: What to do when a command isn't found?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jul 06, 2006 at 09:58:11AM -0700, Timothy Alberts wrote:
> My first question is, are the shell commands and features standardized
> somewhere so that I know what commands I can expect to have no matter
> what machine I'm sitting at or what type of installation I have?  My

There is a typical set of Unix utilities, but in general, "no".

> second question is, if these commands are supposed to be there, but the
> shell comes back and says they aren't, what is the procedure for finding
> the commands or installing the packages required for them?

Try "yum provides /usr/bin/commandname". (You'll need to run this as root
the first time, but after that, can be done as a normal user.) You can then
install the packages named -- or even do "yum install /usr/bin/commandname".

> help me find a missing command.  I also understand that typically shell
> commands are in /bin /usr/bin /usr/local/bin among others.  If it helps,
> when I type 'which ifconfig' the following is the result:
> /usr/bin/which: no ifconfig in
> (/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:
> /usr/X11R6/bin:/home/talberts/bin)

Ah. This is a different case -- some commands (generally those designed for
use by the sysadmin and of little use to anyone else) live in /sbin or
/usr/sbin. In this case, /sbin/ifconfig. (Arguably, this is wrong, since
ifconfig is also useful to normal users, so it maybe should be
/bin/ifconfig. But it's pretty traditional for it to be in /sbin at this
point.)

Incidentally, commands in /bin or /sbin are ones that may be needed at
system boot -- everything else goes in /usr/bin or /usr/sbin. (If /usr is a
network filesystem or something, those locations may not be available at
boot time.)

Anyway, you can find an arbitrary file on your system with "locate":

  $ locate ifconfig
  /sbin/ifconfig
  /usr/share/man/de/man8/ifconfig.8.gz
  /usr/share/man/fr/man8/ifconfig.8.gz
  /usr/share/man/man8/ifconfig.8.gz
  /usr/share/man/pt/man8/ifconfig.8.gz

Often, this gives too much information (it returns any file which matches
the given string anywhere in the path), so you may want to do something like

  $ locate ifconfig | grep bin
  /sbin/ifconfig




-- 
Matthew Miller           mattdm@xxxxxxxxxx          <http://mattdm.org/>
Boston University Linux      ------>              <http://linux.bu.edu/>


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux