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

today's leftovers

Leftovers: Software

  • Ocs-server 0.1 Technology Preview released! (with cats!)
    Finally, after many iterations, we have something that works! The ocs-server team (Claudio Desideri and Francesco Wofford) is therefore announcing the first release of ocs-server 0.1 technology preview.
  • 5 Less known Linux Admin Tools
  • dmMediaConverter Review - Converting Videos Has Never Been Easier
    dmMediaConverter is described by its developer as an FFmpeg frontend (GUI), but regular users only need to know that it's an application that allows them to quickly convert files from one format to another, in a simple and intuitive way. It's not the best looking out there, but it gets the job done.
  • Goggles Music Manager 1.0.7 Adds Support for Ratings and Tags to Filters, More
    On July 30, the developers of the Goggles Music Manager software, an open-source music collection manager and player that supports some of the most popular audio file formats, announced the release of version 1.0.7.
  • Semi-Official Google Drive Support For Linux Arrives, What's Next?
    Three years ago, when a user would attempt to download the Google Drive Sync Client, Google would bring them to the appropriate download page, which of course, is based off of the operating system that user is running on. If a user would attempt to download the Google Drive Sync Client while running on Linux, they’d land on a page where the message reads: “Not (yet) supported for Linux.” So, what’s the deal with Google not developing a sync client for Linux users, seeing as to how they build a lot of their things using Linux? There’s one simple answer to that, unfortunately. Windows is mainstream, so a lot of their focus is put on what a majority of people use. The bigger the market, the more money in their pockets, of course. But don’t fear, change is near!

today's howtos

Leftovers: Gaming