How to change the console_loglevel in linux?
18,249
Moved comment to answer.
You must leave a space between a number and >
or the shell will redirect that file descriptor. Use
echo 5 >/proc/sys/kernel/printk
Or
dmesg -n 5
Related videos on Youtube
Author by
Lavya
Updated on September 18, 2022Comments
-
Lavya over 1 year
I read at multiple places (e.g. here http://elinux.org/Debugging_by_printing), that you can change the console log level by echoing an integer to /proc/sys/kernel/printk. If that worked shouldn't the first integer have changed to 5 below?
[root@localhost printk]# cat /proc/sys/kernel/printk 4 4 1 7 [root@localhost printk]# echo 5>/proc/sys/kernel/printk [root@localhost printk]# cat /proc/sys/kernel/printk 4 4 1 7
I tried this on multiple systems and it didn't change on any of them!
-
meuh almost 9 yearsOuch! You must leave a space between a number and
>
or the shell will redirect that file descriptor. Useecho 5 >/proc/sys/kernel/printk
. Ordmesg -n 5
. -
Lavya almost 9 yearsyou're right. that works solves the problem. thanks!
-
debug about 5 yearssudo sh -c 'echo 8 > /proc/sys/kernel/printk'
-
Kusalananda about 5 years@debug Note that the user is already root.
-
-
ingli over 4 yearselinux.org/Debugging_by_printing offers an information about the meaning of different log levels
-
Stephen Kitt about 3 yearsIn addition to that, the question has already been answered — see the comments underneath the question. The existing answer reflects the comment which resolved the asker’s problem.