How to Customize the Mac Terminal

Contextual environments of operating systems are popular among professional users. Here’s how to personalize the Mac OS context.The terminal application is the gateway to the context of macOS .

 With a user interface and an interpreter, the terminal executes all your commands from easy to hard.

If you spend a lot of time in the terminal, you may want to personalize its environment, appearance and many features. In the following article, we will review various interesting ways to personalize this environment.

Terminal window

When you open the terminal app, there is almost nothing but two lines of text. The first line shows your last login. for example:

Last login: Wed Feb 13 01:08:35 on ttys000

The second line is where your commands enter.

Rahul-Mac:~ rahulsaigal$

The meaning of each of these terms in the second line is as follows:

The first part is your Mac device name. Two dots (:) separates your Mac name from other sections.

The second part starts with a (~). This sign indicates that you are on your way home. Below you will find a short username.

Finally, you see the dollar sign ($) which means you are logged in as a non-root user.

terminal window

Change terminal window

The terminal window works just like any other app on macOS. You can minimize, move, resize, and scroll through this window.

The text in the terminal window is relatively small and unreadable and it is difficult to identify the marker location. You can overcome this problem by resizing the window, but these changes will not be saved.

To change the terminal window, go to Shell> Show Inspector or press the +1 buttons to open the Inspector window. In the Windows section, enter values ​​in the Columns and Rowsfield sections or resize your window to fill them automatically. This will solve the problem of text size and readability.

Once you’ve reached the size, shape, and position you want, select Shell> Use Settings as Default.

modify the terminal

Change terminal appearance

The terminal by default has black text on a white background. But you can customize different features including background color, font, text color and cursor type to your liking.

Go to Shell> New Window and try a number of ready-made formats (like Grass, Homebrew, Man Page, Ocean, Red Sands).

built-in theme

All ready-made templates can be found in the Preferences> Profiles section. In this section, you will see a small preview of the template on the left and the properties of each template on the right.These features are divided into 4 sections: text, windows, tab, shell, keyboard and advanced.

To change a theme, select it and hit Duplicate Profile.

tweak theme

Text Properties

The terminal allows you to customize the various text attributes. To change the font used, click the Change button in the Font section and select a font with its size.

Bold fonts can be used to enhance the text. If you want to change the text color, click Text color and make your choice.

Block, Underline or Vertical Bar options are available to you to change the marker. Click the color button next to the word Cursor to change its color. You can also clear the terminal window by adjusting Opacity and Blur sliders.

If so, place the terminal window directly on a web page and enter commands as you read the help.

customize opacity

Window Properties

Window features include title, size, scroll restriction, and more. Remember, the settings you apply here only apply to the same profile, not the entire terminal app. To rename the window, enter the text in the Title field.

There are various checkboxes to display such as active processing, running path, shell name, etc. that you can choose from. You can change the default window size for the current template. You can also adjust the size of the scrollback buffer to save your typed instructions for days or even weeks.

customize window attribute

Shell features

Here you can fully customize how the terminal works. You can define a command to execute when rising, for example, starting another shell. It is also possible to warn the terminal before closing to prevent accidental closure. To do this, just set Ask before closing to Always. If you don’t want such a feature, just set it to Never.

customize terminal shell

Working with group windows

Do you want to have the same number of terminal windows arranged in a particular way? Group popups help you save time and improve your productivity. With this feature, each window can have its own processes, features, and location on your desktop.

For example, suppose you are editing a file with Vim in one window and running Octave in another.You may want to use different templates and layouts in your windows. You may also want to run some of your heavy and long workouts in a new window.

terminal windows groups

Save a group window

Before having a group popup you need to have the following:

– Arrange the windows on your screen the way you want it to.

– Customize the properties of each window as desired.

– Enter any command you want to continue in each.

Then select Window> Save Windows as Group. Select a name for your group and tick Use window group when Terminal starts. Click Save at the bottom.

save window group

Restore a group window

Select Window> Open Window Group to use the saved group window. This way you can run your group windows anytime, in addition to working on the current shell.

Open Preferences> Window Groups to enter, exit or delete group windows and click the gear image.

manage-window-groups-in-terminal

Launching the default shell

The default shell in Macavas is the bash shell. Various shells, such as / bin / bash / bin / csh, / bin / zsh, and / bin / ksh, are of course supported. Unix enthusiasts love working with the zsh shell because it has many features and supports many plugins.

If you are new to it, it is best to use the same bash shell for a while. But you need to know how to change your loose skin at the right time.

Understand the shell used

Type the following code to find out what shell you are using:

echo $0

With this command, the terminal will show you the shell name.

Change the default shell

To change the default shell on your account, go to System Preferences> Users & Groups. Click the lock image and enter the admin information. Then right-click on your name and select Advanced Options.

change-the-default-login-shell

In the popup window, change the option below the Login shell. You do not need to restart the system to make changes. Just run the terminal again.

change-the-bash-shell

To change the default shell for all users, select Terminal> Preferences and click General. Next to Shells open with, select Command (complete path) and enter the new shell path.

change-the-shell-through-terminal-preference

Command line personalization

The command line gives you the same information by default in each run. There are many sequences of characters that lead to interesting changes in the terminal.

The look of the command is stored in the variable $ PS1. When you type the following command:

echo $PS1

The text result with the default shell settings is as follows:

\h:\W \u\$
  • \ h represents the names
  • \ W indicates the current working path
  • \ u represents the current user

In Macavas, .bash_profile can contain a number of settings to determine how the shell looks and functions. .Bash_profile customizations only apply to a loose script, not to scripts. To edit .bash_profile in nano, type:

nano ~/.bash_profile

In the new line, type PS1 = “…” and enter the character sequence you want to customize. A complete list of special characters is available in the bash guide. for example:

PS1="\!\d\u\$"
  • ! Represents the date number of this command
  • \ d Date is in day / month / year format
  • \ u represents the username
  • $ Is an effective UID

After you’ve typed the sequence, press Control + O to type in the new information. Then press Control + T to save this information to the .bash_profile file. Exit the terminal and run it again to see the changes.

add-the-bash-sequence-to-the-command-prompt

A very interesting sequence is the following:

PS1="\w \! \$"

Using terminal alternatives

Terminal is the default macOS application for text commands in the last few decades. Like many other Apple apps, this app strives to strike a balance between convenience and professionalism.

To become a true professional user, you also need other capabilities. This can be done using terminal alternatives. Try a few of these alternatives and see which one is best for you.

What do you think of this article? Can you add any other useful stuff to this article? Share your views and experiences with us and other Zoomite users.

Leave a Reply

Your email address will not be published. Required fields are marked *