Lets say I have a script which creates a file and writes something into it (but could be anything). It could be a script that runs a set of xrandr commands to set a resolution, for example.
Is there a way in which I can create a command (working only on my system) that executes the file, even if the file is not in my working directory?
41 Answer
In Ubuntu, the default .profile adds your $HOME/bin directory to $PATH, assuming the former exists. This means that you can create a bin directory in your home, and any executables in there can be run without specifying the full path, which is what you want.
In the case of a Python script, also make sure that it's executable (chmod u+x blahblah) and it has the proper shebang on the first line, usually:
#!/usr/bin/python 1