I'm running an scp
command in the background:
nohup scp file.gz root@target-host:/root/ > nohup.out 2>&1
I entered the password - I hit ctrl-z
to halt the command and restarted it with bg
, and I can confirm that it's running by executing jobs
. However, is there a way of monitoring the progress of the file transfer (i.e. if I would be running it without placing it in the background)?
Thank you.
scp run in the backgroundif it prompts for password then enter password. To bring the process back to foreground you can use 'fg' command.
Through scp command you can securely copy files without using FTP software. “nohup” command is used to run Linux command in background. Let's know more about it. Through this command the entire process will start executing in background.
SCP is an acronym for Secure Copy Protocol. It is a command line utility that allows the user to securely copy files and directories between two locations usually between unix or linux systems.
Background & Disown the Process Background the scp process ( Ctrl + Z , then the command bg .) Disown the backgrounded process ( disown ). Terminate the session ( exit ) and the process will continue to run on the remote machine.
You could use screen(1) or similar, instead of bg.
Then you can control-ad to detach and screen -d -r to reattach.
You can also log out and back in as needed, without losing the ability to reattach, so it's great over unreliable networks. It dates back to when people were doing Slip and PPP over modems, and before.
While running CentOS / Red Hat / Fedora, I simply use:
ps aux | grep scp
to check on the running scp processes. To see if they are doing anything, I like to use:
du -s -c -h *
If you are on AWS EC2
, you can switch to the section Instances to monitor network and r/w operations on the boot volume. To see what additional drives are doing, switch to the Monitoring tab in the Volumes section and select a volume.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With