LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 07-14-2001, 01:47 PM   #1
smash
LQ Newbie
 
Registered: Jul 2001
Posts: 2

Rep: Reputation: 0
bash: <command name> command not found


I am new to running Linux. I have Mandrake 7.2. I have just put in a 3com 3c900 NIC. I want to bring it up. I edited my /etc/config.modules file to read "alias eth0 3c90x" then I navigated to /etc/rc.d/init.d/ and ran the command network restart. I got the following message: bash: network restart: command not found. I can see the executable in the directory, but when I try to run any command from the /etc/rc.d/init.d directory I get the same error. Thanks for any help.
 
Old 07-15-2001, 08:28 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,469
Blog Entries: 54

Rep: Reputation: 2900Reputation: 2900Reputation: 2900Reputation: 2900Reputation: 2900Reputation: 2900Reputation: 2900Reputation: 2900Reputation: 2900Reputation: 2900Reputation: 2900
if its executable and ure in /etc/rc.d/init.d prepend "./" , else gotta prepend the whole path.
 
Old 07-16-2001, 04:51 PM   #3
gizmola
Member
 
Registered: Jun 2001
Location: Los Angeles, CA USA
Distribution: RedHat
Posts: 53

Rep: Reputation: 15
Quote:
Originally posted by unSpawn
if its executable and ure in /etc/rc.d/init.d prepend "./" , else gotta prepend the whole path.
What unspawn is pointing out, is that for security reasons, the current directory (ie. the "." that shows up in a directory listing you get from an ls -la) is not in the path. Thus any program or script you try and execute from the directory which contains that program, will not run, because the os can't find it. This is very different from DOS or NT CMD behavior. Unix basically can only find files that are in it's path, or which you explicitly specify their location in an absolute or relative way.

In order to override this behavior you can tell the shell to "look for the file in the current directory, by prepending "./" to the name. The . indicates the current directory, so basically you're specifying an explicit path to the file of current directory /somefile.

This is no different than if you were in another directory and specified the fully qualified filepath ie, you are in /etc and
type /etc/rc.d/init.d/network restart

Thus if you're in /etc/rc.d/init.d/ and want to run the network script, you should type

./network restart

Last edited by gizmola; 07-16-2001 at 04:54 PM.
 
Old 07-17-2001, 04:15 PM   #4
smash
LQ Newbie
 
Registered: Jul 2001
Posts: 2

Original Poster
Rep: Reputation: 0
Thanks

Thanks to all who replied. Now I see the light.
 
Old 03-13-2006, 04:51 AM   #5
/bin/bash
Senior Member
 
Registered: Jul 2003
Location: Indiana
Distribution: Mandrake Slackware-current QNX4.25
Posts: 1,802

Rep: Reputation: 46
In the RedHat/Mandrake/Fedora/Mandriva distros you can access your services with the service command, e.g.
service network status
service network start

You don't have to supply the full path and you don't have to be in the /etc/rc.d/init.d directory.
 
Old 03-13-2006, 08:48 AM   #6
denver1980
Member
 
Registered: Dec 2004
Location: Québec
Distribution: Gentoo, Kubuntu Karmic
Posts: 48

Rep: Reputation: 15
Also, in some distros like RedHat, you can modify permanently is a service starts or not at startup with
Code:
/sbin/chkconfig --list # to get all services inscribed in chkconfig and their state at each runlevel
See chkconfig's man or synopsis for more info on how to use it.

It is way easier then to make your own symbolic links in /etc/rc.d/rc[0-6].d/ !

That is why, in some scripts in /etc/init.d/, you see theses comments (this one is /etc/init.d/network) :
Code:
# chkconfig: 2345 10 90
# description: Activates/Deactivates all network interfaces configured to \
#              start at boot time.
the chkconfig tells to activate this scripts in runlevel 2-3-4-5, to start it in position 10 and stop in position 90.

That is how your machine knows to start you network interface (position 10) before your database (ex : position 80) and before your web server (ex : Apache = position 90).
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
bash: command not found hamish Linux - Newbie 7 02-23-2011 04:28 PM
bash -command not found- ALInux Linux - Newbie 3 12-30-2006 12:41 PM
bash: command not found intels_ss Linux - Newbie 5 07-20-2005 07:41 PM
-bash: cp: command not found johnlittlepeap Fedora 2 11-15-2004 08:52 AM
-bash: ls: command not found jchun Linux - General 3 11-02-2004 10:11 AM


All times are GMT -5. The time now is 08:35 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration