transfer
Transfer files
scp
(user@src)_$: scp <file> <user>@<IP dst>:<directory dst>
nc
(user@dst)_$: nc -l 8888 > file.bak
(user@src)_$: nc <IP dst> 8888 < file
You can also use cat
but it will be probably slower:
(user@dst)_$: nc -l 8888 > file.bak
(user@src)_$: cat file | nc <IP dst> 8888
You can use pv
to display a progress bar:
(user@src)_$: apt-get install pv
(user@dst)_$: nc -l 8888 > file.bak
(user@src)_$: pv file | nc 192.168.1.16 8888
3.72GB 0:00:56 [62.7MB/s] [=============================> ] 49% ETA 0:00:57
Python 2:
(user@src)_$: python -m SimpleHTTPServer 8080
(user@dst)_$: wget http://src:8080/file
Python 3:
(user@src)_$: python3 -m http.server 8080
(user@dst)_$: wget http://src:8080/file
Get maximum transfer speed
(user@dst)_$: nc -l 8888 > /dev/null
(user@src)_$: pv /dev/zero | nc <IP dst> 8888
Limit maximum transfer speed
To 200 Kbit/s:
(user@src)_$: scp <file> <user>@<IP dst>:<directory dst> -l 200
To 50KB/s: (50KB/s == 400Kbit/s)
(user@src)_$: scp <file> <user>@<IP dst>:<directory dst> -l 400
Change the transfer process’ priority
A process has a higher priority when you lower its niceness (NI) value which ranges from -20 to 19. Thus a process with niceness -20 has the highest priority. The niceness must not be confused with the kernel priority (PR) which can not be manually modified.
If the transfer is not going fast enough, we can increase the priority of the transfer process.
Get process PID:
_$: ps aux | grep nc
<PID>
Check priority (PR) and niceness (NI):
_$: top -p <PID>
Change niceness:
_$: renice -10 <PID>