Patricio Treviño

Patricio Treviño

Husband . Father . Developer
3total entries in terminal

Exit and quit terminal with a single command

Syntax

export TERMINAL=<TERMINAL>
alias quit='/usr/bin/osascript -e "tell application \"$TERMINAL\" to quit"; exit'
view raw syntax.sh hosted with ❤ by GitHub

Option Description
TERMINAL An environment variable with the name of the terminal you prefer (I export this in .bash_exports)

Redirecting streams to the /dev/null sink

Syntax

<operation> [n]> /dev/null [options]
view raw syntax.text hosted with ❤ by GitHub

Option Description
operation The operation whose output will be redirected.
n The stream to be redirected (see below).
options The stream redirection options.

Valid values for [n]: 1, standard out 2, standard error &, both

Using the bang command (!)

Syntax

!<option>[:p]
view raw syntax.text hosted with ❤ by GitHub

Option Description
! Use the last command
[n] Use the n-th unique command in the history
-[n] Use the command n-th lines back in the history (can be repeated commands)
[str] Use the most recent command that starts with the given string
?[str] Use the most recent command that contains the given string
:0 Use the previous command with no arguments
^ Use the first word of the previous command
:[n] Use the n-th word of the previous command
$ Use the last word of the previous command
* Use the all words of the previous command
:p Prints the matching command without executing it