Yes, Bash scripts again! Two scripts for copying files from server to local computer and vice versa. Usually I use them if I want to work with some text files in graphical editors, not in Vim. So I can download the file to my local computer and then upload it back to the server.
./copy-file-from-server.sh [SERVER] [FILE]
./copy-file-to-server.sh [SERVER] [FILE]
Basically, it's the same as using
scpcommand, but scripts allow you to define short names for servers. For example, instead of
something1-23-45-678-9.eu-east-0.compute.amazonaws.comyou can use short names, like
To set your own hosts in the script you need to modify function
setHost(). In the
copy-file-from-server.shscript you can also set a fixed directory where you want to download files. Currently it downloads to the same directory where script was run, but you can change it in the
Also, don't forget about
aliases! You can set some short name to the script and use it in every directory.