Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Mac Basics and Help

Reply
 
Thread Tools Search this Thread Display Modes
Old Feb 10, 2013, 07:01 PM   #1
RedCroissant
macrumors 68000
 
RedCroissant's Avatar
 
Join Date: Aug 2011
Location: Arizona
Terminal command for quitting applications?

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.
__________________
Welcome to the Grid, Program.

27" iMac, 3.2GHz i5, 16GB RAM, 3TB HDD; 32GB iPad 1 WiFi+3G; 30GB iPod Video 5G
RedCroissant is offline   0 Reply With Quote
Old Feb 10, 2013, 07:03 PM   #2
simsaladimbamba
Guest
 
Join Date: Nov 2010
Location: located
Try
Code:
killall Safari
or
Code:
killall iTunes
simsaladimbamba is offline   0 Reply With Quote
Old Feb 10, 2013, 07:04 PM   #3
chown33
macrumors 603
 
Join Date: Aug 2009
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.
chown33 is offline   1 Reply With Quote
Old Feb 10, 2013, 07:10 PM   #4
RedCroissant
Thread Starter
macrumors 68000
 
RedCroissant's Avatar
 
Join Date: Aug 2011
Location: Arizona
Quote:
Originally Posted by simsaladimbamba View Post
Try
Code:
killall Safari
or
Code:
killall iTunes
Quote:
Originally Posted by chown33 View Post
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.
__________________
Welcome to the Grid, Program.

27" iMac, 3.2GHz i5, 16GB RAM, 3TB HDD; 32GB iPad 1 WiFi+3G; 30GB iPod Video 5G
RedCroissant is offline   0 Reply With Quote
Old Feb 10, 2013, 07:10 PM   #5
simsaladimbamba
Guest
 
Join Date: Nov 2010
Location: located
Quote:
Originally Posted by chown33 View Post
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.
simsaladimbamba is offline   0 Reply With Quote
Old Feb 10, 2013, 07:22 PM   #6
leman
macrumors 68040
 
Join Date: Oct 2008
Quote:
Originally Posted by RedCroissant View Post
It's just seems weird that "quit" isn't an accepted command.
But typing 'killall' is just so much more fun!
leman is offline   0 Reply With Quote
Old Feb 10, 2013, 08:27 PM   #7
chown33
macrumors 603
 
Join Date: Aug 2009
Quote:
Originally Posted by RedCroissant View Post
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/...ges/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).
chown33 is offline   0 Reply With Quote
Old Feb 12, 2013, 10:01 AM   #8
dyn
macrumors 65816
 
Join Date: Aug 2009
Location: .nl
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.
dyn is offline   0 Reply With Quote
Old Feb 12, 2013, 01:08 PM   #9
mfram
macrumors 6502a
 
Join Date: Jan 2010
Location: San Diego, CA USA
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.
mfram is online now   0 Reply With Quote
Old Feb 12, 2013, 01:18 PM   #10
chown33
macrumors 603
 
Join Date: Aug 2009
Quote:
Originally Posted by mfram View Post
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.
chown33 is offline   0 Reply With Quote
Old Feb 12, 2013, 01:24 PM   #11
RedCroissant
Thread Starter
macrumors 68000
 
RedCroissant's Avatar
 
Join Date: Aug 2011
Location: Arizona
Quote:
Originally Posted by mfram View Post
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.
__________________
Welcome to the Grid, Program.

27" iMac, 3.2GHz i5, 16GB RAM, 3TB HDD; 32GB iPad 1 WiFi+3G; 30GB iPod Video 5G
RedCroissant is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Mac Basics and Help

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Quitting Open Applications. Good Idea? Pndrgnsvc iPhone Tips, Help and Troubleshooting 3 Jan 26, 2014 12:57 PM
Mail command in Terminal lukestroh OS X Mavericks (10.9) 6 Dec 2, 2013 08:14 PM
Terminal command andynewfriends Mac Basics and Help 0 Jun 11, 2013 01:25 PM
Quit Terminal without quitting process? / Multiple simultaneous Firefox profiles Let's Sekuhara! Mac Programming 14 Dec 14, 2012 10:05 AM
Need command in terminal chadteetzen OS X 1 Jun 8, 2012 10:55 PM

Forum Jump

All times are GMT -5. The time now is 04:41 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC