Wednesday, August 26, 2009

Some useful Linux remote commands (to me)

Sometimes I need to dial in to a remote computer running Linux to run some Linux batch processing commands which may take a while to complete. Normally, once you logged out from the remote computer, the processes that you started during the remote login session will be terminated. There is a modifier command that you can use to make sure the processes keep on running even after you logged out.

The modifier command is nohup, which stands for "no hang up". This is how it is used:

$ nohup your_long_process_command &

where your_long_process_command is obviously your long process command name.

Any processing messages printed out by your process would be rerouted to the text file nohup.out.

You can now logged out from the remote computer.

The next time you dial in to check on the status of your process, you can either review the nohup.out file with a text editor or you can run the following command to see whether it is still running in the process list.

$ ps -ef | grep your_long_process_command

If it returns a process list number, then it is still running.


No comments:

Related Posts with Thumbnails