dont execute command just add it to history as a comment, handy if your command is not "complete" yet

#command

4
By: e7__7dal
2011-09-15 09:49:32

These Might Interest You

  • What this does is, if I type ?ssh ? then hit the page-up key, it will complete the line to the last time in my history file that I typed ssh. Hitting page up again will go to the 2nd to last time I typed it. Incredibly handy if you ever type the same commands more than once. credit goes to http://www.sharms.org/blog/2009/03/10/make-your-bash-shell-cool-again/ echo "\"\e[6~\": history-search-forward" >> ~/.inputrc


    0
    echo "\"\e[5~\": history-search-backward" >> ~/.inputrc
    silbermm · 2009-03-10 15:32:52 6
  • This runs a command continuously, restarting it if it exits. Sort of a poor man's daemontools. Useful for running servers from the command line instead of inittab.


    -1
    doloop() { DONT=/tmp/do-run-run-run; while true; do touch $DONT; (sleep 30; rm $DONT;) & $1 ; if [ -e $DONT ]; then echo restarting too fast; return ; fi ; done }
    evil_otto · 2009-02-21 02:11:18 0
  • I was surprised to find that with RedHat bash, I could not find any comment lines (begining with #) in my bash shell history. Surprised because in Mageia Linux this works. It turns out that RedHat's bash will keep comment lines if in my .bashrc, I define: export HISTIGNORE=' cd "`*: PROMPT_COMMAND=?*?' Why have comment lines in shell history? It's a handy and convenient way to make proto-commands (to be completed later) and for storing brief text data that is searchable in shell history. Show Sample Output


    1
    export HISTIGNORE=' cd "`*: PROMPT_COMMAND=?*?'
    mpb · 2011-10-18 19:58:39 0
  • If the HISTTIMEFORMAT is set, the time stamp information associated with each history entry is written to the history file, marked with the history comment character. Show Sample Output


    0
    echo 'export HISTTIMEFORMAT="%d/%m/%y %T "' >> ~/.bash_profile
    99RedBalloons · 2013-09-19 03:25:14 0

What Others Think

I do that one all the time. Also, this: command #comment_that_is_easy_to_grep Also, when pasting in a command, I'll stick a hash in front first, paste in the command, double check the command to be sure it's correct, and then hit , , and then . This keeps me from doing a fat-finger by mistake
unixmonkey365 · 349 weeks and 2 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. 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.

Share Your Commands



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: