Linux, FreeBSD, Juniper, Cisco / Network security articles and troubleshooting guides
https://forum.ivorde.com/

Linux clear screen / terminal
https://forum.ivorde.com/linux-clear-screen-terminal-t19778.html
Page 1 of 1

Author:  mandrei99 [ Tue Mar 03, 2015 8:20 am ]
Post subject:  Linux clear screen / terminal

Linux clear screen terminal and move the shell prompt to the top of the screen.

Linux terminal can get filled with a lot of text if you use cat instead of less or more or if you are grepping a file for a pattern that is very loose.

Also, if you login via a serial console and the shell prompt gets moved in the middle of the screen overlapping with previous boot screen messages.

Clear Linux screen terminal


Code:
clear

or
Code:
CTRL + l
(CTRL key + lowercase L)

The above methods will both work to clear the output on your shell screen when you want to capture new output.

Change Linux clear screen key combination


While Control + l key works by default to clear the linux screen, this combination can be changed in the .inputrc file. For example, to change the clear screen combination to CTROL+a add this to ~/.inputrc file and relogin:
Code:
# cat .inputrc
control-a: clear-screen


You can also set a combination of three keys to perform clear.

Author:  mandrei99 [ Tue Mar 03, 2015 8:27 am ]
Post subject:  Re: Linux clear screen / terminal

If you need to clear the contents your screen very fast, depending on your shell, you can use either clear command, or ^L (Ctrl+L) combination, if you're using bash shell.

^L is available on bash shell, while clear is available on most UNIX releases and on most shells. I've tested it on AIX, Red Hat and FreeBSD on sh, bash, ksh.

Also, you can issue the simple clear command and your screen will be cleared or add it as an alias for one key:

Code:
alias a='clear'


and pressing a key and then ENTER, your teminal will be cleared.

Author:  Guest [ Wed Mar 04, 2015 8:52 am ]
Post subject:  Re: Linux clear screen / terminal

The Control+L works also if shell line contains characters. It will clear the screen up to the current terminal line and will keep typed characters.

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/