# Send ctrl+l to tty



## pbd (Sep 6, 2013)

Hi,

I want to send ctrl+l (^L) to some TTY from the command line. I have tried this:


```
[CMD=#]echo -n "^L" > /dev/ttyv0[/CMD]
(the ^L was typed by ctrl+v, ctrl+l)
```

but that doesn't work. It only moves the cursor on ttyv0 one line down, when I need to clean the screen. Please, does anyone know how to do it?


----------



## SirDice (Sep 6, 2013)

Does it have to be CTRL-L? You can use the clear(1) command to clear the screen.


----------



## pbd (Sep 6, 2013)

I didn't want do admit it, because it's lame approach, but I will explain it. I have vtclock ("fullscreen" console clock) running on ttyv0 and kernel messages and other processes are writing over the screen. I need to somehow send vtclock (or the shell on ttyv0?) to redraw the screen periodically (or redirect kernel messages somewhere else?).


----------



## SirDice (Sep 6, 2013)

pbd said:
			
		

> I need somehow send vtclock (or the shell on ttyv0?) to redraw the screen periodically (or redirect kernel messages somewhere else?).



That last one is easy to achieve, just comment this line in /etc/syslog.conf and restart syslogd:

```
*.err;kern.warning;auth.notice;mail.crit                /dev/console
```


----------



## wblock@ (Sep 6, 2013)

`printf "\033[H\033[2J" > /dev/ttyv0`


----------



## wblock@ (Sep 6, 2013)

Also: `clear > /dev/ttyv0`


----------



## pbd (Sep 6, 2013)

wblock@ said:
			
		

> `printf "\033[H\033[2J" > /dev/ttyv0`



That answers the original question. Thanks.


----------



## pbd (Sep 6, 2013)

wblock@ said:
			
		

> Also: `clear > /dev/ttyv0`



That's nice


----------

