In Ubuntu 24.04 LTS, customizing the terminal background can significantly enhance the user experience by bringing a touch of personalization, making the environment visually appealing and comfortable to utilize. If you spend long hours coding, managing systems, or performing other tasks, having a terminal background that complements your style can make a significant difference.
How to Change the Background in Ubuntu Terminal 24.04 LTS
Ubuntu 24.04 LTS offers multiple methods to change the terminal background, each catering to different user preferences and scenarios. This guide provides comprehensive steps for each method to ensure you can personalize your terminal effectively and effortlessly. Here's a comprehensive breakdown of all the methods:
Method 1: Change Background Using Terminal Preferences
This method lets you change the terminal background through the built-in preferences menu.
Step 1: Open the Terminal
Use any method to open the terminal. For example, press Ctrl + Alt + T on your keyboard.
Step 2: Access Terminal Preferences
Click the menu, which is indicated by three horizontal lines and is located in the terminal's upper-right corner.
Select "Preferences" from the drop-down menu.
Step 3: Personalize the background to your preference
Direct yourself towards the Preferences window and pinpoint the "Profiles" tab.
Select the profile you want to customize (typically, this will be the "Unnamed" or default profile).
Go to the "Colors" tab.
If the option "Use colors from system theme" is presently activated, uncheck it.
Scroll down to the "Background" section.
Step 4: Set Background Color or Transparency
Just click on the color box next to "Background color" and choose the color you desire.
To set a transparent background, adjust the "Transparency" slider to your desired level.
Step 5: Apply Changes
Now close the Preferences window to apply the changes.
Method 2: Change Background Using dconf-editor
For those who prefer visuals but still want the accuracy of typing commands, you can tweak the terminal background using a tool called dconf-editor.
Step 1: Open the Terminal
Hold down the keys Ctrl, Alt, and T at the same time to open the terminal.
Step 2: Install dconf-editor (if not already installed)
Execute the following command:
sudo apt-get install dconf-editor
Step 3: Open dconf-editor
Execute the following command:
dconf-editor
Step 4: Navigate to Terminal Preferences
In the dconf-editor window, navigate to org > gnome > terminal > legacy > profiles.
Select your profile (it will have a long string as its name).
Step 5: Change Background Settings
In the profile settings, find the background-color key to set a custom background color.
Step 6: Close dconf-editor
Close the dconf-editor to apply the changes.
Method 3: Using Gsettings Command
With this method, you may rapidly change the terminal's background color using the command line without requiring any other tool.
Step 1: Open the Terminal
To access the terminal, simultaneously press Ctrl + Alt + T.
Step 2: Use the Gsettings Command
Run the following command and note down the UUID of the profile you want to modify.
gsettings get org.gnome.Terminal.ProfilesList list
Set the desired background and text colors using the following commands.
gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:YOUR_PROFILE_UUID/ foreground-color ‘rgb(211,215,207)’
gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:YOUR_PROFILE_UUID/ background-color ‘rgb(46,52,54)’
Step 3: Apply Changes
After entering the command, your terminal foreground and background color will be changed immediately.
Make sure the system theme is not activated in the terminal preferences:
Launch the emulator for a terminal.
Click the menu, which is indicated by three horizontal lines and is located in the terminal's upper-right corner.
Proceed to the preference area.
Choose the profile that you wish to edit.
Then proceed to the "Colors" tab.
If the check box "Use colors from system theme" is activated, uncheck that box.
Apply the modifications by simply closing the Preferences window.
METHOD 4: Change the Terminal Background Color Temporarily
This method allows for a temporary change of the terminal background color.
Step 1: Open Your Terminal
To access the terminal, simultaneously press Ctrl + Alt + T.
Step 2: Run the Command to Change the Background Color Temporarily
Execute the following command in your terminal:
>printf ‘\033]11;#XXXXXX\007’
Replace #XXXXXX with the hexadecimal code of your desired color.
Step 3: Verify the Color Change
After running the command, you should see the background color of your terminal change to the color you specified.
METHOD 5: Using Shell Configuration to Customize the Terminal Background
You must add the command to your shell configuration file to permanently change the background color. This guarantees that the command runs each time a new terminal session is opened.
Step 1: Open Your Terminal
Access the terminal by simultaneously pressing Ctrl + Alt + T.
Step 2: Determine Your Shell
First, determine which shell you are using. Bash and Zsh are among the widely used shells. You can determine your current shell by executing:
echo $SHELL
If it outputs /bin/bash, you are using Bash. If it outputs /bin/zsh, you are using Zsh.
Step 3: Open the Appropriate Configuration File
Depending on your shell, you will need to open either the .bashrc file (for Bash) or the .zshrc file (for Zsh).
For Bash:
nano ~/.bashrc
For Zsh:
nano ~/.zshrc
Step 4: Command to Modify the Background Color
Move to the end of the file and append the following line:
printf ‘\033]11;#XXXXXX\007’
Replace #XXXXXX with the hexadecimal code of your desired color.
Step 5: Save and Close the File
After adding the line to your shell configuration file, save the changes by pressing Ctrl + O, then press Enter to confirm.
Now leave the nano text editor by utilizing the key combination Ctrl + X.
Step 6: Apply the Changes
Close and reopen your terminal emulator.
You can also run the following command to immediately apply the changes:
For Bash:
source ~/.bashrc
For Zsh:
source ~/.zshrc
Method 6: Customizing Terminal Prompt Background
This method allows you to easily customize the background color of the prompt in the terminal without relying on specific terminal emulator settings.
Step 1: Open the Terminal
To access the terminal, simultaneously press Ctrl + Alt + T.
Step 2: Open the .bashrc File
Navigate to your home directory.
cd ~
Open the .bashrc file using Nano using the following command:
nano .bashrc
Step 3: Set Terminal Background Color
Append this line to the .bashrc file:
export PS1=”\[\033[48;5;235m\]\u@\h:\w \$\[\033[0m\]”
Remember to replace 235 with the color code you desire.
Step 4: Save Changes and Close .bashrc File
Preserve your edits by pressing Ctrl + O, then press Enter.
Now leave the nano text editor by utilizing the key combination Ctrl + X.
.
Step 5: Apply Changes
Close and reopen the terminal, and the background color should be updated.
Conclusion:
Customizing the background of your Ubuntu 24.04 LTS terminal is easy with methods ranging from built-in preferences to command-line tweaks. Whether using the Preferences menu, or command-line tools like dconf-editor, you can adjust colors, transparency, and more to personalize your workspace. Experiment with different options to find what suits your style best, enhancing both productivity and visual appeal.
Top comments (0)