Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

What is the difference between ps and top command ? I see that both can display information about running processes . Which one should be used when ?

share|improve this question
add comment

3 Answers

up vote 5 down vote accepted

top is mostly used interactively (try reading man page or pressing "h" while top is running) and ps is designed for non-interactive use (scripts, extracting some information with shell pipelines etc.)

share|improve this answer
add comment

top enables you to see your processes ordered by the amount of processor power they use. ps enables you to see all your processes, or just the processes used by certain users, for example root or yourself.

top should be used to see which processes are most active, ps could be used to see which processes you (or any other user) are running currently.

for more information about how to use top and ps, run man top or man ps in your terminal ;)

share|improve this answer
add comment

top allows you display of process statistics continuously until stopped vs. ps which gives you a single snapshot.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.