Thursday, September 2, 2010

Programming in UNIX Environment : Commands - kill, ps, nohup, nice

The ampersand at the end of the command says that run this command and also take another from the terminal without stopping the first. It prints the process id. For stopping a process we use 'kill' command followed by process id. 'ps' command prints what that user running. Using 'nohup', the command will run even if the user logged out. 'nice' is for using another system to run our job.

$wc a* >wc.out &

$kill 6578

$ps

$ps -ag // all process that are currently running.

$nohup command & // No hangup for this command even if user logged out.

$nice expensive-command & // if your command take a lot of processor resources.

The 'at' command followed by time is to run our job at whatever time we want.

$ at 2340
There is a file '.profile' in the user's login directory, this file contains commands which the user want to run when the user logged in. A user can set things in it.

a=/long/directory/name

$cd $a

We can put 'a' as given above in our profile. So we can refer that directory by the value of shell variable.

No comments:

Post a Comment