0

I have a bash script which copies one drive to another which is working fine. I am using the -v option so it outputs on the terminal as it performs the operation.

Is it possible to log out of the terminal and then log back in again to see how far it has got?

Jens
  • 69,818
  • 15
  • 125
  • 179
Ian Barber
  • 133
  • 8

1 Answers1

2

Yes Ian,

There's this beautiful program called "screen" which gives you such use case.

List of useful Steps:

  1. Spawn a new screen session by typing screen
  2. Enter your rsync command here with -v parameter
  3. Detach your current screen session using ctrl + a + d
  4. This will bring you to a main terminal session
  5. Query all live sessions using screen -ls
  6. Once you confirm the screen id you want to login/re-attach to, use the command screen -r "id" to regain the access

Some more resources for reference: https://www.tecmint.com/screen-command-examples-to-manage-linux-terminals/

tmux is another program that gives you similar functionality.

Hope this helps. Thanks.

Suchandra T
  • 569
  • 4
  • 8
  • `screen` is not really necessary if you learn to run noninteractive jobs in the background. Redirect output to a file; examine that file from any convenient terminal when you need to see the progress. – tripleee Apr 03 '23 at 17:42
  • True. pushing tasks to the background and redirecting op/error to a file. the author wanted to log back to the previous state. That's why suggested the screen. – Suchandra T Apr 03 '23 at 17:45