pavement

Path

From FreeBSDwiki
(Difference between revisions)
Jump to: navigation, search
 
m (Reverted edits by 82.114.160.35 (Talk); changed back to last version by Dave)
 
(4 intermediate revisions by 2 users not shown)
Line 2: Line 2:
  
 
'''WARNING'''
 
'''WARNING'''
Don't ever, ever, ever, for any reason, put '''.''' in your path. Placing whatever your current directory is in your path may be convinient, but it's a delightfully easy way to run the wrong file -- many unix exploits rely on getting a user (or root) to run a trojaned file with the same name as a commonly run file.
+
Don't ever, ever, ever, for any reason, put '''.''' in your path. Placing whatever your current directory is in your path may be convenient, but it's a delightfully easy way to run the wrong file -- many unix exploits rely on getting a user (or root) to run a trojaned file with the same name as a commonly run file.
 +
 
 +
'''NOTE'''
 +
Unlike in MS-DOS or Windows, the contents of your path are read once when you open your [[shell]], not dynamically read every time you try to run a program without specifying the full path to it.  So if you add a new program to one of the directories in your path, you'll have to reinitialize your path before you can run it without having to type its full path in. This can be done without logging out and back in again by issuing a [[rehash]] command.
 +
 
 +
To see your current path type in:
 +
samizdata# '''echo $PATH'''
 +
/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin:/root/bin:/opt
 +
[[Category:FreeBSD Terminology]]

Latest revision as of 13:44, 19 November 2007

Just as in MS-DOS, your path will be the directories that the OS will search for commands. Commonly, your path will include: /sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin /usr/X11R6/bin /home/[your username here]/bin

WARNING Don't ever, ever, ever, for any reason, put . in your path. Placing whatever your current directory is in your path may be convenient, but it's a delightfully easy way to run the wrong file -- many unix exploits rely on getting a user (or root) to run a trojaned file with the same name as a commonly run file.

NOTE Unlike in MS-DOS or Windows, the contents of your path are read once when you open your shell, not dynamically read every time you try to run a program without specifying the full path to it. So if you add a new program to one of the directories in your path, you'll have to reinitialize your path before you can run it without having to type its full path in. This can be done without logging out and back in again by issuing a rehash command.

To see your current path type in:

samizdata# echo $PATH
/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin:/root/bin:/opt
Personal tools