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

  • 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
  • How to Enable SSH in Oracle VirtualBox for Beginners
  • How to Intercept Secret IoT Camera Traffic
  • Build Ultra-Fast and Tiny Desktop Apps with Electrobun: A Beginner’s Guide
  • The Ultimate 2026 Coding Roadmap: How to Master Software Engineering with AI Agents
  • How to Master Cloud Infrastructure with Ansible and Terraform
  • How to Fix VirtualBox Stuck on Saving State: A Complete Guide
  • How to Run Windows Apps on Linux: A Complete Guide to WinBoat, WINE, and Beyond
  • Build Your Own AI Development Team: Deploying OpenClaw and Claude Code on a VPS!
  • How to Measure Real Success in the Age of AI: A Guide to Software Metrics That Actually Matter
  • Kubernetes Traffic Tutorial: How to Create Pod-Level Firewalls (Network Policies)
  • This Is Discord Malware: Soylamos; How to Detect & Prevent it
  • How Stripe Ships 1,300 AI-Written Pull Requests Every Week with ‘Minions’
  • How to Disable Drag Tray in Windows 11: Simple Steps for Beginners
  • About Critical Microsoft 365 Copilot Security Bug: Risks and Data Protection Steps
  • Is the $600 MacBook Neo Actually Any Good? A Detailed Deep-Dive for Student!
  • Build Your Own Mini Data Center: A Guide to Creating a Kubernetes Homelab
  • How Enterprise Stop Breaches with Automated Attack Surface Management
  • The Roadmap to Becoming a Professional Python Developer in the AI Era
  • Why Your High Linux Uptime is Actually a Security Risk: A Lesson for Future Sysadmins
  • Portainer at ProveIt Con 2026
  • How to Reset a Virtual Machine in VirtualBox: A Step-by-Step Guide
  • Inilah Cara Menghitung Diskon Baju Lebaran Biar Nggak Bingung Saat Belanja di Mall!
  • Cara Jitu Ngebangun Bisnis SaaS di Era AI Pakai Strategi Agentic Workflow
  • Inilah Rincian Gaji Polri Lulusan Baru 2026, Cek Perbedaan Jalur Akpol, Bintara, dan Tamtama Sebelum Daftar!
  • Inilah 5 Channel YouTube Membosankan yang Diam-diam Menghasilkan Banyak Uang
  • Inilah Cara Pakai Google Maps Offline Biar Mudik Lebaran 2026 Nggak Nyasar Meski Tanpa Sinyal!
  • How to Connect Claude Code to 200+ Apps Instantly with Fabi AI
  • The Ultimate Guide to Local AI: Setting Up OpenClaw with NVIDIA Nemotron-3 Super and Ollama for Free!
  • Claude Code Desktop: How to Make Your AI Assistant Work While You Sleep
  • How to Vibe Coding a Game in 2026
  • Running NVIDIA’s Nemotron-3 Super 120B Model Locally with Ollama: A Complete Guide for Young Tech Enthusiasts
  • Apa itu Spear-Phishing via npm? Ini Pengertian dan Cara Kerjanya yang Makin Licin
  • Apa Itu Predator Spyware? Ini Pengertian dan Kontroversi Penghapusan Sanksinya
  • Mengenal Apa itu TONESHELL: Backdoor Berbahaya dari Kelompok Mustang Panda
  • Siapa itu Kelompok Hacker Silver Fox?
  • Apa itu CVE-2025-52691 SmarterMail? Celah Keamanan Paling Berbahaya Tahun 2025
©2026 Tutorial emka | Design: Newspaperly WordPress Theme