Originally Posted by
oznick
Hi everyone!
I'm using intel fortran and c++ compilers on Ubuntu. When the code is compiled it spits out an executable.
Question:
Is it possible to tell the terminal to execute such a file by just writing it's name, without the './" ? (Right now it gives me a command-not-found error.)
Or at least associate some extension, like '.exe' to make them executable?
P.S. I know - I'm just being lazy. I never bothered with such a thing, until I started using a cluster at uni, which has some version of Ubuntu installed. And it runs these files without the "./" via ssh.
If you create a folder in your home folder and call it "bin" (without the quotes), logout and log back in. The ~/bin folder is in the system path. So dropping any executable (marked as executable in "Properties") in the new folder will allow its execution from terminal with just its name.
To check your system path use in terminal
To add other folders to your system path you can use the export command in ~/.profile.
an example from my ~/.profile file for the purpose of including 5 subfolders of ~/bin in the system path,
Code:
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$PATH:$HOME/bin"
fi
export PATH=$PATH:$HOME/bin/chroot
export PATH=$PATH:$HOME/bin/MyScripts
export PATH=$PATH:$HOME/bin/Radio
export PATH=$PATH:$HOME/bin/System
export PATH=$PATH:$HOME/bin/UDF
Any scripts or programs dropped into the above 5 custom folders are useable from terminal by their names alone (if also marked as executable in their Properties).
Bookmarks