Hi I would like to run a script from the terminal, is there anyway to do that? For example : if I have a python script I would normally run it with this command :
python script.py
How can I run this script just by typing in the filename of the script in the terminal (even if i'm in another directory) ?
Another answer I found pretty helpful : How to run scripts without typing the full path?
You can just create symlink. Create it in /usr/local/bin. All you need is to run command:
sudo ln -s /full/path/to/your/file /usr/local/bin/name_of_new_command
After that you should make your file executable:
chmod +x /full/path/to/your/file
Now you should be able to run name_of_new_command at any time in your terminal.
Note that this is good solution only for home usage of Linux.