Hello and welcome on Ask Ubuntu.
Lucky you, your question does not require advanced knowledge at all!
1) Locate folders where executable are located
To be executed with only its name, a binary file must be in one of the directories present in the PATH environment variable.
The default directory for user executable files on Ubuntu is
$HOME/bin. If it doesn't exist, you can create it manually and it will be automatically added in your PATH variable.
$HOME is an environment variable that holds the path to your user's home directory, meaning that this "bin" folder is to be created in the same folder as "Documents", "Pictures", "Music"...*
To know what you have in your PATH variable, the simplest way is to open a terminal and type
echo $PATH, as suggested by vanadium.
You can also view all your environment variables with
You should get something like (plus other variables if you used
The folders are separated by ":" sign.
Every time you type a command in terminal, your OS looks into these directories until it finds a corresponding executable file!
Here you can see that there is a folder in your home directory i.e. accessible without sudo:
If you have added a bin folder manually, then you'll see it in your path (after logging out and logging back in again).
That's where your file should be!
2) Make your file executable
So ensure your file is executable by your user i.e. has x permission for "u" (graphically with right-click -> properties -> permissions depending on your distribution, in command line with
ls -l from the folder where your file stands).
Edit your script to add
#!/bin/bash on its first line if not already done.
3) Move the file into the right folder
Now, move or copy the file into
Job done :) you can now execute it from terminal by just typing file name!
4) Rename the file (optional)
If the filename of your script is "myvpn.sh", you will write "myvpn.sh" in terminal to invoke it. So if you want to call the script with just "myvpn", you have to rename your file.