Useful and Interesting Bash Prompts. 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. Note – to use any of these prompts, you can copy & paste the “PS1=” line directly into your terminal. To make the change permanent, paste the line to the end of your ~/. 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. Chocolatey is a package manager for Windows (like apt-get but for Windows). It was designed to be a decentralized framework for quickly installing applications and.Any time a command fails, it shows a sad face instead. Example: Code: PS1="\`if [ \$? 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. Example: Code: PROMPT_COMMAND='PS1="\[\0. W"; else echo "\\w"; fi\`]\$\[\0. Multi lines prompt. If you’re the type who wants to pack your prompt full of information, then here’s the one for you. This one is a multi- line prompt containing date/time, full path, user and host, active terminal, even file count and space usage. Example: Code: PS1="\n\[\0. Color manage your prompt. Here, I’ve collected all my “Step by Step Guides” which help you to understand basic concepts very easily. Install VMware – Step by step. After launching the X11 app (XQuartz 2.3.6, xorg-server 1.4.2-apple56) on my Mac (OS X 10.6.8), opening an terminal in X11 and running xhost +, I then ssh -Y to my. There’s nothing particularly fancy about this prompt, other than the good use of color to separate the different pieces of information. As you can see, it provides time, username, hostname, and current directory. Fairly minimal but useful. Example: Code: PS1="\[\0. Show full path. This one’s a nice, clean, minimal 2- line prompt (plus a blank line at the top). You’ve got your full path at the first line and pretty much just the username at the bottom. If you want to remove the blank line at the start of every prompt, just take out the first “\n”. Example: Code: PS1="[\[\0. Show background job count. Another nifty 2- liner, but this one’s got some info we haven’t used before. The first line is the normal user@host, with full path. On the second line we’ve got history number and a count of the jobs running in the background. Example: Code: PS1='\[\e[1; 3. H: \[\e[m\] \[\e[1; 3. Display directory information. A very elegant and nice looking prompt design. With this one we’ve got user/host, number of jobs, and date/time on the top line. Below that is current directory along with number of files in that directory and their disk usage. Example: Code: PS1="\n\[\e[3. My Prompt. And finally, the prompt I personally like to use. It’s a modification of #7, changed to take up less space and include only the information I most want in my prompt. I like the two- line style as it lets me see the full path without reducing the space for my actual commands. Example: Code: PS1="\n\[\e[3. If you’d like to share your prompt, please do so in the comments below. Free Web browsers, freeware Email Programs, FTP client, Newsgroup Readers, Internet chat software, Internet phone software, messaging, telnet, firewalls, etc.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
November 2017
Categories |