How do I increase the font size of the CentOS 7 console?
Solution 1
Personally I would not touch your GRUB configuration files. Instead, I would add a setfont
line to your shell initialization file.
For example, if you are using Bash, you could ask the following line to .bash_profile
:
if [ $TERM = linux ]
then
setfont sun12x22
fi
There are lots of different fonts available; sun12x22
is just one example. See the setfont
man page for more information.
Solution 2
The way to do this on a systemd operating system such as CentOS 7 is to edit the font settings in the /etc/vconsole.conf
file. These settings are applied by the systemd-vconsole-setup
service, which is essentially a glorified way of running setfont
and loadkeys
before the login services are brought up.
So you would have FONT=sun12x22
in that file, for example.
Note that the service program allows kernel command-line options such as vconsole.font
to override /etc/vconsole.conf
contents. If you are mucking around with GRUB kernel command-line options, bear this in mind.
Further reading
- Where is the location of console fonts in CentOS 7?
- Lennart Poettering et al..
vconsole.conf
. systemd manual pages. FreeDesktop.org. - Lennart Poettering et al..
systemd-vconsole-setup
. systemd manual pages. FreeDesktop.org. - sles (2014-07-09). systemd doesn't set console font. CentOS Bug #7325.
- Setting console font in vconsole.conf does not work (systemd)
- Can I change the font of terminal?
Solution 3
1. Install terminus console font: :-)
Terminus console font is in EPEL repository.
yum install epel-release yum install terminus-fonts-console.noarch
2. Directly in a Terminal (tty x):
Displays usable fonts for the terminal: ls /usr/lib/kbd/consolefonts
Changes the font directly in the terminal: setfont sun12x22
if you are using Bash, you could get the following line to .bash_profile: if [ $TERM = linux ] then setfont sun12x22 fi
3. Resolution - to /etc/default/grub:
video=800x600
4. Systemd
Edit /etc/vconsole.conf: FONT="ter-v32n"
Edit /usr/lib/systemd/system/systemd-vconsole-setup.service systemctl status systemd-vconsole-setup.service systemctl cat systemd-vconsole-setup.service systemctl edit systemd-vconsole-setup.service
Change the After= and Before= lines to:
After=sysinit.target Before=shutdown.target
5. Check /boot/grub2/grub.cfg and/or /etc/default/grub.
If grub.cfg contains a vconsole.font parameter, delete that parameter.
Related videos on Youtube
![Eric](https://lh5.googleusercontent.com/-FDGB5evXoyc/AAAAAAAAAAI/AAAAAAAAAE8/daWI7grnz98/photo.jpg?sz=256)
Eric
Updated on September 18, 2022Comments
-
Eric almost 2 years
When I booting to CentOS, the character is too small.
I tried to config grub2 files following this solution, but it seems not work.
My /etc/default/grub file is :
So, how can I increase the font size?
-
Eric over 6 yearsThank you very much for your advising. I put your code in the
/etc/profile.d/setfontsize.sh
, then every user can change his font size when login. -
Eric over 6 yearsThat works! I use
ls /usr/lib/kbd/consolefonts | grep 32
to find alatarcyrheb-sun32
font. Then edit the/etc/vconsole.conf
file to change FONT to this font. And also edit/usr/lib/systemd/system/systemd-vconsole-setup.service
file, changeAfter=sysinit.target
andBefore=shutdown.target
, then reboot. Then the font has changed before login. -
fpmurphy over 6 yearsThe problem is that this approach changes the default font for all users.