Results 1 to 8 of 8

Thread: Modifying your default path?

  1. #1
    Join Date
    Sep 2009
    Beans
    124

    Modifying your default path?

    So if I wanted to add a directory to my path's that are automatically searched for programs and scripts and all that whenever I type something in the terminal, how do I do it? I imagine it's something quite easy, in fact I used to know how to do it a long time go, but it's been so many years since my unix class (which was taught on red hat) I just can't remember how.

    Also, if I want to alias something, how do I make it so that it will be persistent beyond me closing the terminal?
    Anatomy of a Nerdgasm (my blog)
    Current PC's:
    Toshiba L650 Kubuntu 11.04
    Athlon MP 2800+ SMP Box - Windows XP pro

  2. #2
    Join Date
    Oct 2005
    Location
    Southern Ontario, Canada
    Beans
    1,244
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: Modifying your default path?

    create a file called .bash_profile in your home directory ( don't forget the . at the begining) and past this in it
    Code:
    #The default .bash_profile looks like this:
    # ~/.bash_profile: executed by bash(1) for login shells.
    # see /usr/share/doc/bash/examples/startup-files for examples.
    # the files are located in the bash-doc package.
    
    # the default umask is set in /etc/login.defs
    #umask 022
    
    # include .bashrc if it exists
    if [ -f ~/.bashrc ]; then
        . ~/.bashrc
    fi
    
    # set PATH so it includes user's private bin if it exists
    if [ -d ~/Software/bin ] ; then
        PATH=~/Software/bin:"${PATH}"
    fi
    edit
    if [ -d ~/Software/bin ] ; then
    PATH=~/Software/bin:"${PATH}"
    to suit your needs.

    For this to work you'll also have to set gnome-terminal to run as a login shell in your preferences.
    Last edited by Ocxic; December 7th, 2009 at 06:00 AM.
    There is an easy way, and a hard way to do things.
    If you're anything like me, you've tried to do things things the hard way,

    and broke something.......

    (\ /)
    (O.o)
    (> <)

  3. #3
    Join Date
    Sep 2009
    Beans
    124

    Re: Modifying your default path?

    And if I do that it will still keep the default paths already set in ubuntu?
    Anatomy of a Nerdgasm (my blog)
    Current PC's:
    Toshiba L650 Kubuntu 11.04
    Athlon MP 2800+ SMP Box - Windows XP pro

  4. #4
    Join Date
    Oct 2005
    Location
    Southern Ontario, Canada
    Beans
    1,244
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: Modifying your default path?

    yes it will just append to what is already there.
    There is an easy way, and a hard way to do things.
    If you're anything like me, you've tried to do things things the hard way,

    and broke something.......

    (\ /)
    (O.o)
    (> <)

  5. #5
    Join Date
    Nov 2008
    Location
    Colorado, United States
    Beans
    266
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Modifying your default path?

    Quote Originally Posted by Ocxic View Post
    yes it will just append to what is already there.
    Yes, but remember if you have two programs by the same name in different paths then the system will run the program of that name in the first path listed.

  6. #6
    Join Date
    Apr 2008
    Location
    Houston, TX USA
    Beans
    589
    Distro
    Ubuntu

    Re: Modifying your default path?

    Another option is to either move executable scripts to /usr/bin or /usr/local/bin, or create symlinks in one of those directories pointing to the actual file.
    Locke
    Try Dropbox, it's FREE! (gratis) http://db.tt/J7Sm9iC
    Try Dropbox experimental build updater http://forums.dropbox.com/topic.php?id=12153

  7. #7
    Join Date
    Nov 2005
    Location
    NEK Vermont
    Beans
    Hidden!
    Distro
    Ubuntu UNR

    Re: Modifying your default path?

    another option is to create a directory named bin in your home directory and place your programs in it...~/bin should already be in $PATH once the directory is created.

    This is performed by the file ~/.profile on my default Karmic installation.
    Last edited by spiderbatdad; December 13th, 2009 at 12:38 AM.

  8. #8
    Join Date
    Sep 2009
    Beans
    124

    Re: Modifying your default path?

    Thanks for the tips. I was essentially looking for a way to have a bunch of scripts that ran things, so this will do it!
    Anatomy of a Nerdgasm (my blog)
    Current PC's:
    Toshiba L650 Kubuntu 11.04
    Athlon MP 2800+ SMP Box - Windows XP pro

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •