• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
Source Digit

Source Digit

Linux, Ubuntu Tutorials & News, Technology, Gadgets & Gizmos

  • Home
  • How To
  • Ubuntu
  • Instagram
  • Blogging
  • Android
  • WordPress
  • +More
    • Cloud Computing
    • Gadgets
    • Social Media
    • Technology
  • Write for Us
Home / How To / How To Clear Command Line Terminal in Linux Ubuntu

How To Clear Command Line Terminal in Linux Ubuntu

By Sourabh / December 11, 2024 Category: How To, Ubuntu

To clear terminal screen in Linux Ubuntu, the simplest command is “clear” to clear terminal screen. To use the clear command, simply type clear and press Enter in your terminal window. This will instantly clear the screen.

clear

The clear command doesn’t need any option with itself. Note that in other terminal emulators or UNIX putty, the clear command may just clear the screen for one page and when you scroll, you can still see the old screen and its outputs.

The clear command in Linux is used to clear the screen of the terminal or console. It helps to remove all the previous output and provide a clean workspace for new commands or information. This can be especially helpful when the terminal window becomes cluttered with too much text.

The command removes all content, including the scrollback buffer (the previous command history). If you want to preserve the scrollback buffer, use the clear command with the -x flag: “# clear -x”

To prevent clearing the scrollback buffer, one can use the clear command with -x option:

clear -x

NOTE: In a Linux terminal, the Ctrl + L keyboard shortcut is used to clear the terminal screen. It’s equivalent to typing the clear command in the terminal.

You can also use the reset command to clear the terminal screen. The reset command reinitializes the terminal. The reset command is useful when the terminal doesn’t terminate easily.

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

Linux Command To Clear Terminal History

To clear the history, type 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 the history when you logout:

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

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

You can also use reset command. The reset command is helpful when the terminal isn’t working or when it appears “hanged”. Note that in Linux, the reset command restores Terminal settings as it resets terminal attributes to their default settings. The reset command clears the terminal screen. To use the command, simply open a terminal and type reset.

Unlike the clear command, the reset command does more as it resets the terminal to its default settings. It restores all settings to its default value.

Primary Sidebar

Latest Posts

Ubuntu 25.04 ‘Plucky Puffin’ Is Available To Download

How to Login as Root User in Linux Terminal

Install Firefox In Ubuntu Terminal Command Line

How To Check Kernel Installed Date In Linux Ubuntu

How To List All Kernel Modules That Are Loaded In Ubuntu

Enable Ubuntu Auto Login Without Password

Download Ubuntu 25.04 Official Default Wallpapers

How To Fix Initramfs Error In Ubuntu Command Line

How To Check All Available Kernel Version In Linux Ubuntu

3 Best Artificial Intelligence Domain Name Generators

© 2025 Source Digit • Linux, Ubuntu Tutorials & News, Technology, Gadgets & Gizmos

  • Home
  • About
  • Privacy Policy
  • Terms & Conditions
  • Contact Us
  • Sitemap