Terminal-oriented computer user's guide


Multitasking | Files & Directories | Internet & Communication | Developing | Developing... | Developing ...

This page is a reference and instruction for the use of the terminal in typical desktop fashion. When complete it should serve useful as a guide for the user in setting up a practical desktop environment utilizing mostly text-based applications. This environment should be capable of performing the tasks a "mainstream" graphical desktop environment can perform, with little-to-no coding/programming skills required. This guide will be Unix oriented, although principles and knowledge should be applicable on all platforms.


Task management

Each application a user runs will require room to display on the screen. Switching between these applications is made possible through multitasking. On the TTY console, users can switch between terminals using the keybind pattern CTRL+ALT+Function key, each representing a terminal (F1-F9), effectively providing 9 available screens. More is usually required, for this the user can invoke a "terminal multiplexer." The multiplexer is run the same as any other program, and when summoned it loads another shell for the user to run commands upon.

shell

Upon logging on the machine, the user will be greeted with a command prompt. This will typically include the username, the computer's assigned hostname, a tilda (~) and a dollar sign ($). The tilda is representative of the user's home directory, and as the user navigates through the file system, the tilda will be replaced with the name of the working directory. On the right of the dollar sign is a blinking underscore, this is the input field for issuing a command to the machine. One simply types the name of the program desired, and presses return. Accidental commands or processes no longer needed can be canceled using CTRL+c, and a session can be ended entirely (issuing user logout) using CTRL+d.

Using tmux

Widely available and currently supported tmux is probably the best choice for a terminal multiplexer on most desktop systems. When tmux loads, the user will immediately notice a statusbar appear at the bottom of the screen. This will display a list of the actively running terminals and the applications running there. To interact with tmux, all hotkeys are preceeded with the keybind CTRL+b. The user can invoke a new terminal window using the key chain combo CTRL+b c. Pressing CTRL+b tells tmux the user is giving it a command, then releasing CTRL+b and pressing c lets tmux know the user wants a new window. Once the new window is open it will launch a command prompt. A position will be occupied on the statusbar, listing a numerical digit and the name of the currently running task (if no commands have been invoked, probably bash). Tmux also supports split windows for viewing multiple running applications simultaneously. Following is a list of frequently used key combinations:

window switching

CTRL+b # When # is replaced with the number for the desired window on the statusbar
CTRL+b w List all windows
CTRL+b p Move to next window to the left
CTRL+b n Move to next window on the right

copy & paste

CTRL+b [ Initiate copy mode (arrow keys move cursor)
CTRL+spacebar Initiate selection mode
CTRL+w Copy selection to the clipboard
CTRL+b ] Paste clipboard contents

split-pane views

CTRL+b " Split window vertically
CTRL+b % Split window horizontally
CTRL+b ! Make a new window from pane
CTRL+b arrow keys Switch panes
CTRL+b spacebar Cycle layouts
CTRL+b Alt+1 Evenly distribute screen space vertically
CTRL+b Alt+2 Evenly distribute screen space horizontally
CTRL+b Alt+3 Use one main window horizontally, stack others vertically
CTRL+b Alt+4 Use one main window vertically, stack others horizontally
CTRL+b Alt+5 Tile all windows.
CTRL+b ! Make a new window from pane
CTRL+b arrow keys Switch panes

htop resource monitor

If an application has become unresponsive, or information concerning resource usage is needed, a system monitor program like htop should be available. Once run, htop will display a list of currently running processes, CPU load, and memory use ratio. The operation of htop is straightforward, with function keys facilitating most user interaction. To demonstrate, one could press the F6 (sort) button and observe a left-side menu appear with criteria by which to sort the list. After selecting "MEM%" with the arrow keys and pressing Enter, the list will then be sorted with the process using the most memory at the top. Pressing F9 will then produce another menu giving the user various options for ending the process.


File management

Data on the machine is organized as files and directories. A directory contains a group of files, each file contains data in the form of text, images, videos, etc. Navigating the file system is the process by which a user changes the active working directory to gain access to various files. As mentioned above, the command prompt indicates the name of the working directory, this is the directory the user is currently manipulating the files in. Directories can often be contained within directories, and a list of directories is known as a directory path. These are expressed in sequential order from top to bottom, like so: /usr/local/share.

The command line is the most efficient and universally available method, and once understood it's usually used to the exclusion of visual file management applications. The command ls (list) can be used to list the files in the working directory, while cd (change directory) is used to move from one directory to another. Files are opened by typing the name of the program used to edit/view them with, followed by the name of the file. Provided below is a list of commonly used commands for navigating the file system and maniupulating files:

navigation

ls list directory contents
cd /usr/bin change working directory to /usr/bin
cd .. ascend to parent directory
cd ~ enter home directory
pwd view the name of the current directory
mkdir foo create a directory named 'foo'
rm -rf (directory name) delete a directory

file manipulation

file (filename) describes the filetype
less (filename) view file contents
rm (filename) delete file
mv (filename) move file
cp (filename) copy file

File management applications

There are programs available for the terminal to enable a user to navigate directories and open files without typing commands. Probably the most popular is Midnight Commander, or mc. This application provides a two-pane view allowing the user to work in two directories simultaneously. The bottom of the screen is lined with file operations and their corresponding function keys (F1-F10 activate those operations). Pressing F9 initiates the "pulldown menu" at the top of the screen. This provides access to more options, including configuration of the panes, file and command manipulation, and application settings. While Midnight Commander is established and easily available, the interface is intimidating and can be cumbersome for simple operations. Using the shell prompt is recommended and altogether more preferrable.


Internet and communication

Connecting to the Internet

The internet connection is maintained and operated using the "ip" tool. A wired Ethernet connection (LAN) is simple enough:

ip link set eth0 up

Wireless connection requires a few more steps:

Activate the wireless receiver: ip link set wlan0 up

List available wireless access points: iw dev wlan0 scan | less

Connect: iw dev wlan0 connect dlink

Configure IP address: dclient wlan0

Net-connected applications

Browsing with Elinks

Elinks is a text-based browser for viewing HTML files stored on a remote server. Rendering support for tables and frames is included, along with a download manager and tabbed browsing feature. It can be launched simply with the command elinks, and otherwise with a URL (web address) such as elinks http://gnu.org. Text-mode browsing is considerably more productive and effecient than graphical browsing (due to the exclusion of pop-up ads and bandwidth-hogging animations/images), especially on older computers. While Elinks provides an Escape-key menu with most of the common features and settings, it's usually easier to use the keybindings for some frequent operations.

Elinks keybindings

g Type a URL to load
t Open a new tab
c Close tab
< or > Switch tab (left/right)
Insert/Delete Scroll Up/down
Up/Down arrow keys Highlight next/previous links
Right arrow key Open link
Left arrow key Back one page
CTRL+r Reload page
. Number the visible links, typing the number highlights the corresponding link
/ and n/N Search within page, highlight next/previous search match
a Bookmark current page
s Open bookmarks
\ View page source
d Save to disk
D View download manager