In this article, I recommend two things that will increase your enjoyment and productivity while working on the Mac command line.
ITerm – Better terminal emulator
To use the command line on a Mac, you rely on a piece of software called the Terminal Emulator. The terminal emulator can be thought of as a window that opens to use the Bash command line. So, to make a distinction, Bash is the actual command line, but to open the command line, you need to open the terminal emulator.
The Mac comes with Terminal simulator software called Terminal, which means Terminal in Chinese. But Termial is not the easiest terminal simulator to use. An alternative product that many developers prefer is called iTerm.
Compared with its own Terminal, iTerm has a more beautiful interface and more intimate split screen operation, so more people use it.
Oh-my-zsh — Enhanced command line functionality
Now that iTerm is available, you’ll install oh-my-zsh to further enhance the terminal emulator. From the name of the software, the core is ZSH. ZSH isn’t Bash strictly, but it’s pretty much the same to use, and you can think of ZSH as an enhanced version of Bash that doesn’t make any difference.
Please refer to the official website for installation steps. After the installation, what are the useful functions?
-
The first is that the command line promoters look a lot better. The command line prompt is the string of contents left of the cursor after a new terminal emulator window is opened. After installing oh-my-zsh, a rounded arrow shows the folder we are currently in. Then, if we jump to a Git repository, we’ll also see the branch name displayed at the prompt, such as Master.
-
The second feature is particularly useful. Execute ls on the command line to view the contents of the current folder. The command line now displays different colors for different types of elements. For example, folders are shown in blue, files are shown in gray, but files with execution permissions are shown in red, symbolic links are shown in purple, and so on.
-
Other functions of course, there are a lot of official website, such as a lot of beautiful themes can choose, for example, we want to show a cloud or a lightning prompt, and let the background and font of the entire terminal have changed color, you can install themes to achieve. In addition to changing the interface style with themes, oh-my-zsh also has a number of plug-ins that can be used to enhance the command line.
conclusion
To sum up, with iTerm and oh-my-zsh, our command line is now very nice and much more powerful.