How to Clear Terminal Screen in Bash

MD Aminul Islam Feb 02, 2024
  1. Use tput reset to Clear the Terminal Screen
  2. Use reset to Clear the Terminal Screen
  3. Use clear to Clear the Terminal Screen
  4. Conclusion
How to Clear Terminal Screen in Bash

There are different ways to clear up the terminal in a bash script. This article will discuss 3 methods to clear our terminal.

Use tput reset to Clear the Terminal Screen

The first method uses the keyword tput reset to clear your screen. When your terminal window contains too much content, you can just put the following command and hit enter on the terminal screen.

tput reset

Use reset to Clear the Terminal Screen

reset is a built-in keyword of bash. This keyword clears your terminal screen and will reset the whole terminal.

reset

Use clear to Clear the Terminal Screen

This keyword is the most popular and reliable way to clear your terminal screen. It will clear all the results and commands you previously worked on.

clear

Conclusion

We’ve discussed three different ways to clean your terminal screen on Linux. You can use them based on your needs.

Please note that all the code used in this article is written in Bash. It will only be runnable in the Linux Shell environment.

MD Aminul Islam avatar MD Aminul Islam avatar

Aminul Is an Expert Technical Writer and Full-Stack Developer. He has hands-on working experience on numerous Developer Platforms and SAAS startups. He is highly skilled in numerous Programming languages and Frameworks. He can write professional technical articles like Reviews, Programming, Documentation, SOP, User manual, Whitepaper, etc.

LinkedIn