Using tput to save, clear and restore the terminal contents

2010-06-17 182 words 1 min read

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

by David Winterbottom (

<a class="zem_slink freebase/en/uniform_resource_locator" title="Uniform Resource Locator" rel="wikipedia" href="">URL: <a href=""><h6 class="zemanta-related-title">Related articles by Zemanta <ul class="zemanta-article-ul"> <li class="zemanta-article-ul-li"><a href="">UrlAl ( <li class="zemanta-article-ul-li"><a href="">The www Problem ( <li class="zemanta-article-ul-li"><a href="">Scare All Your Friends With The Sketchiest URL Service Online ( <li class="zemanta-article-ul-li"><a href="">domain names web hosting registration domai | Usedcars.PK ( <li class="zemanta-article-ul-li"><a href="">Your World Of Text ( <div class="zemanta-pixie"><a class="zemanta-pixie-a" title="Reblog this post [with Zemanta]" href=""><img class="zemanta-pixie-img" src="" alt="Reblog this post [with Zemanta]" /><span class="zem-script more-related more-info pretty-attribution paragraph-reblog">


Authored By Amit Agarwal

Amit Agarwal, Linux and Photography are my hobbies.Creative Commons Attribution 4.0 International License.

We notice you're using an adblocker. If you like our webite please keep us running by whitelisting this site in your ad blocker. We’re serving quality, related ads only. Thank you!

I've whitelisted your website.

Not now
This website uses cookies to ensure you get the best experience on our website. Learn more Got it