I changed the settings of the standard MacOS terminal!

Terminal

Hello everyone!
This is Fuuta from the System Solutions Department.
With winter finally upon us, are you making preparations for a comfortable life, such as installing heating appliances?

This time, I'd like

to introduce some settings for
the MacBook's standard OS terminal (Terminal.app), one of the terminal emulators that serves as the foundation for using commands, to help you enjoy a comfortable command life! Having said that, I've also installed iTerm2 lol
If you search for "Mac Terminal," you'll find many articles about iTerm2, so if you're interested, try searching there too.

introduction

environment

Hardware: MacBook Air
Chip: Apple M1
Shell: zsh (some bash is also used)

What exactly is a terminal?

If you already know that, click away

When I googled it..

It is software that imitates a (physically existing) dedicated terminal and realizes its functions, and is also called a terminal emulator, terminal software, virtual terminal, etc.
You can issue commands to the OS and applications by operating the keyboard.

It can be controlled remotely using commands, and characters entered into the terminal are transmitted to the remote computer and executed.
Furthermore, 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 provide input, output, and communication to a computer!

Change the prompt display

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 descriptions differ depending on the shell, so we will only list some of them here.
If you are interested, please try setting them to your liking.

■zsh parameters
%n Username
%m Hostname
%1~ Current directory (only)
%~ Current directory (full path)
%# User type (# for root, %) for non-root
%F{color number}Color parameter%f Setting color scheme for parameters
Bash parameters
\u Username
\h Hostname
\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 setting color scheme for parametersStart

Set the following parameters for the local environment (zsh)

PS1='%n@%m:%~%#'

It will look like this!

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 will help prevent human error.
You can check the current directory with the pwd command and the current user with the whoami command, but setting these up in advance will make your work more comfortable and safe!
When logging in to a server, changing the display for each server will likely reduce mistakes, so please also refer to the article below!
[Linux] That cool thing that appears when you log in with SSH (/etc/motd)
This time, we only changed the displayed content, but there are various ways to tweak it, such as setting the color, decoration, and line breaks, so please give it a try if you're interested.
(Below, because it is a bash environment, "% -> $" is used to represent a normal user)
Change example

Transparent terminal background

By default, the background of the terminal is opaque, which can be inconvenient when entering commands while referring to data or articles.
So, let's make the background transparent!

Terminal > Settings > Profiles > Background (Color Effects) >
Change the Opacity value to your liking.

(Example) Opacity 80%

Personally, I often work while checking or referring to something, so I made it a little transparent.
This will allow me to work while looking at documents behind it!
You can also customize the font type, size, and cursor by going to "Terminal > Settings > Profile," so try changing it to your preferred environment.

Split Screen

Finally, split the screen.
In fact, in the OS standard terminal (Terminal.app), operations are synchronized when splitting the screen.
To work with multiple screens displayed, you need to open a new window (or tab), so this may be the difference between some people who choose to use a different terminal such as iTerm2.
Still, it is convenient if you are working while checking logs, etc., so being able to display multiple screens will improve your work efficiency.

Here are some basic shortcuts for splitting the screen!

split screen Command + d
Cancel split screen Command + Shift + d
Open Tab Command+t
Navigate between tabs Control + Tab
Close tab Command + w

Be careful not to confuse "Command + d (split screen)" with "Control + d (log out)".
If you're interested in other shortcuts, check out the link below!
Keyboard shortcuts for Mac's "Terminal"

Some people use iTerm2 because of their preferences for launching terminals and splitting the screen, but why not try customizing the standard terminal to suit your preferences?

If you found this article useful, please click [Like]!
6
Loading...
6 votes, average: 1.00 / 16
2,853
X Facebook Hatena Bookmark pocket

The person who wrote this article

About the author

Fuuta

I work in the System Solutions Department.
I like udon noodles
and sports.