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

add all files not under version control to repository
With the force options the same results can be achieved

list files recursively by size

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

List the size (in human readable form) of all sub folders from the current location
Simple and easy to remember. -h is human, -d1 = depth 1. disk usage, human, depth 1

Count number of files in a directory

Get the gravatar UTL for a given email address

Use mplayer to save video streams to a file
I use this command to save RTSP video streams over night from one of our national TV stations, so I won't have to squeeze the data through my slow internet connection when I want to watch it the next day. For ease of use, you might want to put this in a file: #!/bin/bash FILE="`basename \"$1\"`" mplayer -dumpstream -dumpfile "$FILE" -playlist "$1"

Show which programs are listening on TCP and UDP ports
-p Tell me the name of the program and it's PID -l that is listening -u on a UDP port. -n Give me numeric IP addresses (don't resolve them) -t oh, also TCP ports

Show permissions of current directory and all directories upwards to /
NB not 'namei -m .', as it slices the path you give it.

Resume a detached screen session, resizing to fit the current terminal
By default, screen tries to restore its old window sizes when attaching to resizable terminals. This command is the command-line equivalent to typing ^A F to fit an open screen session to the window.


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: