nixCraft Linux Forum

nixCraft

Linux Tech Support Forum

Linux / UNIX: Adding a Directory to Your Path

This is a discussion on Linux / UNIX: Adding a Directory to Your Path within the Getting started tutorials forums, part of the Linux Getting Started category; To find the directories in your PATH, run the following command: Code: echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games Adding to your PATH Add ...


Go Back   nixCraft Linux Forum > Linux Getting Started > Getting started tutorials

Register FAQ Members List Calendar Forgotten your password? Mark Forums Read
  #1 (permalink)  
Old 08-12-2008, 08:03 PM
sweta's Avatar
Contributors
User
 
Join Date: Feb 2005
Location: New Delhi
My distro: Suse, RHEL, Vista
Posts: 154
Rep Power: 4
sweta will become famous soon enough
Default Linux / UNIX: Adding a Directory to Your Path

To find the directories in your PATH, run the following command:
Code:
echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
Adding to your PATH
Add /app1 to yor PATH:
Code:
export PATH=$PATH:/app1:/home/sweta/bin
/etc/profile file defines path for all users. Edit file
Code:
vi /etc/profile
My server /etc/profile file:
Code:
# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc

pathmunge () {
        if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
           if [ "$2" = "after" ] ; then
              PATH=$PATH:$1
           else
              PATH=$1:$PATH
           fi
        fi
}

# ksh workaround
if [ -z "$EUID" -a -x /usr/bin/id ]; then
        EUID=`id -u`
        UID=`id -ru`
fi

# Path manipulation
if [ "$EUID" = "0" ]; then
        pathmunge /sbin
        pathmunge /usr/sbin
        pathmunge /usr/local/sbin
fi
__________________
Friends - v-nessa - missyAdmin - LinuxChix
Reply With Quote
Sponsored Links
Reply

Bookmarks

Tags
export path , set path


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

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 On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
Find Unix Linux File / Directory by date And Then Copy / Move File asim.mcp CentOS / RHEL / Fedora 1 08-10-2008 04:30 AM
How can I set Path in bash shell chanderbio Shell scripting 2 06-13-2008 11:38 AM
Change /tmp path on KDE as it is too small for KDE marccarter0 Ubuntu / Debian 2 05-26-2008 10:34 PM
UNIX Display or list number of files in a current directory raj Getting started tutorials 1 12-07-2007 11:55 AM
linux setting system-wide path Linux software 1 01-28-2006 12:19 PM


All times are GMT +5.5. The time now is 01:44 AM.


Powered by vBulletin® Version 3.7.4 - Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36