Clear screen and cursor reset command

Source: Internet
Author: User
Code # of the clear screen and cursor reset command Create_log.sh #! /Bin/bashwhiletruedodate>>log.txtsleep1done;to manually append the content Print_log.sh to log.txt #! /Bin/bashwhiletrue... clear screen and cursor reset command Create_log.sh code #! /Bin/bash while true do date> log.txt sleep 1 done; append the content Print_log.sh to log.txt without interrupting the script #! /Bin/bash while true do echo-e "\ 033 [2J \ 033 [1; 1 H 'tail log.txt '" sleep 1 done; use the script to read the last 10 lines of log.txt and print it to the console, clear the screen before each printing, and reset the cursor position \ 033 [2J to clear the screen \ 033 [1; 1 H to set the cursor position to y = 1, x = 1, that is, the execution result in the upper left corner of the screen: no second screen display countdown 10 rows Result code May 17, 2013 Friday 09:24:37 CST May 17, 2013 Friday 09:24:38 CST May 17, 2013 Friday 09:24:39 CST May 17, 2013 Friday 09:24:40 CST May 17, 2013 09:24:41 CST May 17, 2013 Friday 09:24:42 CST May 17, 2013 09:24:43 CST May 17, 2013 Friday 09:24:44 CST Friday May 17, 2013 09:24:45 CST Friday May 17, 2013 09:24:46 CST
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.