- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- bash: service: command not found
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-25-2010 02:24 AM
тАО02-25-2010 02:24 AM
bash: service: command not found
When i was trying to restart or use any service, i got the error msg "bash: service: command not found" so i have to run the service from "/etc/init.d/
so can any one tell the real problem behind that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-25-2010 02:56 AM
тАО02-25-2010 02:56 AM
Re: bash: service: command not found
To solve it, edit ~/.profile and add those paths to the PATH variable (it should be defined there).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-25-2010 05:08 AM
тАО02-25-2010 05:08 AM
Re: bash: service: command not found
The administrative commands like "service" and "ifconfig" are located in /sbin or /usr/sbin, which are normally not added to regular users' PATH.
If you use "su -" or "sudo -i" (if your sudo version is recent enough) to become root, the environment of the root session is completely reinitialized and will include the sbin directories.
If you need to fix it, find out which login scripts are executed when using your favorite method of becoming root, then add this to the appropriate script:
export PATH="/sbin:/usr/sbin:/usr/local/sbin:$PATH"
MK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-25-2010 06:41 AM
тАО02-25-2010 06:41 AM
Re: bash: service: command not found
# which ifconfig
it will give you the path where this command reside
try to run it from that path
#/usr/bin/ifconfig eth0
like that
and also you can set this path in your .profile like mentioned above.
Good luck
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-25-2010 07:57 AM
тАО02-25-2010 07:57 AM
Re: bash: service: command not found
/sbin/service
That is where it is supposed to be. If its not at that location this could be the cause.
If it is in /sbin then look at the PATH variable.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-25-2010 08:14 AM
тАО02-25-2010 08:14 AM
Re: bash: service: command not found
> it will give you the path where this
> command reside
> try to run it from that path
Sure, _if_ it's already _on_ your PATH.
Otherwise, you'll be wasting your time.
man which
> Good luck
You'll need it, if you rely on advice like
this.
> /sbin/service
> That is where it is supposed to be.
That may depend on whose GNU/Linux kit you're
using. Around here, for example:
debi# service
-bash: service: command not found
debi# ls -l /sbin/service
ls: cannot access /sbin/service: No such file or directory
debi# man service
No manual entry for service
debi# uname -a
Linux debi 2.6.26-2-mckinley #1 SMP Thu Nov 5 03:58:10 UTC 2009 ia64 GNU/Linux
On the other hand:
debi# which ifconfig
/sbin/ifconfig
So, adding "/sbin" to your PATH would
probably be helpful. (Obviously, it's on
mine.)
General advice:
Especially in a Linux forum, output from
"uname -a" can be helpful when asking about
almost anything. Linux comes in many
different forms, and no one is born knowing
which one you're using.