Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

RedCroissant

Suspended
Original poster
Aug 13, 2011
2,268
96
Sorry if this has been posted elsewhere(I did a search and could not find this specific question). I like learning terminal and using the command line interface. I can open applications and quit them as well by running "top," finding the specific PID, and then typing "kill [PID]." But I don't like running top to find the particular Process ID of the app I would like to quit.

Is there another command that can be performed in fewer steps? Thanks in advance.
 
Code:
man killall
And you've also learned the 'man' command.

EDIT
And I haven't learned to stop editing and hit Submit to get in before simsaladimbamba.
 
Try
Code:
killall Safari
or
Code:
killall iTunes

Code:
man killall
And you've also learned the 'man' command.

EDIT
And I haven't learned to stop editing and hit Submit to get in before simsaladimbamba.

Hey Chown, I've already learned that lesson today. He even only beat me by a few seconds.

Thank you both! I'm enjoying diving into Mac OS X as of late and having a lot of fun doing it.

It's just seems weird that "quit" isn't an accepted command.
 
Code:
man killall
And you've also learned the 'man' command.

EDIT
And I haven't learned to stop editing and hit Submit to get in before simsaladimbamba.

But your reply is more helpful due to the manual command, if the OP does not know it yet.

And to be honest, I just tried the killall command the first time, which I have only learned from the Show / Hide Hidden Files in Finder tutorial. It was just a lucky guess, which I tested first of course before giving it away. It is a nice command if Force Quit using both methods does not work and Terminal is still launchable.
 
It's just seems weird that "quit" isn't an accepted command.
See:
Code:
man alias
That will probably lead you to read 'man bash' and search for the builtin 'alias' cmd. At that point you will likely run into a problem with 'man': no easy searchability. To address that, I suggest the online man pages:
https://developer.apple.com/library/mac/#documentation/darwin/reference/manpages/index.html

Then, to have the alias automatically defined each time you start Terminal.app, add it to your user-account's bash profile file (search the online bash man page for profile).
 
The killall command should only be used if there is no other way in quitting the application. There are quite a few where hitting q will quit them. Some require something like ctrl-q, ctrl-c (some apps treat this as control-break, some simply as quit), F10 or something else. It is always good to check this beforehand and the "man" command is very useful for this.
 
I agree, indiscriminate use of the 'killall' command could result in corrupted data in some applications. It's not the same as using the "Quit" menu option. What problem are you really trying to solve here? Or are you just trying to be cute with the Terminal?

A better way might be to write some Applescript which asks an app to terminate. That would better than killall.
 
A better way might be to write some Applescript which asks an app to terminate. That would better than killall.

There's also a Terminal command that can run AppleScript. It's called 'osascript', and it has a man page.

Because AppleScript uses " to identify apps by name, one may also need a working knowledge of bash quoting: e.g. single-quote (') vs. double-quote ("), backslash to escape a " between "s.
 
I agree, indiscriminate use of the 'killall' command could result in corrupted data in some applications. It's not the same as using the "Quit" menu option. What problem are you really trying to solve here? Or are you just trying to be cute with the Terminal?

A better way might be to write some Applescript which asks an app to terminate. That would better than killall.

Well, I'm not just trying to be cute with Terminal. I want to learn as much as I can and try relying more on the Terminal to use my computer. I'm enjoying using the CLI to empty trash, open apps, send email, open/duplicate/move files around. That kind of thing. It's slow-going because I have a lot of other things on my plate, but it's fun getting to know it.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.