Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Any local terminal text (login prompt, etc) is showing through areas of the screen that are not covered by video (i.e. the black bars on the top and bottom) when I use a remote terminal to play video with omxplayer. If I wait 10-15 minutes, the local terminal goes totally black due to inactivity which fixes the problem, but that's kind of a lame workaround.

I'm thinking that using omxplayer locally would sidestep the problem, but I can't verify since my RPi hates all of my keyboards. I also don't want to play video that way long-term.

How can I black out the local terminal so it doesn't show through when using a remote terminal to play videos over HDMI?

share|improve this question
up vote 5 down vote accepted
sudo sh -c "TERM=linux setterm -foreground black >/dev/tty0"
sudo sh -c "TERM=linux setterm -clear >/dev/tty0"

This will change the font color to black, than clears the screen.

Or in a single line:

sudo sh -c "TERM=linux setterm -foreground black -clear >/dev/tty0"

And set it back to normal:

sudo sh -c "TERM=linux setterm -foreground white -clear >/dev/tty0"
share|improve this answer

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

That's a pretty good solution. It still leaves a blinking cursor in the upper left corner though. – Wisteso Oct 20 '12 at 20:17
run sudo sh -c "TERM=linux setterm -foreground black >/dev/tty0" before the above command :) – Szindbad Oct 20 '12 at 20:42
that did the trick. I'm concerned about it messing with the terminal when not playing movies (like when shutting down), but that can be a different battle. – Wisteso Oct 21 '12 at 2:26
Please update the answer to include the full solution. – Alex Chamberlain Oct 21 '12 at 8:28
Thanks for the one-liner update, Szinbad! – Wisteso Oct 25 '12 at 4:18

omxplayer now has an option to set the background to black.

omxplayer -b

It works both on the terminal and in X. This feature should be in the current version available in raspbian.

share|improve this answer
It stays black after playback. How do I turn it back? – Mailo Jan 17 at 15:58

The -r (--refresh) option to omxplayer clears the screen when it resets the video resolution and whatnot.

-r / --refresh                 adjust framerate/resolution to video

An alias could be useful here:

alias omxplayer='omxplayer -r -o hdmi '

Which will then always refresh (clear) the screen and send audio to the hdmi output. And yes, the trailing space in the alias is intentional as it allows further tab-completion to occur. (Very useful!)

As for the blinky cursor, I rarely (!) ever use a keyboard with my pi's, always logging in remotely (I've built an SD card maker, preconfiguring things), so I added the following into /etc/rc.local:

# turn off console blanking
setterm -blank 0 -cursor off

/etc/rc.local is run as root during boot and this turns off the console blanking which tries to be helpful when no (physical) keyboard activity is sensed, and also turns off the cursor.

Since resetting the video often restores the blinky cursor, I have a script I run to send commands to the console (tty1 actually):

# send 'setterm' commands to /dev/tty1 (physical console)
setterm $* | sudo tee /dev/tty1 > /dev/null

So anytime the cursor reappears, I type:

tty1 -cursor off

and it's gone! Of course, you'll need to set up your user with sudo privileges, at least for the tee command. (look up /etc/sudoers and /etc/sudoers.d) The script could be edited to always turn off the cursor if one wished.

Or just go mad with a combination of these:

alias omxplayer='tty1 -cursor off; omxplayer -r -o hdmi '

Which would ensure the cursor is off, then start omxplayer. Play with it!

share|improve this answer

Here is what I do (in a script):

setterm -cursor off;
omxplayer -o hdmi "video file.mkv" | echo "";
setterm -cursor on;

If you do use a script to call omxplayer, you might want to add

complete -F _longopt watch

to your .bashrc (or similar for whatever terminal you use) so you get filename tab-completion.

share|improve this answer
I sense a C/C++/Java/PERL programmer here... You only need the trailing semicolons if you're stringing all those commands on one line. Of course, I AM a C/C++/Java/PERL/etc programmer, so I do this by habit too. – lornix Jul 22 '13 at 4:16
set PS1=""
setterm -cursor off

And voila, you're screen is black, even after omsplayers stops.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.