Using tput to save, clear and restore the terminal contents

Using tput to save, clear and restore the terminal contents $ tput smcup; echo \”Doing some things…\”; sleep 2; tput rmcup Very useful for interactive scripts where you would like to return the terminal contents to its original state before the script was run. This would be similar to how vi exits and returns you to your original terminal screen.

Save and clear the terminal contents with:

tput smcup

Execute some commands, then restore the saved terminal contents with:

tput rmcup * View this command to comment, vote or add to favourites * View all commands by jgc

commandlinefu.com

by David Winterbottom (codeinthehole.com)

URL: http://feedproxy.google.com/~r/Command-line-fu/~3/up-H9KjOKPo/using-tput-to-save-clear-and-restore-the-terminal-contents

\"Reblog

List of commands you use most often

List of commands you use most often

List of commands you use most often

$ history | awk \'{a[$2]++}END{for(i in a){print a[i] \" \" i}}\' | sort -rn | head > /tmp/cmds | gnuplot -persist <(echo \'plot \"/tmp/cmds\" using 1:xticlabels(2) with boxes\') Plot your most used commands with gnuplot.

\"commandlinefu.com\"

by David Winterbottom (codeinthehole.com)

\"\"
\"\"

\"\"

URL: http://feedproxy.google.com/~r/Command-line-fu/~3/6MxHiSiINdo/list-of-commands-you-use-most-often

\"Enhanced

Delete all files in a folder that don\’t match a certain file extension

$ rm !(*.foo|*.bar|*.baz)

Deletes all files in a folder that are NOT *.foo, *.bar or *.baz files. Edit the pattern inside the brackets as you like.

\"\"

by David Winterbottom (codeinthehole.com)

\"\"
\"\"

\"\"

URL: http://feedproxy.google.com/~r/Command-line-fu/~3/TCRb2ku_V1Y/delete-all-files-in-a-folder-that-dont-match-a-certain-file-extension

\"Reblog