Skip to content
Tutorial emka
Menu
  • Home
  • Debian Linux
  • Ubuntu Linux
  • Red Hat Linux
Menu

Tutorial Cara Mengubah Warna dan Font Teks pada Shell/Terminal

Posted on October 31, 2024

Skrip shell merupakan alat yang hebat untuk mengotomatisasi tugas pada sistem operasi mirip Unix. Anda bahkan bisa membuatnya terlihat lebih menarik dengan mengubah warna teks, font, dan warna latar belakang. Panduan ini akan menunjukkan cara melakukannya di skrip shell Anda.

Sebagian besar skrip shell ditulis dalam Bash (Bourne Again SHell), yang mirip dengan shell lama tetapi memiliki lebih banyak fitur. Bash membantu Anda menulis program dan juga menggunakan terminal dengan lebih mudah.

Berikut adalah beberapa kode yang berguna: “e[0m” “e[0;30m” “e[0;31m” “e[0;32m” “e[0;33m” “e[0;34m” “e[0;35m” “e[0;36m” “e[0;37m”

Latar Belakang Hitam:
Latar Belakang Merah:
Latar Belakang Hijau:
Latar Belakang Kuning:
Latar Belakang Biru:
Latar Belakang Ungu:
Latar Belakang Cyan:
Latar Belakang Putih:

Cara Mencetak Teks Berwarna

Jika Anda ingin mencetak teks berwarna hijau, berikut tampilan perintahnya:

      echo -e "e[0;32mHello, world!"
    

Flag -e memberi tahu echo untuk menggunakan urutan escape. e[0;32m membuat teks berwarna hijau, dan “Hello, world!” adalah teks yang ingin Anda tampilkan. Untuk mengembalikan warna ke normal, gunakan:

      echo -e "e[0;32mHello, world!e[0m"
    

Anda juga dapat menggunakan variabel untuk membuat skrip Anda lebih mudah dibaca:

RED='e[0;31m'
NC='e[0m' # No Color
echo -e "I ${RED}love${NC} shell scripting"
    

Ini akan mencetak “I love shell scripting”, dengan kata “love” berwarna merah.

Tebal:
Bergaris bawah:

Misalnya:

echo -e "e[1mTeks Tebal"
echo -e "e[4mTeks Bergaris Bawah"
    

Ingat untuk mereset gaya saat selesai:

echo -e "e[1mTeks Tebale[0m"
echo -e "e[4mTeks Bergaris Bawahe[0m"
    

Anda juga dapat mengubah warna latar belakang seperti ini:

      echo -e "e[44mLatar Belakang Biru Tekse[0m"
    

Menggunakan Warna dalam Skrip Shell

Mengubah Font di Bash

Kesimpulan

Sekarang Anda tahu cara mengubah warna teks, gaya, dan latar belakang di skrip shell Anda menggunakan urutan escape ANSI. Trik ini dapat membuat skrip Anda terlihat lebih menarik dan lebih mudah digunakan. Tetapi ingat, selalu pertahankan kode Anda sederhana dan efisien.

Recent Posts

  • Is it Time to Replace Nano? Discover Fresh, the Terminal Text Editor You Actually Want to Use
  • How to Design a Services Like Google Ads
  • How to Fix 0x800ccc0b Outlook Error: Step-by-Step Guide for Beginners
  • How to Fix NVIDIA App Error on Windows 11: Simple Guide
  • How to Fix Excel Formula Errors: Quick Fixes for #NAME
  • How to Clear Copilot Memory in Windows 11 Step by Step
  • How to Show Battery Percentage on Windows 11
  • How to Fix VMSp Service Failed to Start on Windows 10/11
  • How to Fix Taskbar Icon Order in Windows 11/10
  • How to Disable Personalized Ads in Copilot on Windows 11
  • What is the Microsoft Teams Error “We Couldn’t Connect the Call” Error?
  • Why Does the VirtualBox System Service Terminate Unexpectedly? Here is the Full Definition
  • Why is Your Laptop Touchpad Overheating? Here are the Causes and Fixes
  • How to Disable All AI Features in Chrome Using Windows 11 Registry
  • How to Avoid Problematic Windows Updates: A Guide to System Stability
  • What is Microsoft Visual C++ Redistributable and How to Fix Common Errors?
  • What is the 99% Deletion Bug? Understanding and Fixing Windows 11 File Errors
  • How to Add a Password to WhatsApp for Extra Security
  • How to Recover Lost Windows Passwords with a Decryptor Tool
  • How to Fix Python Not Working in VS Code Terminal: A Troubleshooting Guide
  • Game File Verification Stuck at 0% or 99%: What is it and How to Fix the Progress Bar?
  • Why Does PowerPoint Underline Hyperlinks? Here is How to Remove Them
  • AI Bug Hunting with Semgrep
  • What is the Excel Power Query 0xc000026f Error?
  • How to Build Your Own Homelab AI Supercomputer 2026
  • Inilah Cara Mengaktifkan Fitur Vertical Tab di Google Chrome Biar Tampilan Browser Kalian Makin Lega dan Rapi
  • Inilah Alasan Kenapa elementary OS Adalah Pilihan Paling Pas Buat Pengguna macOS yang Ingin Coba Linux
  • Inilah Alasan Kenapa Windows Server Kalian Restart Terus Setelah Update April 2026
  • Inilah Alasan Layar TV Kalian Sering Kedip Hitam Saat Main Game dan Cara Mengatasinya
  • Inilah Rekomendasi HP Redmi Note RAM 12 GB dan Koneksi 5G Paling Worth It Buat Kalian
  • How to use the Wan 2.7 AI model: A complete walkthrough
  • How to Run Minimax M2-7 Locally: A Step-by-Step Guide for Beginners
  • How to Build Self-Driving Codebases with Async Agents and NVIDIA Hardware
  • How to create a professional AI influencer using Apob AI
  • How to Use AI-Powered Tools to Level Up Your Stock Market Research Game with Claude Code
  • CrownPlay Konto‑Verifizierung – Schritt‑für‑Schritt Anleitung für deutsche Spieler
  • Coronavirus disease 2019
  • La modernidad de Chamartín, distrito financiero de Madrid.
  • New Text Document
  • Apa itu Spear-Phishing via npm? Ini Pengertian dan Cara Kerjanya yang Makin Licin
©2026 Tutorial emka | Design: Newspaperly WordPress Theme