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

Samsung Galaxy S6 review

I have been pretty hard on Samsung over the past few years, but let’s be honest: the company deserved it. Time and time again, we’ve seen Samsung launch fantastic flagship smartphones that are class leaders in almost every key area. Samsung’s mobile displays are the best in the world, many of its software additions have mass appeal, and its phones are always among the best available when it comes to performance. But where design, build quality and materials are concerned, Samsung has always been at the bottom of the pile. That changes in 2015, and the Galaxy S6 is our first look at the future of flagship Samsung phones. On the inside, the S6 is everything we have come to expect from the company’s premium smartphones. And on the outside, the Galaxy S6 is like nothing we have ever seen before from Samsung. Read more

Linux-Based Firewall and Router Smoothwall Express 3.1 Service Pack 1 Released

The first Service Pack (SP) release of Smoothwall Express 3.1, an open source best-of-breed Internet firewall and router operating system designed to run on commodity hardware, has been released today with a great number of improvements over the previous stable version. Read more

Sabayon 15.04 Linux Distro Brings Xfce 4.12, Native Nvidia and AMD Video Drivers Support

The Sabayon development team had the pleasure of informing its users about the immediate availability for download of the latest monthly release of their Sabayon Linux operating system derived from the well-known Gentoo distribution. Read more

Fedora 22 Alpha Now Available For AArch64 & PowerPC64

The alpha release of Fedora 22 was released a few weeks ago for the primary CPU architectures while finally coming out today is the F22 Alpha for 64-bit ARM and PowerPC architectures. Peter Robinson announced this afternoon the Fedora 22 Alpha release for AArch64 and Power64 architectures. These alternative architecture spins of the very promising Fedora 22 are primarily focused on the Server Edition of Fedora Linux. AArch64 and Power64 users of Fedora can learn more about this first Fedora 22 development release via the mailing list announcement. Fedora 22 is expected to be officially released in May. Read more