Tutorial
step 1:
do sudo nano /usr/local/bin/<shell command name>
in the new file type in the shell script start it with
#!/bin/bash
after you write the bash script save it and type in the shell
sudo chmod +x /usr/local/bin/<shell command name>
then now if you type into the shell <shell command name> it will execute the program.
Explanation
linux and unix computers have a file which stores all the paths it searches through to execute a
command and /usr/local/bin is one of them.
The file also has to be executable so that's why you need to use chmod.
And because when you execute a command it starts by searching the directory you are in, then
it goes and looks through other directories like /bin and the one the program you wrote is in
(/usr/local/bin) and when it comes across the program is does the directory the program is found in (in this case /usr/local/bin) and then executes /usr/local/bin/<shell command name>