LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Where are my commands stored? (https://www.linuxquestions.org/questions/linux-newbie-8/where-are-my-commands-stored-674176/)

ifeatu 10-04-2008 08:47 AM

Where are my commands stored?
 
Where are my commands and scripts stored?

I was under the impression that they'd be (by default) installed in bin and sbin...I'm running Fedora 9. When I attempt to run a command like modprobe in BASH it says the command is not found...I've tried /sbin/modprobe...any other suggestions?!

honeybadger 10-04-2008 09:01 AM

locating commands
 
hi,

well i am not an expert but i think you are right - all the commands are un /bin or /sbin.

So if you say that the command is not found - it simply might no be there - BTW are you trying lsmod ???

ErV 10-04-2008 09:05 AM

Quote:

Originally Posted by ifeatu (Post 3300019)
Where are my commands and scripts stored?

I was under the impression that they'd be (by default) installed in bin and sbin...I'm running Fedora 9. When I attempt to run a command like modprobe in BASH it says the command is not found...I've tried /sbin/modprobe...any other suggestions?!

"commands" are normally stored in /bin, /usr/bin, /usr/local/bin and /sbin. modprobe is stored in /sbin, and you can't ran it as normal user, only as root (either log in as root, or use su or sudo). Anything in /sbin isn't supposed to be run as non-root user.

Also small number of commands isn't stored anywhere (modprobe isn't one of them), but are built into shell interpreter (bash, sh, etc.)

david1941 10-04-2008 09:09 AM

I use the command "locate something" (see man locate) to get a list of "something" that is included in the full name of files on the system. This list is usually updated daily by cron, and will not include a recent addition. But the database can be updated by running "updatedb", so after installing something, run updatedb before "locate".

Dave

jschiwal 10-04-2008 10:25 AM

Programs that require root access will be found in /sbin/ or /usr/sbin/. These paths are not in a regular users PATH variable by default. /sbin/ will contain your core administrative programs that you need to operate and manage a system. Some commands like mkinitrd may be bash or perl scripts. They are in /sbin/ or /user/sbin/ as well. Scripts that you write yourself normally go in ~/bin/.

The /usr/ directory is an alternate install base with it's own hierarchy for user programs. It contains the same bin/,sbin/,lib/ directories for user packages.

The /usr/local/ directory is another alternate directory hierarchy, also containing many of the same bin/, sbin/, lib/ subdirectories. It is intended for packages you install from source that are independent of your distro. The distribution will not touch the contents /usr/local during an upgrade or install. You may want this directory to be mounted on its own partition, and not format this partition when performing a fresh install. This will allow you to retain the contents between installs.

A package that installs the programs in /usr/bin/ will install the libraries in /usr/lib/.

For administrative programs that need root access, use "sudo" and enter the full pathname.

david1941 10-04-2008 03:14 PM

There is a generally used standard as to where things are in a Linux system described here: http://www.linuxjournal.com/article/1104. But the use is changed dramatically by the user via the $PATH variable. Sometimes a rather simple change in the path will cause different commands to be executed as different commands with the same filename get installed either unknowingly or, unwittingly in improper directories. One should always check the $PATH's effect by running the command which <command> without a path to see if the proper command will indeed be used.

Dave

reddazz 10-04-2008 03:22 PM

On many Linux systems, administrative commands in the */sbin directories can only be run as root unless you append those directories to your path. Some distros e.g. Ubuntu don't follow this convention, but they are not the norm.

salasi 10-05-2008 03:41 AM

Quote:

Originally Posted by david1941 (Post 3300036)
I use the command "locate something" (see man locate) to get a list of "something" that is included in the full name of files on the system. This list is usually updated daily by cron, and will not include a recent addition. But the database can be updated by running "updatedb", so after installing something, run updatedb before "locate".

Dave

That's what I do too, but you have to take into account that increasingly distros don't install 'locate' (sometimes called 'slocate' as a package, or is part of a bigger group) by default. I think this is because of the increasing number of gui/desktop search options, but, whatever the cause, the OP might have to install an extra package to get it.

Note also that if you get too much output from 'locate' a formulation like 'locate this | grep -i /sbin' would give just the instances of the string 'this' in filenames within sbin.

ifeatu 10-05-2008 10:27 PM

thank you!
 
Thank you all for your responses loads of help...I'll give you feedback once I take all suggestions into account.

ifeatu 10-06-2008 11:08 AM

Thanks
 
Quote:

Originally Posted by david1941 (Post 3300036)
I use the command "locate something" (see man locate) to get a list of "something" that is included in the full name of files on the system. This list is usually updated daily by cron, and will not include a recent addition. But the database can be updated by running "updatedb", so after installing something, run updatedb before "locate".

Dave

Thanks so much for this!! This is what I was looking for!


All times are GMT -5. The time now is 06:51 AM.