Using Simple Keyboard and Mouse Techniques in a Linux Console Session

Working with Linux in a console-based session usually involves entering commands from the keyboard. However, you can also use simple mouse controls as well. Linux keyboard combinations and mouse support help provide virtual console navigation, start special system actions (such as rebooting or shutting down), provide shortcuts to save typing, and can aid in reading files or viewing program output.

For example, you can scroll the contents of your screen from the console by pressing Shift+PageUp or Shift+PageDown, and can copy and paste text using your mouse buttons. This section shows you how to access default or custom menus at the text console, which can be helpful to get system information or to launch new programs.

If you use a mouse with Linux (and you most likely do), you can use your pointing device for copy and paste operations. This support is provided by gpm, the general purpose mouse server. The gpm server must be enabled or started while booting Linux (see Chapter 15 for more details in the section "Controlling Services at Boot with Administrative Tools"). To copy a section of text, click and drag text with the left mouse button (button 1) held down. To paste text, click an insertion point, and then press the middle mouse button (button 2).

Button assignment, like all mouse controls during text console use, is managed by command-line options given to gpm when it is started. For example, if you look at the gpm startup script named gpm under the /etc/rc.d/init.d/ directory, you will see that it uses the file named gpm.conf under the /etc/ directory to hold options:

# Additional options for gpm (e.g. acceleration), device OPTIONS=""


You can add options, detailed in the gpm man page, to change how your mouse works, enable or disable features, or assign special commands to a specific mouse button click. For example, to change your button order from 123 (left, middle, and right) to 321, edit the /etc/gpm.conf file using sudo and change the options enTRy like so:

OPTIONS="-B 321"

After saving your changes, restart gpm like so:

$ sudo /etc/rc.d/init.d/gpm restart

Your mouse buttons will now be reversed!

You can change your keyboard layouts by using the loadkeys command. To use a different font for the console, try the setfont command. Ubuntu comes with nearly 150 different console fonts, which are found under the /lib/kbd/consolefonts directory.

Was this article helpful?

0 0

Post a comment