How To Exit Out Of Manual In Terminal Mac

Active8 months ago

The 'man' command in Terminal makes it easy to look up the documentation for commands on your Mac. (Remember, you can quit the manual by pressing q.). Next, one will want to consult the hardware vendor's manual for the Bits per To exit Minicom when in terminal mode press 'Ctrl-A' to get a.

When I'm done with Terminal, I want to exit it. Right now, I have three options:

  1. killall Terminal. It will end the process, but rather abruptly. I don't think this is the best idea.

  2. Call exit. I've changed the settings so exit closes Terminal. The app still appears open in the Dock though, and doesn't do what I want it to do.

  3. Right click>Quit. However, this isn't a Terminal command to exit it.

So now, what is the way I should exit and close Terminal? I've heard something about osascript but I'm not too sure. I want to exit and close, so that Terminal is no longer open, both as a window and as a process.

darksteeldarksteel

13 Answers

How To Exit Out Of Manual In Terminal Mac Address

in Terminal.app

Preferences > Profiles > (Select a Profile) > Shell.

on 'When the shell exits' chosen 'Close the window'

Sandy Chapman
8,7753 gold badges49 silver badges57 bronze badges
DukeDuke
2,0571 gold badge10 silver badges15 bronze badges
Chris Page
16.2k4 gold badges29 silver badges39 bronze badges
holygeekholygeek
12.9k1 gold badge31 silver badges45 bronze badges

In the Terminal app, Preference >>Profiles tab.

Select the Shell tab on the right.

You can choose Never Ask before closing to suppress the warning.


Actually, you should set a config on your Terminal, when your Terminal is up press +, then you will see below screen:

Then press shell tab and you will see below screen:

Now select Close if the shell exited cleanly for When the shell exits.

By the above config each time with exit command the Terminal will close but won't quit.

AmerllicAAmerllicA

In a terminal window, you can type:

This will kill the Terminal application process, which is the parent of the parent of the current process, as seen by the kill command.

To close a Terminal window from within a running script, you need to go up one more level in the process hierarchy like this:

GOTO 0GOTO 0How to exit out of manual in terminal mac os
17.8k12 gold badges81 silver badges115 bronze badges

I 've been using ctrl + d. It throws you out into the destination where You've started the sqlite3 command in the first place.

kalafunkalafun
1,7605 gold badges28 silver badges43 bronze badges

You could use AppleScript through the osascript command:

icktoofayicktoofay
106k17 gold badges211 silver badges215 bronze badges

osascript -e 'tell application 'System Events' to keystroke 'w' using command down'

This simulates a CMD + w keypress.

If you want Terminal to quit completely you can use:osascript -e 'tell application 'System Events' to keystroke 'q' using command down'

This doesn't give any errors and makes the Terminal stop cleanly.

insanikovinsanikov

You can also use this convoluted command, which does not trigger a warning about terminating its own process:
osascript -e 'do shell script 'osascript -e 'tell application 'Terminal' to quit' &> /dev/null &'; exit

This command is quite long, so you could define an alias (such as quit) in your bash profile:
alias quit='osascript -e 'do shell script 'osascript -e 'tell application 'Terminal' to quit' &> /dev/null &'; exit'

This would allow you to simply type quit into terminal without having to fiddle with any other settings.

David P.David P.

Use the osascript command in your code as icktoofay mentioned: osascript -e 'tell application 'Terminal' to quit'

Then, open Terminal preferences, go to Settings > Shell, and set 'Prompt before closing:' to 'Never.' Terminal should now quit completely (not remain open in your dock) and ignore the prompt before quitting. If you have only one Terminal window open and the osascript command is your last line of code, it should wait for whatever command you ran before to finish.

This would not be ideal if you are running scripts in the same window or other windows in the background (for instance, you may run a command in the background and continue using the current window for other commands if the first command is followed by an ampersand); be careful!

If you wrap the osascript code in a shell script file, you can probably call it with whatever pithy file-name you give it---as long as it is in Terminal's search path (run echo $PATH to see where Terminal looks for scripts).

JohnJohn

I've been using

How To Exit Out Of Manual In Terminal Mac

quit -n terminal

How To Exit Out Of Manual In Terminal Mac Os

at the end of my scripts. You have to have the terminal set to never prompt in preferences

So Terminal > Preferences > Settings > Shell When the shell exitsClose the windowPrompt before closingNever

JonJon

How To Exit Out Of Manual In Terminal Machine

cat ~/exit.scpt

like this:

  • Note: If there is only one window, just quit the application, else simulate command + w to close the tab)

tell application 'Terminal' set WindowNum to get window count if WindowNum = 1 then quit else tell application 'System Events' to keystroke 'w' using command down end ifend tell

just like vi ~/.bashrc or zshrc (anything else?)

add it:alias exit='osascript ~/exit.scpt'

SinSin

If this is a Mac you type 'exit' then press return.

TremaineTremaine

How To Exit Out Of Manual In Terminal Mac 2017

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