how to

How to Clear Terminal Screen in Linux Command Line

[et_pb_section admin_label=”section”]
[et_pb_row admin_label=”row”]
[et_pb_column type=”4_4″][et_pb_text admin_label=”Text”] 

How to clear the terminal screen on the Linux command line. Learn how to use the cleanup command in Linux with Ubuntu terminal cleanup examples.

Linux Command to Clear Terminal Screen

To clear the terminal screen in Linux Ubuntu, the simplest command is “clear” to clear the terminal screen:

clear

The clear command does not require any options on its own. Please note that in other terminal or UNIX emulators putty the clear command can simply clear the screen one page at a time and as you scroll you can still see the old screen and its results.

To prevent the scroll buffer from being cleared, you can use the clear command with the -x option:

clear -x

You can also use the reset command to clear your terminal screen. The reset command reinitializes the terminal. The reset command is useful when the terminal cannot shut down easily.

keyboard shortcut to clear terminal screen is Ctrl+L in Linux. The shortcut works in most terminal emulators. Note that Ctrl+L clears the output and moves the screen down one page. But you can still view the command output history by scrolling up.

Linux Command to Clear Terminal History

To clear the history, enter the following command:
history -c && history -w
OR
rm ~/.bash_history

Clear Bash Shell terminal history on logout

You can modify the above command to clear history on logout:

echo 'history -c' >> ~/.bash_logout

NOTE: The terminal history is stored in the “.bash_history” file located in the home directory.

[/et_pb_text][/et_pb_column]
[/et_pb_row]
[/et_pb_section]

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button