Search for commands from the command line

clfu-seach <search words>
Search at from your terminal. Get the clfu-seach at
Sample Output

sed -n '10,20p' <filename>
Print all the lines between 10 and 20 of a file

sed '1000000!d;q' < massive-log-file.log
Efficiently print a line deep in a huge log file

sed 's/\o0/\n/g' /proc/INSERT_PID_HERE/environ
Given process ID print its environment variables

By: aurium
2009-05-14 19:54:45

These Might Interest You

  • "What it actually shows is going to be dependent on the commands you've previously entered. When you do this, bash looks for the last command that you entered that contains the substring "ls", in my case that was "lsof ...". If the command that bash finds is what you're looking for, just hit Enter to execute it. You can also edit the command to suit your current needs before executing it (use the left and right arrow keys to move through it). If you're looking for a different command, hit Ctrl+R again to find a matching command further back in the command history. You can also continue to type a longer substring to refine the search, since searching is incremental. Note that the substring you enter is searched for throughout the command, not just at the beginning of the command." - Show Sample Output

    moollaza · 2012-04-15 16:42:32 0
  • Once issuing the command, hit "esc" and then "k" (not together) to enter the search mode at the shell prompt (each time), and invoke the search with "/" as if you would in vi. Type a command and see the most recently used instance of that command. Use "n" and "N" to go forward and backwards through other instances of that command.

    set -o vi
    andykazmaier · 2009-12-22 20:40:10 3
  • Search for one/many words on commandlinefu, results in vim for easy copy, manipulation. The -R flag is for readonly can still write to a file, but vim won't prompt for save on quit. What I'd really like is a way to do this from within vim in a new tab. Something like :Tex path/to/file but :cmdfu search terms

    cmdfu(){ curl "$(echo "$@" | sed 's/ /-/g')/$(echo -n $@ | base64)/plaintext" --silent | vim -R - }
    MeanderingCode · 2012-02-10 16:26:47 0
  • [Click the "show sample output" link to see how to use this keystroke.]   Meta-p is one of my all time most used and most loved features of working at the command line. It's also one that surprisingly few people know about. To use it with bash (actually in any readline application), you'll need to add a couple lines to your .inputrc then have bash reread the .inputrc using the bind command:   echo '"\en": history-search-forward' >> ~/.inputrcecho '"\ep": history-search-backward' >> ~/.inputrcbind -f ~/.inputrc     I first learned about this feature in tcsh. When I switched over to bash about fifteen years ago, I had assumed I'd prefer ^R to search in reverse. Intuitively ^R seemed better since you could search for an argument instead of a command. I think that, like using a microkernel for the Hurd, it sounded so obviously right fifteen years ago, but that was only because the older way had benefits we hadn't known about.     I think many of you who use the command line as much as I do know that we can just be thinking about what results we want and our fingers will start typing the commands needed. I assume it's some sort of parallel processing going on with the linguistic part of the brain. Unfortunately, that parallelism doesn't seem to work (at least for me) with searching the history. I realize I can save myself typing using the history shortly after my fingers have already started "speaking". But, when I hit ^R in Bash, everything I've already typed gets ignored and I have to stop and think again about what I was doing. It's a small bump in the road but it can be annoying, especially for long-time command line users. Usually M-p is exactly what I need to save myself time and trouble.     If you use the command line a lot, please give Meta-p a try. You may be surprised how it frees your brain to process more smoothly in parallel. (Or maybe it won't. Post here and let me know either way. ☺) Show Sample Output

    <Meta-p> (aka <ALT+P>)
    hackerb9 · 2013-09-10 17:13:02 3

What Others Think

stupid joke. There ain't no such program "clfu-seach" in the world
Charon · 474 weeks and 6 days ago
ok, I take my words back. Downloaded and it works
Charon · 474 weeks and 6 days ago
Nicely done, I like how you format the output! Unfortunately you are printing results from search auto-complete and this site has unsorted autocomplete. For example if I search "sort" the autocomplete gives me 5 results which are by far not the highest scored results. When actually searching the results are better. Also when searching "sort" there is a result with negative score which escapes your sed filtering.
Iftah · 474 weeks and 4 days ago
In your .bash_aliases file : # command line search function clfu-search() { wget -q -O /dev/stdout --post-data "q=$1" | grep "class=\"autocomplete-command\"" | sed -e 's/^.*\(.*\)/\1/' -e 's///' | sort -u }
richard · 474 weeks and 4 days ago
function clfu-search() { wget -q -O /dev/stdout --post-data "q=$1" | grep "class=\"autocomplete-command\"" | sed -e 's/^.*<strong>\(.*\)<\/strong>/\1/' -e 's/<\/div>//' | sort -u }
richard · 474 weeks and 4 days ago
Very dangerous !
GouNiNi · 474 weeks and 3 days ago
Searches, but no results output
talktoyourpillow · 474 weeks and 1 day 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? 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.


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: