Recent Changes - Search:
 Welcome to the Cisco Academy for Vision Impaired Linux Wiki.


edit SideBar


Lecture 5 Notes

Lecture 5 was a whirlwind tour of multi-user multi-plexing, working with terminals using screen access, command-line usage, and an introduction to two editors. I will attempt to organize it by topic.

Terminal Basics

In the early days of computing, the only input for the average user was through punch cards. A punchcard held approximately 80 characters and one line. Users typed in their data, and a keypunch created corresponding holes in the card. A stack of cards was fed in to the computer by an operator, and the computer spit out a printout. This was called batch processing, because the user submitted a batch of cards, which was a program, and the computer ran the program and spit out a batch of results. (This is an oversimplification but this essay isn't about early computing.)

When transistors came on the scene and computers gradually became smaller -- though they still filled an entire room -- terminals began their lives as input for computers. Early terminals were big mechanical clattering teletypes, spitting out reams of paper, reeking of hot oil and full of gears, cogs and little wheels that were constantly breaking down. Early interactive software got its start in the teletype erra, and to save ink, not to mention wear and tear on the machines, they were very thrifty with their output. Editors like ed, by default displayed no prompt, and a simple question mark when encountering an error.

Users were thrilled when they could ditch their ancient teletypes for a modern terminal, with its electronic keyboard and its glowing CRT.

Basically a box with a keyboard and screen, a terminal had electronic components inside but was not a full-fledged computer. Rows upon rows of terminals in school computer labs let each student connect to the single, large computer.

Mainframe and minicomputers wer also ubiquitous in law firms, accounting offices and factories. Using terminals, workers could connect to the computer to enter orders, update inventory, process payroll or do legal discovery.

Terminals were used because a computer with a monitor and keyboard was too expensive for an individual user. Multi-user operating systems like Unix enabled hundreds of users on terminals to simultaneously access a single system.

Terminals could be cabled directly to the main computer, or they could connect from far away over a network.

When personal computers became afordable at the start of the 1980s, people wanted to be able to use their TRS-80, Apple 2E or IBM PC instead of a terminal, especially when working from home. With the ever-expanding internet, technically oriented users like scientists envisioned a future where terminals would enable them to work from their lab in Canada while running models on computers actually located in Norway. So terminal emulation software was invented for this purpose. DOS users probably remember working with Telix, Qmodem, Como or Procomm to connect to a BBS. These simple terminal emulators would also connect easily to a unix system. People could connect to computers that were two countries or two rooms away.

Linux is a clone of unix, and so it is also terminal based. But by the 1990s when Linux became popular, most users had personal computers at home and in the workplace. Because they were now working with the graphical environments on the Mac or Windows, they had no longer need for terminal emulation. Web-based interfaces also let people access data on remote servers without requiring them to interact with the command line.

But system administrators still used terminal emulation, often because they wanted to remotely access a system over a network. And because support for terminals in Linux is so robust, we blind users have equal access to the command line and the tools on which system administrators depend.

TeraTerm Basics

The most accessible free terminal emulator for Windows is TeraTerm. There are others, but TeraTerm is the recommended terminal emulator for this course.

TeraTerm needs to be configured to work well with screen readers.

Configuring TeraTerm For Optimum Access

  1. Run TeraTerm from its shortcut. A connection window appears.
  2. You are not in the main terminal window, so press escape to dismiss the connection window.
  3. From the main screen, Press Alt-S to get in to the setup menu.
  4. Press T for Terminal or Enter as it is the first choice. The Terminal configuration dialog box appears.
  5. In the edit box for Terminal size, type 80. Your terminal lines will be 80 characters long. You can experiment with longer lines when you are a more advanced user.
  6. In the edit box for Terminal Size X, type 24. This is the second edit box, and you will be setting your terminal to 24 lines. You can experiment with having more lines when you become a more advanced user.
  7. Select OK. It is possible to change the other settings but only if you know what you are doing.
  8. Select Setup once more with Alt-s.
  9. Press W for Window and the Window configuration dialog box appears.
  10. Tab over to Cursor shape and notice there are three radio buttons. Select the one for Horizontal Line. If the cursor shape is set to block or vertical line it will not be tracked accurately by screen readers. Later, in this same dialog, you can try experimenting by checking or unchecking the box for scroll buffer. There are both advantages and disadvantages for turning this off.
  11. Select OK
  12. For a third time, press Alt-S for setup. Arrow down to Save Setup and press ENTER.

A standard Save file dialog box appears. The default name is Teraterm.ini. If you save in the default, TeraTerm will start up configured properly for your screen access. Advanced users might wish to change the filename but be aware you will need to specifically invoke that settings file on the teraTerm command line.

Teraterm does not save any settings in the registry. This means you can back up the TeraTerm.ini and you can also easily examine it with any text editor.

Cucat also has a JAWS script for Teraterm which you can download and install following the TeraTerm Survival Guide in the General instructions folder.

Using TeraTerm with Screen Access

When you work with a graphical user interface using the keyboard, you are performing actions that a sighted user would accomplish using a mouse. To navigate, you might press arrow keys, tab, spacebar, or function keys.

When you are working with a terminal, many of these keys simply generate terminal control codes. For example, in many situations, when you press an arrow key, funny characters like [d will appear onscreen. Original real hardware terminals often didn't have many arrow or function keys, and users had to type control characters, like control-A to issue commands.

When terminals became more sophisticated, they did get more keys, and the terminals sent out these codes to the system when their special keys were pressed. But it was typically only graphically-oriented software that developed to respond to these special keystrokes. By in large, basic tools were still run using the command line, or by holding control while pressing another key.

In TeraTerm, some keystrokes are used to control TeraTerm itself. For example, Page Up scrolls back through a buffer that TeraTerm itself maintains to display previous screens. This is called the scroll-back buffer, and it is a feature of TeraTerm and not of Linux. We have already seen that Alt-S calls up TeraTerm's setup menu and Alt-F would call up its File menu. So if you type Alt-F, Linux would not receive that keystroke at all.

So the first rule to remember when using Linux is to not randomly hit keys hoping you can figure out how to make a program work. In Linux, reading documentation is the best way to spend your time investigating how a program behaves. Just as a sighted user will discover he cannot get much to happen when mousing around a terminal window and randomly clicking on things, the blind user quickly learns that he has to know precisely the syntax of the commands he issues in order to get much accomplished.

Another important caution is to pay atention to which screen reader mode you are in. JAWS has a JAWS and invisible cursor that are moved with the arrow keys. NVDA uses the numeric keypad for object navigation. Make sure you are in the screen access program review mode, or you will inadvertently be sending unwanted keystrokes through to Linux. For example if you use the Page Up key to take your mouse cursor to the top of the screen, but you are not in review mode, you'll send a Page Up to TeraTerm. This will put you in the scroll buffer, so instead of it displaying your current Linux session, your screen will display what was on the Linux screen ten minutes ago.

You will find also that in some programs, the arrows will work but your screen reader will not track the cursor, or highlight. There is console software, that though text-based is not very accessible because it keeps repainting the screen. There are advanced work-arounds for these situations, such as reconfiguring the software, or turning off screen echo, but it's best to not expect keys like tab and arrows, home and end to work as they did in Windows.

Multiplexing and Screen

In the modern multi-tasking environments of Windows and the Mac, users can have several programs running simultaneously and easily switch between them. In Linux, however, without the graphical environment, a user who was not working directly on hardware consoles could only have one program active at a time. He could run many tasks in the background, but his text-based terminal showed the user interface for only one program. To use another program, he had to suspend the first program, and bring the second program in to the foreground.

This was clunky, and people wanted the same ease-of-use in a text-based interface they already had in the graphical environment.

So programs that would multiplex a terminal session were invented, and Screen is the popular one in Linux.

Screen is just another piece of software. But when it runs, it returns you to a shell prompt and disappears itself in the background. Once you've run screen however, you are working in a "screen session" and by pressing CTRL-A you can issue commands to screen. (Control-A is a default key which can be changed.) You can have multiple screen sessions all running at the same time, with different programs active in each. The whole interface with screen is fully accessible as it is fully text-based.

So with screen, you can have the flexibility of a multitasking environment and the convenience of the command line. Screen also has sophisticated features, like the ability to cut and paste between windows and the ability to save output to a log.

A Few Screen Keystrokes

Open a new window: CTRL-A-c
Kill an unwanted window: CTRL-A-K (upper-case)
Go to the previous window: CTRL-A-P or CTRL-A-Backspace
Go to the First Window: CTRL-A-0 Note the windows are numbered from 0 to 9
Go To the Next Window: CTRL-A-N
Go To Next Window: CTRL-A-Spacebar (alternate keystroke
Go to Window 9 CTRL-A-9
Monitor activity in a window on the status line: CTRL-A-M (upper-case)
Display a list of windows: CTRL-A-W
Display Time and Load average: CTRL-A-t
Show a help screen: CTRL-A-?
Detach from screen: CTRL-A-d
Power Detach: CTRL-A-DD (2 upper-case letter Ds)

Additional Notes on Screen

The Kill command will kill the window and all processes running within int. If the intention was to close the window and keep processes launched running, that is detaching.

The power detach logs you out but the screen sessions stay active. The standard detach simply disconnects your terminal from the screen sessions but keeps you logged in.

When you go to another window, screen needs to repaint it, so the screen access program will reread that window's entire contents. I tend to use screen with JAWS set to speak nothing and review with the JAWS cursor.

To get back in to screen after a detach, simply type screen -r

The command used for multi-user screen in Lectures 5 and 6 was screen -x avictim /student

Being able to detach is particularly handy. When you detach with CTRL-A-D, you are returned to your mormal shell prompt outside of screen. But screen, with all your windows inside keeps on running; you have simply put screen and all the sessions it contains in the background. You can now log off and your active programs will continue to run onn the system.

It is rude to have lots of processor-hogging tasks running on someone else's session when you are not logged in. If you are using a VPS or a real Linux system that belongs, say to your ISP, try to not detach from sessions unles there is a good reason to do so.

On the other hand, if you aare administrator and responsible for the system, detaching is useful. You might visit a client and start a long installation running, then detach and go visit another client. AT the second client's office, you can re-attach to the first client's system via screen to check out how things are going.

I use screen all the time at work to connect to my system at home and fix things on my lunch hour. because it is my own system, and I get to keep all the pieces that I break, attaching and detaching as many times as I need to is perfectly acceptable.

However, if you were to log in to Kerry's VPS(drongo) and start up multiple games, web browsing and IRC sessions using screens, this might cost him money, so ask permission first.

Basics of Command-line Interaction

On a command line, you typically start out with -- what else -- a command. This is followed by a space and then some options, sometimes called arguments.

Some of these command lines can be terribly long and complex. There are many command-line editing tricks you can master to speed your typing and reduce errors.

Understanding The Command Line History

Each time you type in a command with its corresponding arguments, Linux keeps a log of this entry which is called the command line history. This history is persistent, and does not get erased when you log out or back in.

Pressing two ! (exclamation points) followed by Enter repeats your last command.

Pressing up arrow also repeats your last command. You can repeatedly press up arrow or double exclamation points to move backwards through the command history.

You can press down arrow to move forwards through the command history if you've moved upwards first. This is a good example of where the arrow keys do work, but where you still must be careful. Once your cursor is on a line displaying a previous command, pressing ENTER will execute that command.

There are two methods for searching backwards through the command history. CTRL-R is an incremental search: as you type it matches previously entered command lines. There is no need to press enter until you locate a line you wish and plan to execute that command.

You can also type an exclamation point followed by a search string. You need to press enter, to begin this type of search.

There are other keystrokes for editing any command line on which your cursor rests. Typing control-A takes you to the beginning of the line. This conflicts with screen and can be a problem if you forget you are inside a screen session and haven't changed screen's activation key.

Control-E takes you to the end of the line. Control-K deletes the remaining text on the line from wherever your cursor is positioned. Control-D deletes the character under the cursor, and backspace deletes backwards; the character to the left of the cursor. Control-f and control-b move forwards and backwards by characters respectively and right and left arrows usually do the same thing.

On your own system you can practice this all with simple commands like date, man, ls, fortune and calendar. There are even more command-line editing commands if you wish to become a real expert.

The "Less" pager

A pager is a utility that displays a file a screen at a time. Whereas the cat command scrolls the entire file nonstop, a pager will let you browse leisurely.

More is the easiest and most limited pager. You simply press space to tell More to move ahead a screen.

Most is the most complex pager. It can show multiple windows with multiple files simultaneously. It is not very speech-friendly.

Less is a good compromise because it is accessible and easy to use, but quite powerful.

Basic Commands for Less

Move forward one screen: Spacebar
Move Backward one screen: b
Search for a string /string/Enter
Find next occurance of last entered search: n or / again.
Go to a percentage NNP (where NN is a number, e.g. 64p for 64%
Tell what line number you are on: N (upper-case)

Note that when searching a term, if you press n or / to search for the next occurrence of the term, it may occur on the same screen that yu are on. With a screenreader, this may give the impression that the highlight hasn't moved. In reality, a visual highlight by reversing the colours is move from word to word. Keep pressing / or n until the highlight moves to a new page.

A few more random tips

  • You can install a package called dwww that shows all documentation on your system in html.
  • Use the right tool for the job. A WYSIWYG editor is better for long documents, but ed can make it quick for experienced users to modify configuration files.
  • Read documentation rather than just randomly typing in things.
  • If you get frustrated with the complexity of man pages google for relevant tutorials and how-to documents. Remember that some forum and blog posts are merely cookbook solutions; they tell you what to type but not why, and mindlessly following their instructions might have you baking cakes without eggs.

Text File Basics

In graphical environments, people typically work with word documents and spreadsheets. System administrators typically work with text files, because they are used by so many utilities for configuration purposes, and because they hold the source code for program code and scripts.

Text files are composed of lines and certain ASCII characters mark the ends of these lines.

In DOS and Windows, lines are terminated with both a carriage return and a line-feed. The carriage return sent the printer to the following line, and the line-feed advanced the printer to the next line.

On the Braille 'N' Speak and on the Mac, lines are terminated with a carriage return only. If the user printed, the system automatically added the necessary line-feed characters.

On Linux, lines are terminated with line-feed only. Linux adds the necessary carriage returns whesn sending text to a printer.

Because text files are so ubiquitous, utilities like ftp and wincp can transfer between systems converting line endings automatically, but only if they know it is a text file and you've specifically asked for a text transfer. By default they transfer in binary (sometimes called image) mode.

If you transfer files between systems and their line endings are wrong, text editors on the foreign systems will not cope gracefully with the file. So you will find that you need to translate the line endings for the system on which you are currently editing.

One useful utility for performing this chore is flip. Versions for Linux, Windows and Mac are available. Flip is a command line utility with these parameters:

flip -d make it dos flip -m make it mac flip -u make it unix (Linux)

After the -u -m or -d arguments you need to include the filename on the flip command line.

If you work on a system where flip is not installed, try the commands dos2unix and unix2dos

which are self-explanatory.

Some large documentation in text files is delivered on a system in a compressed format. You can use gunzip (which is standard) or bunzip2 which handles even more tightly compressed files to "inflate" them back in to readable text.

Edit - History - Print - Recent Changes - Search
Page last modified on March 18, 2012, at 01:41 PM