Language Selection

English French German Italian Portuguese Spanish

8 Useful and Interesting Bash Prompts

Filed under
Software

Many people don’t think of their command prompt as a particularly useful thing, or even pay it much attention. To me, this is a bit of a shame, as a useful prompt can change the way you use the command line. Well I’ve scoured the Interwebs looking for the best, most useful, or sometimes most amusing bash prompts. Here, in no particular order, are the ones I’d be most likely to use on my computers.

1. Show Happy face upon successful execution

This prompt is probably the most amusing one on the list, but remains useful. The idea is that as long as your commands execute successfully, your prompt shows a happy face. Any time a command fails, it shows a sad face instead.

PS1="\`if [ \$? = 0 ]; then echo \[\e[33m\]^_^\[\e[0m\]; else echo \[\e[31m\]O_O\[\e[0m\]; fi\`[\u@\h:\w]\\$ "

2.Change color on bad command
Here’s one of my favorites. This prompt has it all. Like above, the prompt changes color if your last command failed to run successfully, but it also shortens long paths and contains the bash history number of each command for easy retrieval.

rest here




More in Tux Machines

Linux 4.0-rc2

So rc2 missed the usual Sunday afternoon timing, because I spent most of the weekend debugging an issue that happened on an old Mac Mini I have around, and I hate making even early -rc releases with problems on machines that I have direct access to. Even if it only affected old machines that actual developers are unlikely to have or at least use. Today I got the patch from Daniel Vetter to fix it, so instead of doing a Sunday evening rc2, it's a Tuesday morning one. Go get it. It works better for the delay. Other than that little one-liner i915 fix? Not much, actually. It's been a very quiet week, for being this early in the release process. Sure, 3.19-rc2 was even smaller, so it continues a trend, but that was the xmas week. I hope this low volume is just because the 4.0 merge window itself was somewhat calmer than most recent releases. But I suspect the real reason is that the driver and networking trees from GregKH and davem are pending, and didn't make rc2. We'll see. Anyway, the shortlog is appended, and testing is appreciated, Linus Read more

6 Linux-y announcements from Mobile World Congress

I earlier wrote about how Linux invaded CES 2015. The domination continues at Mobile World Congress, which kicked off this week in Barcelona. Here are some of the major announcements from MWC that show that Linux has become an unstoppable force. Read more

Jolla shows off Sailfish tablet, promises ultra-secure phone

Jolla released Sailfish OS 2.0, showed off the first tablet to run the OS, and announced plans with SSH to develop a security-hardened version of Sailfish. Read more

New Ubuntu Phone Separates the App from the Data

As CIO Journal has noted, Mr. Shuttleworth envisions the rise of an Ubuntu-powered phone that runs desktop grade applications and plugs into peripherals such as large displays and keyboards. In other words, he is working to achieve true mobile-desktop-laptop convergence — the only computer you need, in your pocket, all the time. He tried to raise $32 million to fund development of such a phone, known as the Edge, in a widely publicized crowdfunding campaign on Indiegogo. The campaign ended in 2013, short of its goal. Read more