Search code examples
bashrsync

Log back into terminal to see how rsync is doing


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?


Solution

  • 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.