Home > database >  Is it possible to process something while I close my cmd?
Is it possible to process something while I close my cmd?

Time:01-14

I need to copy some files in my linux server.

If I close the cmd window after entering the cp command in the ssh connected to the cmd window, the copy process also stops.

Is there a way to make the copy (or other actions like mv or rm) persistent even if I logoff my windows PC?

CodePudding user response:

Yes, there is a way to make the copy process persistent even if you log off your Windows PC. You can use the "nohup" command in front of your "cp" command. This command allows you to run a command in the background and continue running it even after you log off.

Example:

nohup cp /path/to/source /path/to/destination &

This will start the copy process and the "&" at the end will run the command in the background. You can log off your Windows PC and the copy process will continue to run on the Linux server. You can check the status of the process using the "jobs" command.

Another way is to use "screen" command.

Then you can start your cp command, and press ctrl a d to detach your screen, you can logoff and reattach to the screen later and check the status of your cp command.

screen -r

  • Related