Is there any way to silence the output that occurs on TTY1 when switching runlevels?
I have a simple UI that may be running on TTY1 when the runlevel is changed and it corrupts the curses output, which looks very ugly.
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
Probably not: those messages are written to the console, and your
TTY1 is just one of the virtual consoles that happen to be using it.
The service stop/start messages are not written by a child process of your command (otherwise you could redirect them to
On the other hand, you can suppress some other types of messages written to the console (kernel messages, as mentioned in How do I disable messages or logging from printing on the console/virtual terminals?).
But in a quick check of CentOS 7, neither redirecting the output of
init nor using
dmesg -n 1 affects messages sent going from runlevel 5 to 3. The command-shell does get logged out (which would be expected for your program as well).