this post was submitted on 09 Nov 2023
23 points (96.0% liked)

Linux

47976 readers
1194 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

Recently I stumbled over an article, about how to customize your shell prompt. What really surprised me, is that it lacked one of the most basic tips I learned nearly 20 years back: Always display a timestamp in the prompt, to be able to check how long a process is running or when it ended. (Don't need it daily, but every so often it saves my butt. ;-)) The other trick is to always have a colorful prompt, to easily discern where output from programs start/stop. In total my PS1 looks like this (with GIT status at the end): [\e[32m]\u[\e[m]@[\e[35m]\h[\e[m] [\e[36m]\A[\e[m] [\e[37m][[\e[m][\e[31m]\w[\e[m][\e[37m]][\e[m]$(__git_ps1 "(%s)")$

My question is, what customization, tips and tricks do you have for the shell prompt?

you are viewing a single comment's thread
view the rest of the comments
[–] vojel@feddit.de 3 points 11 months ago (1 children)

I got different colors for Kubernetes clusters. Like green for testing cluster, yellow for development and red for production. Always taking a Quick Look before I do something

[–] Kobaltauge@discuss.tchncs.de 1 points 11 months ago (1 children)

This sounds awesome. Do you change the color based on the selected cluster? Do you set an environment variable?

[–] vojel@feddit.de 2 points 11 months ago

Yes this works with powerlevel10k theme for oh my zsh.