“ITerm2” is a terminal tool I use. For students who are used to terminals, this is a good command line tool. ITerm2 is favored for several reasons:

  1. Split screen mode
  2. Rich plug-ins
  3. Appearance level on line

I also do not fully know the Shell

Front-end development often doesn’t care about the * NIx kernel. The Shell is, as its name suggests, a Shell through which we interact with the kernel. The Shell of the Mac terminal is bash. Common shells include sh, bash, ZSH, and CSH. You can use the following script to view the system Shell.

cat /etc/shells
Copy the code

Bash loads ~/.bash_profile profiles when the user logs in. The ~/.bash_rc configuration is loaded when not logged in

Most users of ZSH benefit from oH-my-zsh. Its collection of plug-ins is very powerful. If a plugin has been updated, it will also use notification to kindly remind you whether or not to update.

The default configuration file for ZSH is ~/.zsh_rc, which covers themes, plug-ins, and aliases. Some global environment variables can also be exposed.

The installation

git clonehttps://github.com/ohmyzsh/ohmyzsh.git ~ /. Oh - my - ZSH / / optional backup, For those who are not familiar with.zshrc ~/.zshrc ~/.zshrc. Orig // Initialize ~/.zshrc cp ~/.oh-my-zsh/templates/ ZSHRC. Zsh-template ~/.zshrc // Switch to ZSH CHSH-s $(which zsh)
Copy the code

Post a personal copy of several key configurations:

The plug-in

More plug-ins is not always better, and too many plug-ins can lead to slow starts and sluggish performance.

plugins=(
  git
)
Copy the code

The Git plug-in allows terminals to view branches in files and supports command abbreviations

The alias

Open your editor quickly

alias subl="open -a Sublime\ Text" 
Copy the code

Subl {path} for example, to open the current ~/.zshrc, you can simply sublime ~/.zshrc.

If you are using another editor, simply replace the editor in the Application path (Finder -> Applications -> Click the icon and drag to Terminal -> PWD to find the program path). Of course, some editors also have built-in commands to open at the terminal.

A “local cross domain” solution you may not have thought of

alias chrome="open -n -a /Applications/Google\ Chrome.app/Conents/MacOS/Google\ Chrome --args --user-data-dir="/tmp/chrome_dev_test" --disable-web-security"
Copy the code

If you configure this alias, you can execute Chrome directly from the command line. This will enable the browser to disable the safe mode, and solve the cross-domain problem when the front and back end “sync” is configured.

Look at the weather

alias weather="curl -H 'Accept-Language: zh' 'http://wttr.in/beijing'"
Copy the code

When configuring the alias command, ensure that there is no space before or after an equals sign

shortcuts

Current split screen vertical cutting

command + D
Copy the code

The current split screen is cut horizontally

command + shift + D
Copy the code

Wait a minute!

It still seems inconvenient to simply execute these two commands. If Perferences is selected, the previous working directory will be reused. For example, if you run the two commands in the /Users/jojo/Developer directory, the next directory will reuse /Users/jojo/Developer. If not set, the home directory is default. Usually the code is stored in a workspace folder. Hey, maybe you don’t know this: Mac users create a Developer folder with a little hammer 🔨 icon (I usually save it in the Developer directory).

Wait!

command + shift + enter
Copy the code

Default size

ITerm2 will be small by default. Here I have colums: 500 and Rows: 100. Of course, if you are looking at the Image level, you can configure the Background Image next door.

The above is a personal habit in the development process, there will be a period of adaptation when changing a new tool, at least iTerm2 gives me a very low cost, enjoy! 🙂