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

KDE Applications 16.04 Release Schedule

The release schedule for the upcoming KDE Applications 16.04 bundle has been firmed up. The approved release schedule puts the KDE Applications 16.04 release on 20 April, while leading up to that is the dependency freeze on 16 March, the 16.04 freeze and beta release on 23 March, and the release candidate on 6 April. Read more

Manjaro 15.12 (Capella) Gets Pacman 5 Support

The Manjaro developers have released the seventh update packs for Manjaro 15.12 (Capella), which means that it's passed the halfway for support. Read more

Canonical releases Snappy Ubuntu Core Linux image for x86-based Intel NUC DE3815TY

The Raspberry Pi is a game-changing computer. While it was primarily designed as a low-cost base on which students could learn to code, it has proven to be much more. Some consumers buy it for HTPC purposes, but more importantly, developers embrace the little computer for other projects, such as IoT. Unfortunately for some developers, the ARM architecture and rather anemic performance make the Raspberry Pi a poor choice. While some consider ARM to be the future, I'm not so sure -- x86 has been surprisingly adaptable. Today, Canonical releases an Ubuntu Core image for the x86-based Intel NUC DE3815TY. Priced around $150, this NUC is more expensive than the Pi, but it is much more powerful too; a better choice for developers needing an x86 platform. Read more Also: Snappy Ubuntu Core Gets Support on Intel NUC

Nouveau Linux 4.5 vs. NVIDIA OpenGL Performance: Open-Source Not Up To Par

With the Linux 4.5 kernel bringing PCI Express link speed changes and other alterations to the open-source NVIDIA (Nouveau) driver, here are benchmarks comparing this unofficial open-source NVIDIA Linux driver on Linux 4.4 and Linux 4.5-rc3 compared to the proprietary NVIDIA Linux graphics driver. Read more