A script essentially is a simple text file. You can copy it anywhere in the same way as you copy regular files.
If you want to copy using the terminal, you use the cp
command as in
cp "/home/user/downloads/my scripts/script.sh" "/home/user/scripts/"
"/home/user/scripts/"
in this example is the destination folder. It must exist for the cp
command to proceed. If it does not exist, create the folder first.
`mkdir /home/user/scripts/'
You are mentioning /usr/bin
This is a system folder, which would be a suitable folder for placing custom executable files that should be available for all users. You only can copy files into system folders if you have administrator (in Linux also known as 'super user' or 'root') rights. In that case, you can precede the command with sudo
, i.e., "act as super user", as in
sudo cp "/home/user/downloads/my scripts/script.sh" "/usr/bin"
The sudo
command will request your login password. If your account has root privileges, the command will be executed after you successfully entered your password.
That said, only change system files if you are absolutely sure what you want to achieve. If you want to use your custom scripts only for your self, it is a much better approach to create a "bin" folder in your own home folder. Whenever you open a terminal, Ubuntu automatically will include your private bin folder in the program path. As a result, you, but only you, will be able to execute the script simply by typing its name in the terminal. This eliminates any risk of you breaking the system by working in system folders.