LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 10-26-2005, 07:47 AM   #1
AndeAnderson
Member
 
Registered: Feb 2005
Location: Pennsylvania
Distribution: Debian (maybe)
Posts: 237

Rep: Reputation: 30
PATH in Debian?


I keep running into the same error with Debian while trying to use some of the basic Linux commands.

# cupsys restart
-bash: cupsys: command not found

Yet, when I type in:

# /etc/init.d/cupsys restart

it works.

Why is the PATH so restricted in Debian? How can I change or add to the PATH for Debian?

I read the Debian Reference Doc and found:

`PATH' is set by the following configuration files in this order:

/etc/login.defs - before the shell sets PATH
/etc/profile (may call /etc/bash.bashrc)
~/.bash_profile (may call ~/.bashrc)

The files listed here do not exist on my Debian Sarge stable system. So, where does Debian really keep the PATH configuration?

Command Line inputs are also somewhat confusing in Linux. Sometimes you type the command then the object, man adduser (run the man), and other times you have to type it backwards with the object then the command, cupsys -restart (the man run).

The only way to know which input to use is trial and error. This really should be a standardized item. One way or the other.
 
Old 10-26-2005, 08:43 AM   #2
farslayer
LQ Guru
 
Registered: Oct 2005
Location: Northeast Ohio
Distribution: linuxdebian
Posts: 7,249
Blog Entries: 5

Rep: Reputation: 191Reputation: 191
the path is indeed stored in /etc/profile in debian stable

/etc is not part of the path and shouldn't be part of the path. the PATH only includes locations where you would find binaries or systembinaries that would be executed by the privileged or unprivileged users. cupsys is a startup script for a service and not an binary you would normally run all the time. it's been this way on every distro I have ever worked in..

Quote:
user@debstablel:~$ more /etc/profile
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).

if [ "`id -u`" -eq 0 ]; then # uid 0 is the root user
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11"
else
PATH="/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games"
fi

echo $PATH to view your current PATH settings

in the case of:
man adduser : man is the command and adduser is the object you want a man page on... you are not executing adduser here.

adduser newuser : here you are executing addusr as the command and telling it to add the user newusr

cupsys -restart : cupsys is the executable or script and -restart is what action you want it to perform

The executable or script is ALWAYS first, the variable, or options come after.. I really don't see how this is confusing, but then again I started using pc's back in the DOS days..


hope that helps to clear things up.
 
Old 10-26-2005, 09:21 AM   #3
AndeAnderson
Member
 
Registered: Feb 2005
Location: Pennsylvania
Distribution: Debian (maybe)
Posts: 237

Original Poster
Rep: Reputation: 30
Confusion was my error

Thanks farslayer, for the info.

I just wasn't thinking in the proper direction. For some reason I did not consider cupsys to be the executable. I thought that commands like -restart, -stop, -start were the system executables, just like halt or logout. I see now, from your explanation, they are just the options for the executable.

I double checked and found profile as a file. With no extension on the file name. such as .conf, I had been looking for a directory named /etc/profile with a .conf file in it.

Just another little quirk in Linux I will have to learn. Files do not require extensions to identify what they are. They can be text, scripts, configuration, executables, etc... and it is up to me to figure out what they are.

Another question about the PATH for executables.

Why aren't the executables added to the PATH or a directory, which is in the PATH, when an application is installed? I understand the need to protect system executable files, but to require the user to have to figure out which directory a script is located in before they can use seems like a very frustrating exercise, especially for new users, like me.

Why not have a directory named /usr/scripts or /usr/common for these executables and have that listed in the PATH?

Again, Thanks.
 
Old 10-26-2005, 09:47 AM   #4
dastrike
Member
 
Registered: Apr 2004
Location: Stockholm, Sweden
Distribution: Debian 'sid'
Posts: 250

Rep: Reputation: 30
Re: Confusion was my error

Quote:
Originally posted by AndeAnderson
Just another little quirk in Linux I will have to learn. Files do not require extensions to identify what they are. They can be text, scripts, configuration, executables, etc... and it is up to me to figure out what they are.
You can use the command file to investigate what type of file it is. E.g.

$ file /etc/init.d/cupsys
/etc/init.d/cupsys: Bourne shell script text executable


And typically if a file is marked executable it is executable (it is possible to have files incorrectly marked as executable though).

Quote:
Another question about the PATH for executables.

Why aren't the executables added to the PATH or a directory, which is in the PATH, when an application is installed? I understand the need to protect system executable files, but to require the user to have to figure out which directory a script is located in before they can use seems like a very frustrating exercise, especially for new users, like me.
Why not have a directory named /usr/scripts or /usr/common for these executables and have that listed in the PATH?
Executables are put into the PATH whenever suitable.
Executables suitable for exectution by regular users are placed in /bin, /usr/bin, /usr/local/bin, /usr/X11R6/bin, which are all in the PATH of a regular user.
Executables that only root should normally execute are placed in /sbin, /usr/sbin, /usr/local/sbin which are all in the PATH of the root user in addition to the above mentioned ones
Then there are special cases just like the scripts used to control services that are placed in /etc/init.d or other similar. One good reason to have them separate is that some of the scripts names are the same as the executable of which they use. E.g. the /etc/init.d/ntpdate uses the /usr/sbin/ntpdate executable. It would be ambiguous in a fashion and/or confusing to have both them in the PATH at the same time, and prefixing the service control scripts with something wouldn't really accomplish that much since as they are placed in a separate directory they are essetially effectively already prefixed, albeit with a full directory path /etc/init.d/

Last edited by dastrike; 10-26-2005 at 09:48 AM.
 
Old 10-26-2005, 09:51 AM   #5
Ygrex
Member
 
Registered: Nov 2004
Location: Russia (St.Petersburg)
Distribution: Debian
Posts: 666

Rep: Reputation: 68
About file types there is a command 'file'. It can help you to
determine a file type.
About path to executables there no frustrating at all. Why should be
directies like /etc/scripts ? If you want your script could be run then
simply place it to e.g. /usr/local/bin.
 
  


Reply



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
Samba as PDC with Debian : domain network path not found DigitAlex Linux - Networking 7 12-15-2006 05:42 PM
Image Path reference in Linux (Absolute path) javabuddy Linux - General 7 06-05-2006 07:45 AM
What is the debian way to update Library path? Akhran Debian 1 08-23-2005 09:07 AM
[Debian]gtk-config was not found in your $PATH eerf Linux - Security 1 01-18-2005 09:26 PM
How to Chnage Python's module search path (sys.path)? lramos85 Linux - Software 1 05-02-2004 06:10 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 02:32 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration