How to Manage Processes Using the Terminal [Mac]

One of the most frustrating moments that a person can experience is the untimely appearance of the spinning rainbow wheel. It’s an inconvenience at its best and a sign of temporary death for whatever program one may be working in at its worst. If you’re getting taunted by that rotating circle of colors, then it might be time to start taking action against it. We’ve got a few commands you can take into Terminal to combat that colorful bringer of death.Note: For experienced Linux users, these commands are very basic and child’s play, but for Mac users who are too used to the graphical interface, having a knowledge of these commands will help you out when your system is not responding. For new Linux users, the following tricks will work on your system too.

Monitoring Your Processes

First and foremost, you’ll want to be proactive with your Terminal use to keep applications from going terminal. The best way to do this is to monitor disk activity. To take a look at what’s going on in your Mac at any given time, open up the Terminal and type

top

This will present you with a listing of everything that is happening under the hood of your machine.

Included in this read out are the processes that are running on your system. They are shown on the bottom half of the screen. The information that is laid out across the screen may seem hard to read, but there are a few important details that you can glean from the Terminal. Important areas to check include the

%CPU – which tells the amount of CPU the given process is utilizing

Time – which denotes the accumulated amount of time an application has taken up.

PID, or Process Identification – This number will come in handy when dealing with a specific individual application or process.

If you’d like to find a specific application to focus your attention on – perhaps for being particularly problematic to you – that isn’t showing up within your list, you can find it within the Terminal command lines by using the command

ps-ax|grep[application name]

For example, if you were to “ps -ax | grep TextEdit,” the Terminal would spit out information about that application, including that ever important PID number.

Killing a Process

Once you have the PID of a troublesome process, you can eliminate your struggles with ease without leaving the terminal. This is where the Terminal becomes your sword against the sworn enemy, the spinning rainbow wheel.

With the PID of your problem process, type in the command

kill-9 PID

The “-9″ in the command line dictates to the Terminal that your command is not ignorable, essentially guaranteeing to you that the execution will take place.

If you still have problems killing the program, it could be possible that program isn’t being run by you and instead is the action of the root user. There is a work around for this. Simply add “sudo” to the front of your command, making the full line read as

sudokill-9 PID

This command will then prompt a administrative password request which when fulfilled will complete the kill request.

Using the Terminal can be an affective way to monitor and manage your processes and their functions within your computer. If you notice a process that you don’t recall launching, are having difficulties with a particular program, or simply need to free up some of your CPU, these commands for your Terminal should be kept close. Use them with care, because a typo command could be problematic. Following the directions above should lead to a satisfying way to manage your machine.