hb(){ sed "s/\($*\)/`tput setaf 2;tput setab 0;tput blink`\1`tput sgr0`/gI"; }

Blinking, Color Highlighted search for input/output and files, like grep --color

hb(){ sed "s/\($*\)/`tput setaf 2;tput setab 0;tput blink`\1`tput sgr0`/gI"; } hb blinks, hc does a reverse color with background.. both very nice. hc(){ sed "s/\($*\)/`tput setaf 0;tput setab 6`\1`tput sgr0`/gI"; } Run this: command ps -Hacl -F S -A f | hc ".*$PPID.*" | hb ".*$$.*" Your welcome ;) From my bash profile - http://www.askapache.com/linux-unix/bash_profile-functions-advanced-shell.html
Sample Output
4 S root     20159  1610 TS   24 -  1848 stext   2400   0 04:33 ?          0:00  \_ sshd: toor [priv]
5 S toor     20269 20159 TS   21 -  1848 stext   1520   1 04:33 ?          0:00      \_ sshd: toor@pts/0
0 S toor     20273 20269 TS   23 -  1040 wait    2112   2 04:33 pts/0      0:01          \_ -bash
1 S toor      3234 20273 TS   22 -  1040 wait    1100   2 04:38 pts/0      0:00              \_ -bash
0 R toor      3241  3234 TS   21 -   609 -        836   4 04:38 pts/0      0:00              |   \_ ps -Hacl -F S -A f
1 S toor      3235 20273 TS   21 -  1040 stext   1096   0 04:38 pts/0      0:00              \_ -bash
1 R toor      3237  3235 TS   20 -  1040 -       1180   6 04:38 pts/0      0:00              |   \_ -bash
1 S toor      3236 20273 TS   21 -  1040 wait    1088   2 04:38 pts/0      0:00              \_ -bash
1 S toor      3238  3236 TS   21 -  1040 ?       1180   5 04:38 pts/0      0:00                  \_ -bash

These Might Interest You

  • Displays the same output as "cal", but with the current day highlighted (probably dependent on gnu grep, as I'm not sure other grep's support the "--color=auto" option). Tested and working on Ubuntu 11 and OSX Lion. Show Sample Output


    6
    cal |grep -A7 -B7 --color=auto $(date +%d)
    4fthawaiian · 2011-11-26 22:13:12 4
  • Even though --color is an option for 'ls' it will not display in color when doing 'ls -lah --color=always | less' to have color output when doing a directory listing and piping it out to page through results, replace less with most. To install most if not installed, run: sudo apt-get install most


    -2
    ls -lah --color=always | most
    Code_Bleu · 2010-01-04 22:21:13 2

  • 4
    color () { local color=39; local bold=0; case $1 in green) color=32;; cyan) color=36;; blue) color=34;; gray) color=37;; darkgrey) color=30;; red) color=31;; esac; if [[ "$2" == "bold" ]]; then bold=1; fi; echo -en "\033[${bold};${color}m"; }
    zvyn · 2013-09-06 09:37:42 0
  • This is a simple command, but extremely useful. It's a quick way to search the file names in the current directory for a substring. Normally people use "ls *term*" but that requires the stars and is not case insensitive. Color (for both ls and grep) is an added bonus.


    6
    alias lg='ls --color=always | grep --color=always -i'
    kFiddle · 2009-04-11 23:15:12 3
  • Handles the color codes intended for 256-color terminals (such as xterm-(256)color and urxvt-unicode-256color), in addition to the standard 16-color ANSI forms. Overkill for strict ANSI output, see other options for something simpler.


    0
    sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"
    rcbarnes · 2012-06-12 11:20:46 0
  • Alternative1 (grep support): pacman -Ss python | paste - - | grep --color=always -e '/python' | less -R Alternative2 (eye-candy, no grep): pacman --color=always -Ss "python" | paste - - | less -R in ~/.bashrc: pkg-grep() { pacman -Ss "$1" | paste - - | grep --color=always -e "${2:-$1}" | less -R ; } pkg-search() { pacman --color=always -Ss "python" | paste - - | less -R; } Show Sample Output


    1
    pacman -Ss python | paste - - | grep --color=always -e '/python' | less -R
    hute37 · 2016-01-25 14:29:31 1

What Others Think

-2 ? What is wrong with you people, this is one of my alltime favorite functions!
AskApache · 423 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: