Find the answer to your Linux question:
Results 1 to 10 of 10
If you use the Windows command prompt, it would automatically find applications and libraries in the current working directory. In Linux, this is annoying, you need to type "./[appname]" and ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Newbie
    Join Date
    Oct 2004
    Posts
    139

    Linux doesn't automatically add current directory to path


    If you use the Windows command prompt, it would automatically find applications and libraries in the current working directory. In Linux, this is annoying, you need to type "./[appname]" and "export LD_LIBRARY_PATH=." every time you change to a different directory.

  2. #2
    Linux Enthusiast
    Join Date
    Dec 2004
    Location
    Rockin' in the USA!!!
    Posts
    603
    if you _really_ can't stand this, do the following: ugh...
    Code:
    export PATH=.:$PATH

  3. #3
    Linux User zeeone's Avatar
    Join Date
    Oct 2003
    Location
    Third Stone From The Sun
    Posts
    287

    Re: Linux doesn't automatically add current directory to pat

    Quote Originally Posted by user222
    If you use the Windows command prompt, it would automatically find applications and libraries in the current working directory. In Linux, this is annoying, you need to type "./[appname]" and "export LD_LIBRARY_PATH=." every time you change to a different directory.
    And I guarantee that if you copy that info from the Winblows command line and try to run it, it will not, nor is it giving you all of the info you think you are getting.
    Keep trying, mabe you will learn something yet.
    Research, research, research before you walk the plank.
    Registered Linux User #398829

  4. #4
    Linux Newbie
    Join Date
    Oct 2004
    Posts
    139

    Re: Linux doesn't automatically add current directory to pat

    Quote Originally Posted by zeeone
    Quote Originally Posted by user222
    If you use the Windows command prompt, it would automatically find applications and libraries in the current working directory. In Linux, this is annoying, you need to type "./[appname]" and "export LD_LIBRARY_PATH=." every time you change to a different directory.
    And I guarantee that if you copy that info from the Winblows command line and try to run it, it will not, nor is it giving you all of the info you think you are getting.
    Keep trying, mabe you will learn something yet.
    If you're using the "bash" shell, put "export PATH=[some paths]:." and "export LD_LIBRARY_PATH=." in your ".bashrc" or ".bash_profile" file.

  5. #5
    Linux Newbie jeickal's Avatar
    Join Date
    Jan 2005
    Location
    Switzerland
    Posts
    114

    Re: Linux doesn't automatically add current directory to pat

    Quote Originally Posted by user222
    If you use the Windows command prompt, it would automatically find applications and libraries in the current working directory. In Linux, this is annoying, you need to type "./[appname]" and "export LD_LIBRARY_PATH=." every time you change to a different directory.
    No, it is not made to be "annoying". It is for security good practice.
    Imaging you write a script and call it "ls" then save it in a folder where you have access, let's say /tmp. Now if you get your admin to run "ls" in /tmp as root and have "." in the PATH, that will run your script instead of running the real "ls". This way you can do some nasty trick. This is why "." is not in your PATH.
    Now if you don't need this kind of security, then modify your PATH.

  6. #6
    Linux Newbie
    Join Date
    Oct 2004
    Posts
    139

    Re: Linux doesn't automatically add current directory to pat

    Quote Originally Posted by user222
    If you use the Windows command prompt, it would automatically find applications and libraries in the current working directory. In Linux, this is annoying, you need to type "./[appname]" and "export LD_LIBRARY_PATH=." every time you change to a different directory.
    For the "export LD_LIBRARY_PATH=.", you don't need to type it every time you change to a different directory. You only need to type it once for the current shell. If you start a new shell, you'll need to type it again, unless it's automatically executed when the shell starts.

  7. #7
    Linux Newbie
    Join Date
    Oct 2004
    Posts
    139

    Re: Linux doesn't automatically add current directory to pat

    Quote Originally Posted by jeickal
    No, it is not made to be "annoying". It is for security good practice.
    Imaging you write a script and call it "ls" then save it in a folder where you have access, let's say /tmp. Now if you get your admin to run "ls" in /tmp as root and have "." in the PATH, that will run your script instead of running the real "ls". This way you can do some nasty trick. This is why "." is not in your PATH.
    Now if you don't need this kind of security, then modify your PATH.
    I agree it's actually a good thing, since there's no way to disable it in DOS and Windows.

  8. #8
    Linux Newbie jeickal's Avatar
    Join Date
    Jan 2005
    Location
    Switzerland
    Posts
    114

    Re: Linux doesn't automatically add current directory to pat

    Quote Originally Posted by user222
    I agree it's actually a good thing, since there's no way to disable it in DOS and Windows.
    Unless you exploit a bug/security hole, there is no way to do anything Microsoft don't want you to do with Dos & Windows
    Isn't it one of the reasons we're using Linux?
    Nothing's better than true freedom

  9. #9
    scm
    scm is offline
    Linux Engineer
    Join Date
    Feb 2005
    Posts
    1,044
    Unless you really want to over-ride a supplied command, it's safer to add the '.' directory to the end of your PATH, not the beginning:

    export PATH=$PATH:.

    And absolutely do not add it to root's PATH.

    Steve

  10. #10
    Linux User zeeone's Avatar
    Join Date
    Oct 2003
    Location
    Third Stone From The Sun
    Posts
    287
    Good show folks, I think we have one that is learning what the word " CHOICE" is about!
    Research, research, research before you walk the plank.
    Registered Linux User #398829

Posting Permissions

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