Terminal Activity: Difference between revisions

From OLPC
Jump to navigation Jump to search
m (provide GNOME links)
Line 153: Line 153:
* [[Linux software]] A brief description of <i>some</i> of the linux software that is installed with Sugar.
* [[Linux software]] A brief description of <i>some</i> of the linux software that is installed with Sugar.
* [http://www.ss64.com/bash/ BASH Reference] A longer list of commands and programs (many are not installed on the XO-1 by default due to its constrained storage).
* [http://www.ss64.com/bash/ BASH Reference] A longer list of commands and programs (many are not installed on the XO-1 by default due to its constrained storage).
* [http://commands.tips-linux.net/ Linux commands] A list of most used linux commands.

Revision as of 15:30, 16 March 2012

This page is part of the XO Support FAQ.     Support Index | Print This Page
<imagemap>

Image:Support-banner-square.png|173px|community support pages rect 0 0 135 204 [1] rect 135 0 345 204 Support FAQ rect 0 205 135 408 [2]

  1. Comment : there's some whitespace here:

rect 135 205 345 408 Other support

  1. maybe desc none is better. testing.

desc none

</imagemap>

Activity-terminal.svg The Terminal activity grants access to the XO's Linux command line.

The Terminal is an Activity that allows you to control your XO directly from a command line, similar to the Terminal program in Mac OS X or the Command Prompt in Microsoft Windows. The Terminal allows you to do far more with your XO than running Sugar activities. But BEWARE it is also possible to delete your data, so be careful. And if you become the root user, you have full control of the computer and can destroy all software!

See the Terminal manual.

Starting Terminal

The Terminal Activity is found in the Activities taskbar at the bottom of your Home View. You may need to scroll through the Activities taskbar by using the right arrow icon at the bottom of your screen (Frame-scroll-right.gif) to find the Activity-terminal.svg icon.

On 10.2 version of the software, go to your Home View, the press the List view icon, View-list.png, in the right top corner of your screen; your 'circle of activities' will change to a list of activities. In the search box on the left top of your screen, type 'term' and you will find the Terminal Activity. It is not available in the circle, but as you can see it is availble in the list!

Starting a console

You can also access a Linux command prompt by switching to the console, instead of starting the Terminal activity.

Common Terminal commands

When you start Terminal, it runs the Bash "shell" program that interprets keystrokes and commands. Its main job is to allow you to run other programs, for example:

There are hundreds of Linux commands available in the Terminal, Linux software describes some more of them. The OLPC system software on the XO is a slimmed-down version of Fedora and so its command-line programs come from Fedora. Many command-line programs from Fedora are not available but experienced users can add them using yum or rpm.

Users and super-user

Initially Terminal connects to your computer as the default user (usually "olpc", perhaps "liveuser" on a Live CD). Some programs require that you run them as the root "super-user. You can prepend sudo to these, or press the #_ icon in the Activity menu to become root, or enter su -l to become root. To repeat, the root user has awesome destructive power, do not run commands as root unless you have to.

Copy and paste in Terminal

  • Use the Edit menu

Where is the Edit menu?

  • Press Shift+Ctrl+C to copy, Shift+Ctrl+V to paste. (You have to hold the shift key down in addition because Ctrl+C and Ctrl+V are meaningful key combinations in terminal programs.)
  • Plug a three-button mouse into a USB port and use the middle mouse button to paste.
  • Click both buttons below the XO-1's track pad (or click directly between them) to paste.

You can select text in Terminal's window and use the last technique to duplicate it without first copying it to the Sugar clipboard.

Paste script

(This is more relevant to earlier releases where copy and paste did not work in Terminal.

You can create a command-line script named paste to paste text from the clipboard into Terminal. To create this using the nano text editor, enter

 nano paste

In the file enter the following

#!/usr/bin/python
import pygtk
import gtk
cb = gtk.clipboard_get(selection = "PRIMARY")
print cb.wait_for_text()

su-1 wget http://fpdownload.macromedia.com/get/flashplayer/current/flash-plugin-10.0.3.18-release.i386.rpm.rpm-i-flash-plugin-10.0.32-release.i386.rpm exit chmod a+x paste Save and exit, then make the file executable by entering

 chmod a+x paste

Finally to run the script to paste from the clipboard enter

 ./paste

Other keystroke commands

Keyboard shortcuts lists special keys in Sugar. Some of these don't work in Terminal, or require that you press the Shift key as well.

Change font size in the Terminal activity

To increase the print size in Terminal:

  • Launch the Terminal activity.
  • Type
nano ~/.sugar/default/terminalrc
  • Find the line saying
Font = Monospace

And change it to

Font = Monospace 16

(or whatever you want—see Fonts for info on determining available fonts).

  • Press Control+X and answer Yes to save.
  • Stop the Terminal activity (the stop-sign icon in the top right-hand corner of the Activity menu)
  • Re-open Terminal, the terminal should now be in a larger font.

CAUTION: When you change to a larger font as described, you may find that the text continues on following lines or wraps around in a confusing fashion. This is particularly true if you try to use the nano editor to make further changes. In that case you may have to use the vi editor which also is supplied with the terminal activity (type:

vi ~/.sugar/default/terminalrc

Be sure you understand how the vi editor works. If you make an error in saving the changes, you may render the terminal inoperative. The only way to restore it then may be to do a reinstall of sugar from a USB drive. (this is the writer's experience).

The Console

Another way to bring up the Linux command prompt is by pressing the Ctrl+Alt+F2 keys in sequence.

By design, not all XOs have the F2 legend on the key, see Keyboard#Missing_keys.

Ctrl-Alt-F2 will switch to a console terminal that runs outside the Sugar and GNOME.

To return to the Sugar or GNOME environment, press Alt+F1. (On releases before 11.2.0, use Alt+F3).

Most Sugar or GNOME commands won't work on the console.

Logging in

Press enter, and the console will log you in as root. (On some older releases, you may see a login prompt, if so type root and press enter.)

You are now logged in as the root user, be very careful.

Alternative terminal program

You can install gnome-terminal:

su -l
yum install gnome-terminal

Here are the changes proposed:

After you press return you may receive a number of lines of text which end with "error 404 Not Found Trying other mirror".

Be Patient: Eventually you should see a download of 4.4 MB then on the next line fedora

then you will see

primary.squlite.bz 2 6.1MB

When you receive a -bash-3.2# prompt the load is complete.

End of change so far:

Use an existing terminal session to launch a 'gnome-terminal' session.

COMMENT:

Here there should be additional guidance. What is done next is not clear. The natural thing to do would be to exit the root into for the normal terminal prompt

Then enter "gnome" or "gnome-terminal" .

However neither command yields anything but "bash: gnome-terminal (or gnome): command not found.

So that is all i can contribute at this time. LUDD.

See also

  • Linux software A brief description of some of the linux software that is installed with Sugar.
  • BASH Reference A longer list of commands and programs (many are not installed on the XO-1 by default due to its constrained storage).
  • Linux commands A list of most used linux commands.