≡ Menu

Howto: Linux Refresh all or an X screen Kde-Gnome desktop

Linux or UNIX desktop systems are quite stable. However, some time weird things happen like unreadable screen and confusing application causing massive screen messed up, which makes it difficult to read what is on the Linux desktop.

Generally, I have observed that most users prefer to hit CTRL+ALT+Back Space or just kills the X session. However, there is way to get rid of this problem.

xrefresh is a simple X command that causes all or part of your screen to be repainted. This is useful when system messages have messed up your screen. Xrefresh maps a window on top of the desired area of the screen and then immediately unmaps it, causing refresh events to be sent to all applications. By default, a window with no
background is used, causing all applications to repaint smoothly. However, the various options can be used to indicate that a solid background (of any color) or the root window background should be used instead.

Just type the xrefresh:
$ xrefresh

You can also pass -white and -black option to xrefresh command:
$ xrefresh -white
$ xrefresh -black


  • -white: Use a white background. The screen just appears to flash quickly, and then repaint (this is a default).
  • -black: Use a black background (in effect, turning off all of the electron guns to the tube). This can be somewhat disorienting as everything goes black for a moment.

If refresh will not clear the X display consider using xkill to kill particular X application or kill your self i.e. kill user account.

I am not sure if there is any such a program exists for Windows XP desktop. If any one has information please share with us.

Share this on:

Your support makes a big difference:
I have a small favor to ask. More people are reading the nixCraft. Many of you block advertising which is your right, and advertising revenues are not sufficient to cover my operating costs. So you can see why I need to ask for your help. The nixCraft, takes a lot of my time and hard work to produce. If you use nixCraft, who likes it, helps me with donations:
Become a Supporter →    Make a contribution via Paypal/Bitcoin →   

Don't Miss Any Linux and Unix Tips

Get nixCraft in your inbox. It's free:

{ 4 comments… add one }
  • Saikat September 21, 2006, 8:26 am

    It’s working. Wonderful.

  • Chaz March 19, 2007, 7:42 pm

    If you want to refresh the KDE desktop just enter the command:

    dcop kwin KWinInterface refresh &>/dev/null

    I wasn’t able to get xrefresh to work with KDE!

  • Khalil Fazal January 9, 2011, 2:33 am

    For me, -black happens to be the default

  • Vladimir Dzhuvinov October 29, 2011, 6:31 am

    The xrefresh is indeed very useful in garbled screen situations. These often occur on my Gnome desktop when I switch the work spaces. Is there a way to make xfresh run every time the work space is changed?

Leave a Comment