Alas, as was mentioned, there doesn't see to be a config option to limit bandwidth. (I checked source code!)
Some possible solutions are to use an alias for scp, or perhaps a function. Bash is typically the default shell on both mac & linux, so this could work:
alias scp='scp -l 1000 '
-or-
alias scp-throttle='scp -l 1000 '
(note trailing space inside quotes!1) This would cause EVERY scp command you use to throttle bandwidth. Considering your situation, perhaps the best solution overall.
The second might be a good choice, since you could use scp for 'normal' transfers, and scp-throttle for slower transfers.
Or a function, with a bit more brains:
function scp { if [ "$*" =~ "-upload" ]; then command scp -l 1000 "$@"; else command scp "$@"; fi; }
Basically, if we find '-upload' anywhere in the arguments, we perform the transfer with the bw limit, otherwise, a normal transfer occurs.
This would allow you to continue using your multiple names/aliases to denote actions.
scp aaa titan:
- would upload normally
scp aaa titan-upload:
- would throttle
scp titan:aaa .
- normal
scp titan-upload-from-home:aaa .
- throttled
scp a-file-to-upload titan:
- oops, throttled, not intentional!
EDIT:
1 - The trailing space INSIDE the alias allows further alias expansion after the aliased command. VERY helpful/useful. Bash Man Page, __ALIASES__ section
There are several solutions for this - do you want to keep manual control of the steps and simply run through them simultaneously? The look at CSSH (if you're coming from a Linux system) or SuperPutty (if you're coming from a Windows system). If you simply want to automate everything, look at Expect.
Best Answer
Found it!!
It seems that in Ubuntu the entries in
~/.ssh/known_hosts
are hashed, so SSH completion cannot read them. This is a feature, not a bug. Even by addingHashKnownHosts no
to~/.ssh/config
and/etc/ssh/ssh_config
I was unable to prevent the host hashing.However, the hosts that I am interested in are also found in
~/.ssh/config
. Here is a script for Bash Completion that reads the entries from that file:Put that script in
/etc/bash_completion.d/ssh
and then source it with the following command:I found this guide invaluable and I would not have been able to script this without it. Thank you Steve Kemp for writing that terrific guide!