2

Assume I'm scping a large file (300GB) from the corporate server to my workplace machine which I don't have ANY access to during the weekend (firewall blocks ssh to machines inside the office network); hence I can't just connect to it and see the progress. Now is there anyway for me to see the progress of that scp job when I ssh into the server with the same account from my home machine? This is of course not really useful but I'm curios anyway.

1

You can use lsof to list information on the current files opened by the scp process on the server. Find its process id with pidof scp, for example, then use lsof -p on that pid. You will also need option -o to show the current offset within the file being read by scp. Eg

$ pidof scp
29273

$ lsof -op 29273
COMMAND   PID USER   FD   TYPE DEVICE    OFFSET    NODE NAME
scp     29273  meuh  cwd    DIR  179,2            273367 /home/meuh
scp     29273  meuh  rtd    DIR  179,2                 2 /
scp     29273  meuh  txt    REG  179,2            260817 /usr/bin/scp
...
scp     29273  meuh    0r  FIFO   0,10       0t0 3005108 pipe
scp     29273  meuh    1w  FIFO   0,10       0t0 3005109 pipe
scp     29273  meuh    2w  FIFO   0,10       0t0 3005110 pipe
scp     29273  meuh    3r   REG  179,2 0t2834432     530 /home/meuh/x

The last line shows file descriptor 3 is ready to read from offset 2834432 of file /home/meuh/x. You could use watch to repeat the command and see the changes.

  • Not as user friendly as I would have wanted it to be, mainly because it outputs a hex value and not a human-friendly one but I guess that's it anyway. Thanks! – DarthPaghius Nov 25 '17 at 17:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.