Question

Quick bash/terminal question -

I work a lot on the command line, but have never really had a good idea of how to manage running processes with it - I am aware of 'ps', but it always gives me an exceedingly long and esoteric list of junk, including like 30 google chrome workers, and I always end up going back to activity monitor to get a clean look at what's actually going on.

Can anyone offer a bit of advice on how to manage running processes from the command line? Is there a way to get a clean list of what you've got running? I often use 'killall' on process names that I know as a quick way to get rid of something that's freezing up - can I get those names to display via terminal rather than the strange long names and numbers that ps displays by default? And can I search for a specific process or quick regex of a process, like '*ome'?

If anyone has the answers to these three questions, that would be amazingly helpful to many people, I'm sure : )

Thanks!!

Was it helpful?

Solution

Yes grep is good. I don't know what you want to achieve but do you know the top command ? Il gives you a dynamic view of what's going on. On Linux you have plenty of commands that should help you getting what you want in a script and piping commands is a basic we are taught when studying IT. You can also get a look to the man of jobs and I would advise you to read some articles about process management basics. :) Good Luck.

OTHER TIPS

ps -o command

will give you a list of just the process names (more exactly, the command that invoked the process). Use grep to search, like this:

ps -o command | grep ".*ome"

there may be scripts out there..

but for example if you're seeing a lot of chrome that you're not interested in, something as simple as the following would help:

ps aux | grep -v chrome

other variations could help showing each image only once... so you get one chrome, one vim etc.. (google show unique rows with perl or python or sed for example)

you could use ps to specifiy one username... so you filter out system processes, or if more than one user is logged to the machine etc.

Ps is quite versatile with the command line arguments.. a little digging help finding a lot of nice tweaks and flags in combinations with other tools such as perl and sed etc..

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top