Find the answer to your Linux question:
Results 1 to 3 of 3

Thread: executables

Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux User GNU_man's Avatar
    Join Date
    Apr 2005
    Canada, eh


    How do I make a program execute just by typing the filename, instead of always having to type ./<filename> I think there is a way with chmod but don't know how.

    PTL x10 Hallelujah!
    AMD Athlon XP 2600+ 512MB RAM Dual 80G WD HD 8MB Cache (1 WinXP Home, 1 CentOS 4.2) GeForce Ti4200 128MB SB Live! 5.1
    Registered Linux user #391521

  2. #2
    Linux Guru smolloy's Avatar
    Join Date
    Apr 2005
    CA, but from N.Ireland
    You can either,
    1/ Put the executable in your path. (Find out your path by typing "echo $PATH)
    2/ Put a link to the file in your path. If the executable is /home/username/exefile, then do this,
    cd /usr/bin
    ln -s /home/username/exefile
    (This assumes /usr/bin is in your path, but it probably is)

    In both of these cases you will be able to execute the file by just typing exefile from any directory. My preference is always to do number 2.

    Oh yeah, both of these options assume the file is actually executable by the user trying to execute it!!
    Registered Linux user #388328 || Registered LFS user #15880
    AMD 64 X2 4600+ :: 2X1GB DDR2 800 :: GeForce 9400 GT 512MB :: ASUS M2N32 Deluxe :: 4X250GB SATAII
    Need instant help? Try us on IRC -- #linuxforums on freenode

  3. #3
    chmod has nothing to do with it.You need to put dot ie . in your PATH
    variable so that every time you issue a command the shell will
    also search in your working directory for the executable.Mind you
    this is a security risk if you are root but as an ordinary user it's ok.

  4. $spacer_open

Posting Permissions

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