Under Linux, is it possible to view error messages that show up on the text mode terminal while in GUI mode, instead of having to press Ctrl+Alt+F1 or Ctrl+Alt+F2 to view the messages every time and then switching back to GUI mode by pressing Ctrl+Alt+F7?

Thank you.

  • I clarified the subject of the question. Bash is only one of many different shells for Linux. The messages are send to the entity in which (e.g.) bash is running, not the shell itself.
    – fschmitt
    Oct 14, 2010 at 20:15
  • Can't you just access /var/log/"blah" and read the respective log? Assuming it is on the boot process you might look at /var/log/boot.log
    – vfbsilva
    Feb 19, 2015 at 13:22

4 Answers 4


You can see the current contents of the text console /dev/tty1 in the file /dev/vcs1 (where 1 is the number in Ctrl+Alt+F1). (If you try to read from /dev/tty1, you'll compete with the program running there for keyboard input.) The vcs devices are normally only readable by root. You get a snapshot; there's no convenient way to get content as it comes.

The ttysnoop program allows you to watch the traffic on a console from another terminal (including an X terminal). But this is something you have to set up in advance.

Instead of trying to catch the messages when they've been output on the text console, arrange to have the messages directed to a different location. Most such console output will end up in the system logs, in files under /var/log. Under X (i.e. in graphical mode), you can catch these messages with xconsole, which is part of the standard X distribution.

If xconsole doesn't show the messages you want, edit your question to mention where these messages are coming from.

If you can't get xconsole to show any message, edit your question to include your exact operating system, any configuration steps you've taken, and any error message you saw.

If the messages are not coming from the system logging facility, but from a program you started in the text mode console, you'll be better served by using redirection. Arrange to start the program like this:

mv ~/.myprogram.log ~/.myprogram.log.old
myprogram --with arguments 2>&1 >~/.myprogram.log

Then you can read the output from the program from anywhere by looking in the file ~/.myprogram.log. In particular, to watch the file grow in real time, run

tail -n +1 -f ~/.myprogram.log

If the program is started by your X startup scripts, it would be better to redirect the output from the whole X startup sequence to a file. In fact many distributions do this automatically. If you're using a .xinitrc or .xsession file, put the following line near the beginning of the file to redirect the output from subsequent programs:

exec >"$HOME/.xsession-$DISPLAY.log" 2>&
  • Thank you. I simply did su -c "cat /dev/vcs1" and it worked. ANd like you mentioned, it was a simple snapshot of the messages on the console but that was all i needed.
    – Jay
    Oct 14, 2010 at 20:49
  • @Jay: now that I've seen your comments, I have a different answer, which is that you should use redirection in your X startup scripts. I'm leaving the other possibilities because they may be useful to other people browsing the question archive. Oct 14, 2010 at 21:19

You can use xconsole for this. From its description:

The xconsole program displays messages which are usually sent to /dev/console.

Depending on the configuration your distribution chose you might have to start it as root (i.e. with sudo xconsole respectively su -c xconsole),

  • thank you. But is there a way to view the messages that are already there on the console after i've started X? like for example, in my situation.. I've written a python script to randomly change the wallpaper. And i've set it up so that whenever I start X, the script gets called. But the script does not work the way i want it to and i get a few error messages on the console. When i start xconsole after i get into X, i can only see messages that are sent to the console from that point on. The man page for xconsole doesn't say anything about viewing messages that are already there on the console
    – Jay
    Oct 14, 2010 at 20:21
  • You can in any terminal window (e.g. xterm) display the messages printed during bootup with the command dmesg.
    – fschmitt
    Oct 14, 2010 at 20:29
  • dmesg only shows the messages that appear during bootup. I do not think that it shows the messages that appear on the console after i boot up and login and do "startx" for example..
    – Jay
    Oct 14, 2010 at 20:51

Have you tried xterm -C? It works on Ubuntu 17.04.

  • 1
    It sounds comment-worthy, but if Erik would add some context, it seems a plausible / possible answer: "-C This option indicates that this window should receive console output. This is not supported on all systems. ...."
    – Jeff Schaller
    Jul 31, 2017 at 17:01
  • Fair points. Next time I'll make it a comment. Sorry for any conenvenience. Aug 1, 2017 at 17:10

If you want to see the console messages, you can put at the end of /etc/rc.local,

sleep 60
  • 2
    The OP wants to see the messages after having loaded the GUI. This will simply make the system wait for a minute before loading so it's not a solution.
    – terdon
    Feb 19, 2015 at 13:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .