Commands matching tput (64)

  • tput rmam will disable line wrapping so that long lines are truncated to width of the terminal ($COLUMNS). tput smam will re-enable wrapping. I've always used tput in bash scripts but I guess it works on the command line too. Doesn't work in all terminals. See http://www.gnu.org/software/termutils/manual/termutils-2.0/html_chapter/tput_1.html


    0
    tput rmam
    kennyld · 2014-02-26 07:06:37 6
  • Don't want to open up an editor just to view a bunch of XML files in an easy to read format? Now you can do it from the comfort of your own command line! :-) This creates a new function, xmlpager, which shows an XML file in its entirety, but with the actual content (non-tag text) highlighted. It does this by setting the foreground to color #4 (red) after every tag and resets it before the next tag. (Hint: try `tput bold` as an alternative). I use 'xmlindent' to neatly reflow and indent the text, but, of course, that's optional. If you don't have xmlindent, just replace it with 'cat'. Additionally, this example shows piping into the optional 'less' pager; note the -r option which allows raw escape codes to be passed to the terminal. Show Sample Output


    0
    xmlpager() { xmlindent "$@" | awk '{gsub(">",">'`tput setf 4`'"); gsub("<","'`tput sgr0`'<"); print;} END {print "'`tput sgr0`'"}' | less -r; }
    hackerb9 · 2015-07-12 09:22:10 11
  • Good for use in your ~/.bash_profile or a script. Show Sample Output


    0
    BOLD=$(tput bold); NORM=$(tput sgr0)
    thrifus · 2015-10-12 15:53:12 38
  • A function for retrieving and displaying a list of synonyms for a German word or phrase. Show Sample Output


    0
    desyno(){ wget -q -O- https://www.openthesaurus.de/synonyme/search\?q\="$*"\&format\=text/xml | sed 's/>/>\n/g' | grep "<term term=" | cut -d \' -f 2 | paste -s -d , | sed 's/,/, /g' | fold -s -w $(tput cols); }
    lordtoran · 2019-02-09 05:06:42 32

  • 0
    tput rmso
    hansgruber · 2017-07-13 20:01:42 17
  • This will use tput to place the command (date %T in this case) in the upper right corner of the terminal


    0
    while sleep 1;do tput sc;tput cup 0 $(($(tput cols)-11));echo -e "\e[31m`date +%T`\e[39m";tput rc;done &
    x3mboy · 2017-11-16 18:07:39 19
  • Here is an alternative that support unicodes, using echo: It is using the \c flag, meaning no new line for the echo option -e. You can replace the = with any unicode character. Or to do the same into a PHP bash script: shell = system("tput cols"); for( $i= 0 ; $i < $shell ; $i++ ){ echo "█"; } Show Sample Output


    0
    for ((i=0; i<$(tput cols); i++)); do echo -e "=\c" ;done
    K33st · 2018-03-19 19:37:02 27
  • For vi(m) users : Add it in your ~/.bashrc Add an "exit" @ the end if you are masochist ;) Show Sample Output


    -1
    alias :q='tput setaf 1; echo >&2 "this is NOT vi(m) :/"; tput sgr0'
    sputnick · 2009-12-08 12:59:44 3
  • For BSD-based systems, including OS X, that don't have seq. This version provides a default using tput in case $COLUMNS is not set: jot -b '#' -s '' ${COLUMNS:-$(tput cols)} Show Sample Output


    -1
    jot -b '#' -s '' $COLUMNS
    dennisw · 2010-04-13 22:03:39 6
  • 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 Show Sample Output


    -2
    hb(){ sed "s/\($*\)/`tput setaf 2;tput setab 0;tput blink`\1`tput sgr0`/gI"; }
    AskApache · 2010-04-07 08:45:26 4
  • apt install toilet toilet-fonts # replace 'tput setaf 1' with 'tput setaf 9' to change color


    -3
    tput setaf 1;tput rev;h=$(tput lines);w=$[$(tput cols)/6];c=$(seq -ws '_____|' $[$w+1]|tr -d "0-9");for a in $(seq $[$h/2]);do echo $c;echo ${c//|___/___|};done;tput cup 0;toilet -t -f bigmono12 "?LOVE";tput cup $h
    knoppix5 · 2020-11-01 13:31:31 375
  • Matrix Screen HPUX


    -4
    while :; do integer i=0; COL=$((RANDOM%$(tput cols))); ROW=$((RANDOM%$(tput cols))); while (( i <= COL)) do tput cup $i $ROW; echo "\033[1;34m" $(cat /dev/urandom | head -1 | cut -c1-1) 2>/dev/null; i=$(expr $i + 1); done done
    mfrancime · 2010-05-28 11:17:43 3

  • -4
    Ctrl+l
    bakhru · 2011-04-13 21:15:37 6

  • -4
    tput clear
    mpb · 2019-06-12 17:51:31 34
  •  < 1 2 3

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


Check These Out

Convert wma to mp3@128k
Convert all wma to mp3@128k with ffmpeg into directory.

grep apache access.log and list IP's by hits and date - sorted

Exclude inserting a table from a sql import
Starting with a large MySQL dump file (*.sql) remove any lines that have inserts for the specified table. Sometimes one or two tables are very large and uneeded, eg. log tables. To exclude multiple tables you can get fancy with sed, or just run the command again on subsequently generated files.

list files recursively by size

Continuously show wifi signal strength on a mac
The closer to zero the better.Credit to TheSeb on macrumors: http://forums.macrumors.com/showthread.php?t=1289884

Show demo of toilet fonts
Lists a sample of all installed toilet fonts

retrieve the source address used to contact a given host
on multihomed hosts, connected to several networks, could be usefull to know the source address (local ip address) used to reach the target host, this command does not require root priviledges. The command use a TCP socket, if there is any error the command return an empty string, elsewhere return a valid ip address.

Find usb device in realtime
Using this command you can track a moment when usb device was attached.

Print a random 8 digit number
Don't need to pipe the output into rs if you just tell jot to use a null separator character.

Display a Lissajous curve in text
Use Ruby's standard Curses module to display a Lissajous curve in the console. Replace the "0.2" with different numbers for different curves.


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: