I tried changing the settings of the MacOS standard terminal!
table of contents
hello everyone!
This is Futa from the System Solutions Department.
Are you making preparations for a comfortable life, such as installing heating equipment, as winter approaches?
, we will introduce you to a comfortable command life using the MacBook OS standard terminal (Terminal.app)
, which is one of the terminal emulators that is the basis for using commands I would like to pick up some settings for the OS standard terminal (Terminal.app) and configure them based on this theme.
Having said that, I have installed iTerm2 lol
If you search for "Mac terminal", there are many articles about iTerm2, so if you are interested, please search there as well.
introduction
environment
Hardware: MacBook Air
Chip: Apple M1
Shell: zsh (also partially uses bash)
What exactly is a terminal?
If you already know this, please click and skip reading.
When I googled it...
It is software that imitates a dedicated terminal (physically existing) and realizes its functions, and is expressed as a terminal emulator, terminal software, virtual terminal, etc.
You can use the keyboard to issue commands to the OS and applications.
It can be controlled remotely using commands, and characters entered into the terminal are transferred to a remote computer and executed.
Furthermore, the characters output on the remote computer are sent back to the terminal and displayed on the terminal software screen.
It's software that imitates devices that perform input/output and communication with a computer!
Change the appearance of prompts
First, let's check the prompt display.
It is set in the environment variable PS1
echo $PS1
There are many types of parameters, and the description content differs depending on the shell, so I will only describe some of them here.
If you are interested, please try setting it according to your preference.
%n | username |
%m | host name |
%1~ | Current directory (only) |
%~ | Current directory (full path) |
%# | User type (# for root, % for non-root) |
%F{color number}parameter to add color%f | Color setting for parameters |
\u | username |
\h | host name |
\W | Current directory (only) |
\w | Current directory (full path) |
\$ | User type (# for root, $ for non-root) |
\[\e\[Color number m\] | Start setting color scheme for parameters |
\[\e\[m\] | Finish and start setting color scheme for parameters |
For the local environment (zsh), set the following parameters.
PS1='%n@%m:%~%#'
It will look like below!
futa@futa-dev:~%echo $PS1 %n@%m:%~%#
In a CUI where only text is displayed, knowing information such as the current directory (working directory) and logged-in user helps prevent human errors.
You can check the current directory with the pwd command and the current user with the whoami command, but you can work more comfortably and safely by setting them in advance!
When logging into a server, I think changing the display for each server will reduce mistakes, so please refer to the article below!
[Linux] Cool thing that appears when logging in with SSH (/etc/motd)
This time, we only changed the displayed content, but you can do various things such as setting colors, decorations, line breaks, etc. If you have one, please try the challenge.
(The following is a bash environment, so "% -> $" represents a general user.)
Transparent terminal background
By default, the background of the terminal is opaque, which is somewhat inconvenient when entering commands while referring to data or articles. .
Therefore, the background will be transparent!
Terminal > Settings > Profile > Background (color effect) >
Change the opacity value to your liking.
(Example) Opacity 80%
Personally, I often work while checking and referring to something, so I made it a little more transparent.
Now you can work while looking at the documents on the back!
You can also set the font type, size, cursor customization, etc. from ``Terminal > Settings > Profile'', so please try changing it to your preference.
split screen
Finally, split the screen.
In fact, in the OS standard terminal (Terminal.app), the operation contents are synchronized when the screen is split.
To work with multiple screens displayed, you need to open a new window (or tab), so this may be the difference for those who dare to use another terminal such as iTerm2.
Even so, it is useful if you only need to work while checking logs, etc., so being able to display multiple screens will improve your work efficiency.
Here are some rough shortcuts regarding screen splitting!
split screen | Command + d |
Cancel split screen | Command + Shift + d |
open tab | Command+t |
Move between tabs | Control+Tab |
close tab | Command+w |
Don't mistake "Command + d (split screen)" and "Control + d (logout)". .
If you are interested in other shortcuts, please check the link below!
Mac Terminal keyboard shortcuts
Some people use iTerm2 for their own preferences, such as starting a terminal or splitting the screen, but please try customizing the standard terminal to your liking!