Hide

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again.

Delete that bloated snippets file you've been using and share your personal repository with the world. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.


If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/

Get involved!

You can sign-in using OpenID credentials, or register a traditional username and password.

First-time OpenID users will be automatically assigned a username which can be changed after signing in.

Hide

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for:

Hide

News

2011-03-12 - Confoo 2011 presentation
Slides are available from the commandlinefu presentation at Confoo 2011: http://presentations.codeinthehole.com/confoo2011/
2011-01-04 - Moderation now required for new commands
To try and put and end to the spamming, new commands require moderation before they will appear on the site.
2010-12-27 - Apologies for not banning the trolls sooner
Have been away from the interwebs over Christmas. Will be more vigilant henceforth.
2010-09-24 - OAuth and pagination problems fixed
Apologies for the delay in getting Twitter's OAuth supported. Annoying pagination gremlin also fixed.
Hide

Tags

Hide

Functions

Commands tagged prompt from sorted by
Terminal - Commands tagged prompt - 8 results
export MYSQL_PS1="mysql://\u@\h:/\d - \R:\m:\s > "
2012-11-03 18:22:16
User: Testuser_01
Functions: export
0

You can put this into your shell sourced file like .bashrc or .zshrc to have a different mysql prompt.

See http://dev.mysql.com/doc/refman/5.1/de/mysql-commands.html for more informations.

Beware that currently with mysql 5.5 the seconds are buggy and won't be displayed if you put this into a .cnf file. With the enironment variable this will work.

export PROMPT_COMMAND=$PROMPT_COMMAND'; export PWD_UPCASE="${PWD^^}"'; export PS1='C:${PWD_UPCASE//\\//\\\\}>'
2012-04-30 20:09:49
User: chungy
Functions: export
0

(This may be specific to bash only.) This transforms the current working directory to all uppercase characters and replaces forward slashes with backslashes, prepending the string with "C:" and appending a single ">". It serves no practical purpose, but may serve as a great practical joke if you can insert it to some victim's .bashrc :-)

export PS1="C:\$( pwd | sed 's:/:\\\\\:g' )> "
2010-03-29 13:55:52
Functions: export
Tags: prompt dos joke
5

This one eliminates the additional backslash at the end (which is not necessary)

export PS1="C:\$( pwd | sed 's:/:\\\\\\:g' )\\> "
alias PS1="man bash | sed -n '/ASCII bell/,/end a sequence/p'"
2010-01-15 23:39:28
User: haivu
Functions: alias
Tags: bash prompt ps1
3

I use this command (PS1) to show a list bash prompt's special characters. I tested it against A flavor of Red Hat Linux and Mac OS X

export PS1="\e[0;34m[\u\e[0;34m@\h[\e[0;33m\w\e[0m\e[0m\e[0;34m]#\e[0m "
2009-12-13 18:35:06
User: decept
Functions: export
2

blue and yellow colored bash prompt for a Hanukkah celebration on your box

PROMPT_COMMAND=command
2009-10-15 06:01:18
User: haivu
Tags: bash prompt
1

For example, if you are the type who type ls very often, then

PROMPT_COMMAND=ls

will ls after every command you issue.

export PS1='\[\033[0;35m\]\h\[\033[0;33m\] \w\[\033[00m\]: '
2009-03-18 22:05:48
User: kamiller
Functions: export
Tags: color prompt
5

It colors the machine name and current directory different colors for easy viewing.