Recently started using Mac Air, never touched an iOS system before, a variety of operations to catch the urgency. Mac shortcut keys Quite a lot, encountered a variety of operations will not have to Baidu, and then organized a bunch of useful or useless commands, peremptorily listed below. The subsequent encounters will add some more.
=================================================
Query the path where the run file is located
which Ant
If you have ant installed, you will see the path where the file is located
/usr/local/cellar/ant/1.9.3/bin/ant
=================================================
To view the file installation path
Whereis Android
If you have Android installed, the address of the file installation will be displayed.
Android:/usr/mac/android/usr/software/sdk/android
=================================================
1. Command+shift+3: fullscreen, save to desktop
2. Command+shift+4: Mouse selected area, save to desktop
Above two operations, if you hold CTRL at the same time, and finally saved in the Clipboard, you can com+v to paste directly to the editing interface
3. After using the command+shift+4, press the space bar, the mouse will become a small camera, when you use the mouse to a window click on the left mouse button, you have a window has been carried out.
4. After using command+shift+4, draw a gripping area, do not release the mouse, and then
(1) Press and hold the space to move this area
(2) hold down SHIFT and lock the X or Y axis to drag
(3) When you hold option, the center of the area zooms in.
Finally all will be displayed directly on the desktop.
=================================================
Window minimization
- 1. with the shortcut key command+m, it is possible to quickly minimize the current window.
- 2. using the shortcut key command+option+m, you can achieve the purpose of quickly minimizing all windows of the current application. For example, if you want to minimize multiple Finder windows at a time, you can use this shortcut key.
- 3. Use the shortcut key command+h to quickly hide all windows of the current application.
- 4. using the shortcut key command+option+h, you can quickly hide all program windows except the current application.
- 5. Use the shortcut key command+option+m+h to quickly hide all application windows.
- 6. You can also select "Double-click the window's title bar to minimize the window" in "System Preferences-general" and then double-click the window title bar to minimize the current window.
P.s. Strictly speaking, hiding and minimizing are not the same thing, although the results are similar.
7. Press the command key, then press the TAB key to switch the program, then Release tab (do not release command), and click the option key to restore the minimized window.
=================================================
Show/Hide Files
command to display Mac hidden files: Defaults write Com.apple.finder appleshowallfiles-bool true
command to hide Mac hidden files: Defaults write Com.apple.finder Appleshowallfiles-bool false
Or
command to display Mac hidden files: Defaults write Com.apple.finder appleshowallfiles YES
command to hide Mac hidden files: Defaults write Com.apple.finder appleshowallfiles NO
After you have finished, click Enter, exit the terminal, restart the Finder to reboot the Finder: mouse click the Apple flag in the upper left corner of the window and force exit-->finder--> restart
=================================================
Adding user-level environment variables
~/.bash_profile (Note: Linux is. BASHRC and Mac is. Bash_profile)
Set environment variables: Export Path=/opt/local/bin:/opt/local/sbin: $PATH
=================================================
MAC modifies the host file and
sudo vi/etc/hosts
=================================================
Add PATH environment variable
[[email protected] U-BOOT-SH4] #export path=/opt/stm/stlinux-2.3/devkit/sh4/bin: $PATH
View PATH Environment variables
[[email protected] U-BOOT-SH4] #echo $PATH
/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
Edit the PATH environment variable
# Vim/etc/profile
At the end of the document, add
Export path= "/opt/stm/stlinux-2.3/devkit/sh4/bin: $PATH"
Save, exit.
Want to take effect immediately please run
#source/etc/profile
No error is successful.
If you want to take effect immediately, you can execute the following statement
$ source. Bash_profile (This is the file name)
=================================================
Port mappings
Ports under 1000 in Mac OS are not allowed to be used by users, so Java.net.SocketException:Permission denied errors are reported when running project programs with Eclipse
There are two ways to solve this problem:
(1) Modify the Eclipse run configuration, change the 80 port to more than 1000 ports, such as 80 port to 8080 port, so that the program can be run correctly. But there will be a problem,
After the change with localhost:8080 can access the corresponding page, but then click on another page may not find another page report 404 error
(2) Do port mapping in Mac OS, this is a one-time method, that is, when the program runs, the default request 80 port of the program mapped to the request 8080 port
First, change the configuration of Eclipse, changing the default port to 8080
Next, under/etc/pf.anchors, use the command: sudo touch com.pow to open the file with VI Com.pow and add it to the file using the new file Com.pow:
RDR Pass on Lo0 inet Proto TCP from all to any port, 127.0.0.1 port 8080
Next, change the contents of the/etc/pf.conf file
in the statement: Rdr-anchor "com.apple/*" after another line, add the following:
rdr-anchor "POW"
in the statement: Load Anchor "Com.apple" from "/etc/pf.anchors/com.apple" after another row, add the following:
load Anchor "POW" from "/etc/pf.anchors/com.pow" and enter
If there is an issue that cannot be saved after the above file has been modified, use the chmod command to modify its permissions
Finally, run the command sudo pfctl-f/etc/pf.conf reload the configuration file, and run the command sudo pfctl-e to enable the new configuration
To unlock port mappings, run the command: sudo pfctl-d
=================================================
Modify file Permissions
sudo chmod-r 777 file name
=================================================
Direct access to a folder in the Finder
Command+shift+g
=================================================
Forcing an application to close
Command+option+shift+esc
=================================================
Add a desktop shortcut
Drag the icon you want to add to your desktop, then press and hold command+option, drag the icon to the desktop, and then drop
=================================================
Line wrapping in Excel cells
Any two of the Command, Option, and control three, and then press ENTER
=================================================
VI command Daquan (same as Linux, here is a little column)
"Command to enter VI"
VI filename Opens or creates a new file and places the cursor at the beginning of the first
VI +n filename Opens the file and places the cursor at the beginning of nth
VI + filename Opens the file and places the cursor at the beginning of the last line
VI +/pattern filename Opens the file and places the cursor at the first string that matches the pattern
Vi-r filename has crashed during the last edit with VI and restored filename
VI filename1 filename2 Filename3 ... Open multiple files, edit them sequentially
"Move Cursor Class command"
H cursor moves left one character
L MOVE the cursor right one character
Space cursor moves right one character
Backspace cursor moves left one character
K or ctrl+p moves the cursor up one line
J or CTRL + N cursor moves down one line
Enter cursor moves down one line
W or W cursor moves right one word to the beginning of the word
B or b The cursor moves left one word to the beginning of the word
E or e The cursor moves right one word to the end of the word
The cursor moves to the end of the sentence
(The cursor moves to the beginning of the sentence
The cursor moves to the beginning of the paragraph
{cursor moves to end of paragraph
NG cursor moves to the beginning of nth
n+ cursor down n rows
N-the cursor moves up n rows
n$ cursor to end of Nth line
H cursor moves to the top line of the screen
M: Move the cursor to the middle line of the screen
L: The cursor moves to the last line of the screen
0: (note is the number 0) cursor moves to the beginning of the current line
$: Cursor moves to the end of the current line
"Screen Tumbling Class command"
Ctrl+u: First half screen to file
Ctrl+d: Half-screen to the end of the file
CTRL+F: Flip a screen to the end of a file
ctrl+b; Turn one screen to the top of the file
NZ: Rolls line N to the top of the screen and scrolls the current line to the top of the screen when n is not specified.
"Insert text Class command"
I: Before the cursor
I: At the beginning of the current
A: After the cursor
A: At the end of the current line
O: A new line below the current line
O: New row above the current line
R: Replace the current character
R: Replaces the current character and its characters until the ESC key is pressed
S: replaces the specified number of characters with the input text starting at the current cursor position
S: Deletes the specified number of rows and replaces them with the input text
NCW or NCW: Modifies a specified number of words
NCC: Modifying a specified number of rows
" Delete command "
NDW or NDW: Delete the n-1 characters at the beginning and after the cursor
Do: Delete to the beginning of the line
d$: Delete to end of line
NDD: Deletes the current line and its subsequent n-1 rows
X or x: Deletes a character, x deletes the cursor, and x deletes the cursor before the
ctrl+u: Delete text entered under input mode
"Search and Replace command"
/pattern: Searches for pattern at the end of the file from the beginning of the cursor
? pattern: Searches for pattern from the beginning of the cursor to the top of the file
N: Repeat the last search command in the same direction
N: Repeats the last search command in the opposite direction
: s/p1/p2/g: Replaces all P1 in the current row with P2
: n1,n2s/p1/p2/g: All P1 in line N1 to N2 are replaced with P2
: g/p1/s//p2/g: Replace all P1 in the file with P2
"Option Settings"
All: List all option settings
Term: Set terminal type
Ignorance: ignoring case in search
List: Display tab stops (CTRL+I) and end-of-line flags ($)
Number: Show line numbers
Report: Displays the number modified by the line-oriented command
Terse: Displays a short warning message
Warn: Displays no write message if the current file is not saved when you go to another file
Nomagic: Allows the use of special characters that are not preceded by "\" In search mode
Nowrapscan: Prohibit VI from the other end when the search reaches the end of the file
MESG: Allow VI to display information that other users write to their terminal using write
"Line-mode command"
: N1,N2 CO N3: Copy the contents of the N1 line to the N2 row below the N3 line
: n1,n2 m N3: Move the contents of the N1 line to the N2 line below the N3 line
: n1,n2 d: Delete the contents of N1 rows to N2 rows
: w: Save current file
: E filename: Open file filename for editing
: x: Save current file and exit
: Q: Exit VI
: q!: Do not save file and Exit VI
:!command: Execute shell command
: n1,n2 W!command: The contents of the N1 line to the N2 line in the file are entered as command and executed, and if N1,N2 is not specified, the entire file content is entered as the command
: R!command: The output of command commands is placed in the current line
"Register Operation"
"? Nyy: Saves the contents of the current row and its next n rows to the register?" , where? is a letter, n is a number
"? NYW: Saves the current line and its next n characters to the register?" , where? is a letter, n is a number
"? Nyl: Saves the current line and its next n characters to a register?" , where? is a letter, n is a number
"? P: Remove the Register?" and place it at the cursor position. Over here? Can be a letter, or it can be a number
NDD: Deletes the current line and its total n lines of text, and places the deleted content in the 1th delete register.
Mac Command Learning and accumulation