Linux: Terminal sizes beyond 80 columns x 24 rows
Problem
How do I switch my text mode terminal to something larger than the default 80 columns x 24 rows? I don't want to switch to graphics mode because I don't like the sluggishness this introduces on my machine. E.g. when doing an ls -l on 500 files:
time
---------------------------------------------------------------------
real [%] real [s] user [s] sys [s]
------------------------------------- -------- -------- -------
0 100
-------------------------------------
graphics mode ##################################### 2.477 0.036 2.436
text mode ### 0.173 0.044 0.132
------------------------------------- -------- -------- -------
Table 1: Time consumed listing 500 entries via the command ls -l, using either graphics mode or text mode. See #Appendix A: time_ls.sh for the code used.
Environment
- Debian-6.0 (Squeeze)
- Graphic card: SiS 6326 PCI True Color Graphics and Video Accelerator, 4M Byte Video Memory, BIOS Version 1.28q, Support VESA BIOS Extension Ver 2.0
- Monitor: Dell U2311H, 1920x1080 60Hz
Solution
First boot with kernel parameter vga=ask to get a list of supported modes. Try different modes and specify a default mode as vga=<number>.
Specifying vga=ask in GRUB 2 takes some more effort compared to GRUB Legacy. You can determine if you've GRUB 2 with the command:
$ sudo grub-install -v grub-install (GRUB) 1.98+20100804-14
GRUB 2 should display a version number of 1.96 or later. GRUB Legacy is version 0.97.
GRUB 2
1. Replace linux loader with linux16
Specifying vga=X as a kernel parameter has been deprecated in GRUB 2 over GRUB Legacy. It appears however, you can within /etc/grub.d/10_linux, replace the default linux loader with linux16, which is the 16-bit loader and does support vga=X:
--- /tmp/10_linux.orig 2011-08-17 11:22:13.000000000 +0200
+++ /etc/grub.d/10_linux 2011-08-17 11:41:00.000000000 +0200
@@ -80,13 +80,13 @@
message="$(gettext_printf "Loading Linux %s ..." ${version})"
cat << EOF
echo '$message'
- linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
+ linux16 ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
EOF
if test -n "${initrd}" ; then
message="$(gettext_printf "Loading initial ramdisk ...")"
cat << EOF
echo '$message'
- initrd ${rel_dirname}/${initrd}
+ initrd16 ${rel_dirname}/${initrd}
EOF
fi
cat << EOF2. Specify text mode instead of graphics mode
Modify /etc/default/grub to use text mode instead of graphics mode:
--- /etc/default/grub.orig 2011-08-17 12:50:21.000000000 +0200
+++ /etc/default/grub 2011-08-17 12:56:08.000000000 +0200
@@ -5,7 +5,7 @@
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet"
-GRUB_CMDLINE_LINUX=""
+GRUB_CMDLINE_LINUX="vga=ask"
# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
@@ -13,13 +13,13 @@
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"
# Uncomment to disable graphical terminal (grub-pc only)
-#GRUB_TERMINAL=console
+GRUB_TERMINAL=console
# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
-GRUB_GFXMODE=800x600
-GRUB_GFXPAYLOAD_LINUX=keep
+#GRUB_GFXMODE=800x600
+#GRUB_GFXPAYLOAD_LINUX=keep
# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true3. Specify font
Specify the font to be loaded at boot time by modifying /etc/default/console-setup:
--- console-setup.orig 2011-08-19 07:25:25.000000000 +0200
+++ console-setup 2011-08-19 07:26:39.000000000 +0200
@@ -25,8 +25,8 @@
# GohaClassic (sizes 12, 14 and 16).
# Set FONTFACE and FONTSIZE to empty strings if you want setupcon to
# set up the keyboard but to leave the console font unchanged.
-FONTFACE="Fixed"
-FONTSIZE="16"
+FONTFACE=""
+FONTSIZE=""
# You can also directly specify nonstandard font or console map to load.
# Use space as separator if you want to load more than one font.
@@ -36,6 +36,7 @@
# FONT='lat9w-08.psf.gz /usr/local/share/braillefonts/brl-08.psf'
# FONT_MAP=/usr/share/consoletrans/lat9u.uni
# CONSOLE_MAP=/usr/local/share/consoletrans/my_special_encoding.acm
+FONT='default8x9.psf.gz'
# You can also specify a screen size that setupcon will enforce. This can not
# exceed what the current screen resolution can display according to the size ofYou can experiment with fonts like this:
$ cd /usr/share/consolefonts $ setfont Lat15-VGA16.psf.gz
You can retrieve additional fonts by installing the console-data package:
sudo apt-get install console-data
4. Run update-grub2
Make the changes persistent in the grub config file by running:
update-grub2
GRUB Legacy
- Within Grub startup menu - before booting the kernel - press 'e' to "edit the commands before booting"
- Select the line starting with "kernel ..." and press 'e' to "edit the selected command in the boot sequence"
- Add `vga=ask'.
For example, my grub command line looks like this:
grub edit> kernel /boot/vmlinuz-2.6.18-6-686 root=/dev/hda1 ro vga=ask
- Press 'b' to boot
- Press RETURN. Default modes are:
0 0F00 80x25 1 0F01 80x50 2 0F02 80x43 3 0F03 80x28 4 0F05 80x30 5 0F06 80x34 6 0F07 80x60
Press RETURN. Found additional modes:
7 0100 40x25 8 0122 132x44 9 0123 132x25 a 0124 132x28 b 012A 100x37
100 columns x 37 rows
1. Modify /boot/grub/menu.lst:
kernel ... vga=0x012A ...
132 columns x 44 rows
(If only I could find a nice 6x8 font?)
1. Modify /boot/grub/menu.lst:
kernel ... vga=0x0122 ...
2. Modify /etc/sysconfig/console
CONSOLE_FONT="lat9w-08.psfu"
See also
- VESA BIOS Extensions - Wikipedia, the free encyclopedia
- Thorough article, describing VESA history and all possible Linux video mode numbers
Appendixes
Appendix A: time_ls.sh
#!/bin/bash
# --- time_ls.sh -------------------------------------------------------
# Show time used listing 1,000 files
# Setup test directory
TMPDIR=/tmp/test_term_mode~
[ -d $TMPDIR ] || mkdir -p $TMPDIR
for (( i = 0; i < 500; i++))
do
touch $TMPDIR/file_$i
done
# Perform test
time ls -l $TMPDIR
# Delete test directory
rm -rf $TMPDIR
Journal
20060421
http://en.tldp.org/HOWTO/Text-Terminal-HOWTO.html
20060422
http://en.tldp.org/HOWTO/Keyboard-and-Console-HOWTO-16.html
This is somewhat better, but still 80 columns:
resizecons -lines 44 export TERM=linux-80x44
I notice this line during boot:
Loading console font lat9w-16.psfu -m trivial G0:loadable
Edit GRUB command line during boot, by pressing 'e'. Specified kernel parameter vga=ask ({ e | vga=ask | b }). Press RETURN. Default modes are:
0 0F00 80x25 1 0F01 80x50 2 0F02 80x43 3 0F03 80x28 4 0F05 80x30 5 0F06 80x34 6 0F07 80x60
Press RETURN. Found additional modes:
7 0100 40x25 8 0122 132x44 9 0123 132x25 a 0124 132x28 b 012A 100x37
Specifying 012A seems to work without scan first. Not during boot. Maybe 0x012A? Yes, so additional modes must be prefixed with '0x'. However, when specifying 8 (132x44) the console displays 25 lines only and remaining lines are 'below' the screen. Mode b (100x37) works nice though. However, when specified in /boot/grub/menu.lst, GRUB halts
You passed an undefined mode number.
I can change font height with the command setfont /usr/share/kbd/consolefonts/lat9w-10.psfu.gz. If only I could find a font suitable for 132 columns, a 6x8 font?
Virtual Consoles in Linux - Changing fonts
20081005
Program `setfont' is part of Debian package `kbd'. Install with sudo apt-get install kbd
- [nSLUG Want to reduce size of console font...confused]
- Forum thread resulting in two solutions: vga=0x317 of using frame-buffer
20090213
- Console session very large text font - LinuxQuestions.org
- Forum thread with lots of information