( 2>&2 strace -f -F -e write -s 1000 sh -c 'echo -e "initc\nis2\ncnorm\nrmso\nsgr0" | tput -S' 2>&1 ) | grep -o '"\\[^"]*"' --color=always
"\33]4;%p1%d;rgb:%p2%{255}%*%{1000}%/%2.2X/%p3%{255}%*%{1000}%/%2.2X/%p4%{255}%*%{1000}%/%2.2X\33\\\33[!p\33[?3;4l\33[4l\33>\33[?12l\33[?25h\33[27m\33(B\33[m"
Lets say you want to find out what you need to echo in order to get the text to blink..
echo -e "`tput blink`This will blink`tput sgr0` This wont"
Now you can use this function instead of calling tput (tput is much smarter for portable code because it works differently depending on the current TERM, and tput -T anyterm works too.) to turn that echo into a much faster executing code. tput queries files, opens files, etc.. but echo is very strait and narrow.
So now you can do this:
echo -e "\33[5mThis will blink\33(B\33[m This wont"
More at http://www.askapache.com/linux-unix/bash_profile-functions-advanced-shell.html
$ for cap in `infocmp -1q|sed 's/ *//g'|grep -v '#\||' |cut -d= -f1|tr "\n" ' '`; do echo "$cap: `termtrace $cap 5`"; done bel: "\7" blink: "\33[5m" bold: "\33[1m" cbt: "\33[Z" civis: "\33[?25l" clear: "\33[H\33[2J" cnorm: "\33[?12l\33[?25h" cr: "\r" csr: "\33[6;1r" cub: "\33[5D" cub1: "\10" cud: "\33[5B" cud1: "\n" cuf: "\33[5C" cuf1: "\33[C" cup: "\33[6;1H" cuu: "\33[5A" cuu1: "\33[A" cvvis: "\33[?12;25h" dch: "\33[5P" dch1: "\33[P" dl: "\33[5M" dl1: "\33[M" ech: "\33[5X" ed: "\33[J" el: "\33[K" el1: "\33[1K" flash: "\33[?5h" "\33[?5l" home: "\33[H" hpa: "\33[6G" ht: "\t" hts: "\33H" ich: "\33[5@" il: "\33[5L" il1: "\33[L" ind: "\n" indn: "\33[5S" initc: "\33]4;5;rgb:00/00/00\33\\" invis: "\33[8m" is2: "\33[!p\33[?3;4l\33[4l\33>" kDC: "\33[3;2~" kEND: "\33[1;2F" kHOM: "\33[1;2H" kIC: "\33[2;2~" kLFT: "\33[1;2D" kNXT: "\33[6;2~" kPRV: "\33[5;2~" kRIT: "\33[1;2C" kb2: "\33OE" kbs: "\177" kcbt: "\33[Z" kcub1: "\33OD" kcud1: "\33OB" kcuf1: "\33OC" kcuu1: "\33OA" kdch1: "\33[3~" kend: "\33OF" kent: "\33OM" kf1: "\33OP" kf10: "\33[21~" kf11: "\33[23~" kf12: "\33[24~" kf13: "\33O2P" kf14: "\33O2Q" kf15: "\33O2R" kf16: "\33O2S" kf17: "\33[15;2~" kf18: "\33[17;2~" kf19: "\33[18;2~" kf2: "\33OQ" kf20: "\33[19;2~" kf21: "\33[20;2~" kf22: "\33[21;2~" kf23: "\33[23;2~" kf24: "\33[24;2~" kf25: "\33O5P" kf26: "\33O5Q" kf27: "\33O5R" kf28: "\33O5S" kf29: "\33[15;5~" kf3: "\33OR" kf30: "\33[17;5~" kf31: "\33[18;5~" kf32: "\33[19;5~" kf33: "\33[20;5~" kf34: "\33[21;5~" kf35: "\33[23;5~" kf36: "\33[24;5~" kf37: "\33O6P" kf38: "\33O6Q" kf39: "\33O6R" kf4: "\33OS" kf40: "\33O6S" kf41: "\33[15;6~" kf42: "\33[17;6~" kf43: "\33[18;6~" kf44: "\33[19;6~" kf45: "\33[20;6~" kf46: "\33[21;6~" kf47: "\33[23;6~" kf48: "\33[24;6~" kf49: "\33O3P" kf5: "\33[15~" kf50: "\33O3Q" kf51: "\33O3R" kf52: "\33O3S" kf53: "\33[15;3~" kf54: "\33[17;3~" kf55: "\33[18;3~" kf56: "\33[19;3~" kf57: "\33[20;3~" kf58: "\33[21;3~" kf59: "\33[23;3~" kf6: "\33[17~" kf60: "\33[24;3~" kf61: "\33O4P" kf62: "\33O4Q" kf63: "\33O4R" kf7: "\33[18~" kf8: "\33[19~" kf9: "\33[20~" khome: "\33OH" kich1: "\33[2~" kind: "\33[1;2B" kmous: "\33[M" knp: "\33[6~" kpp: "\33[5~" kri: "\33[1;2A" mc0: "\33[i" mc4: "\33[4i" mc5: "\33[5i" meml: "\33l" memu: "\33m" op: "\33[39;49m" rc: "\0338" rev: "\33[7m" ri: "\33M" rin: "\33[5T" rmacs: "\33(B" rmam: "\33[?7l" rmcup: "\33[?1049l" rmir: "\33[4l" rmkx: "\33[?1l\33>" rmso: "\33[27m" rmul: "\33[24m" rs1: "\33c" rs2: "\33[!p\33[?3;4l\33[4l\33>" sc: "\0337" setab: "\33[45m" setaf: "\33[35m" sgr0: "\33(B\33[m" smacs: "\33(0" smam: "\33[?7h" smcup: "\33[?1049h" smir: "\33[4h" smkx: "\33[?1h\33=" smso: "\33[7m" smul: "\33[4m" tbc: "\33[3g" u6: "\33[5;0R" u7: "\33[6n" u8: "\33[?1;2c" u9: "\33[c" vpa: "\33[6d"
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.
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.
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
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: