3 ways to clear screen on Linux Terminal


The most used command to clear the screen on Linux Terminal (Command Line) is obviously clear, but do you know there are some more ways that you can try out!

Ways to clear Linux Terminal Screen

  1. Using Clear command
  2. root@myLinux# clear

    You can know more about this command by using the help!

    root@myLinux# clear ?
    
    Usage: clear [options]
    
    Options:
      -T TERM     use this instead of $TERM
      -V          print curses-version
      -x          do not try to clear scrollback

  3. Using Keyboard shortcut: Control + L
  4. Just press Control + L (Command + L if on macOS), you will see that the screen will get cleared! When you do this you will see not the whole screen is cleared at once, but command-by-command, so you can press Control + L, multiple times to clear as much screen real estate as you want!

    Linux clear screen example
    Linux clear screen example

  5. Using Alias
  6. If you want to use your own word as a command to clear screen, you can make use of Aliases, just update bash_aliases to add you custom alias,

    # sudo nano ~/.bash_aliases

    Add the following to the file and save: alias cls="clear"

    # sudo source ~/.bash_aliases
Advertisements
Try Out Code2care Dev Tools:

Advertisements

Advertisements
Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities.

Students and software developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include learnings, tutorials, trouble-shooting steps, video tutorials, code snippets, how-to, blogs, articles, etc.

🎉 We are celebrating the 10th years of Code2care! Thank you for all your support!

We strongly support Gender Equality & Diversity.