ShellLearning Linux Commands147Managing processesEvery time the shell executes (Web design)
ShellLearning Linux Commands147Managing processesEvery time the shell executes a command that you type, it starts a process. The shell itself is a process. So are any scripts or programs that the shell runs. Use the ps axcommand to see a list of processes. When you type ps ax, Bash shows you the current set of processes. Here are a few lines of outputfrom the ps axcommand (I also included the –cols 132option to ensurethat you can see each command in its entirety): ps ax –cols 132PID TTY STAT TIME COMMAND1 ? S 0:06 init [5] 2 ? SWN 0:01 [ksoftirqd/0] 3 ? SW< 0:00 [events/0] 4 ? SW< 0:04 [kblockd/0] 8 ? SW< 0:00 [aio/0] 5 ? SW 0:00 [pdflush] 6 ? SW 0:01 [pdflush] 7 ? SW 0:20 [kswapd0] 9 ? SW 0:00 [kseriod] 13 ? SW 0:20 [kjournald] ... lines deleted ... 8973 pts/2 R 0:00 ps ax --cols 132In this listing, the first column has the heading PIDand shows a number foreach process. PID stands for process ID(identification), which is a sequentialnumber assigned by the Linux kernel. If you look through the output of theps axcommand, you see that the initcommand is the first process andthat it has a PID or process number of 1. That s why initis referred to asthe mother of all processes. The COMMANDcolumn shows the command that created each process. The process ID or process number is useful when you have to forcibly stop anerrant process. Look at the output of the ps axcommand and note the PIDofthe offending process. Then, use the killcommand with that process number. To stop process number 8550, for example, type the following command: kill -9 8550Working with date and timeYou can use the datecommand to display the current date and time or set anew date and time. Type the datecommand at the shell prompt and you geta result similar to the following: dateMon Apr 19 21:51:33 EST 2004
In case you need quality webspace to host and run your web applications, try our personal web hosting services.