Terminal Activity

From OLPC
Jump to navigation Jump to search
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 a pre-installed Activity that allows you to control your XO directly from a command line, similar to the Terminal program for Mac OSX or the Command Prompt for Microsoft Windows. The Terminal allows you to do far more with your XO than running Sugar activities. But it is also possible to delete your data, and the system data from the command line, so care is needed.

BEWARE: If you become user "root" by executing "su -l " you have full control -- you can destroy all software!


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.

Note: You can find Keyboard Shortcuts and the keyboard illustrated here.

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

The core Linux used on the XO is Fedora 7.

Copy and Paste into Terminal Window

It is not possible to copy and paste from the Terminal as of Ship.2 (The version all G1G1 donor will receive). So, if you are following some instructions from a web page in the Browse activity, and want to copy them into the Terminal activity, a pen and paper is required unfortunately. Copy/paste, but not Drag-and-Drop, will be possible in Update.1. This has been logged on the dev.laptop.org bug tracking system.

There is a partial work-around for this problem, using the third button of a mouse. See Scroll-Wheel Copy and Paste. That page also has instructions to make the right touchpad button act like the third button of a mouse.

Paste script

It is also possible to create a script for pasting from the clipboad.

Open a terminal and create a new file in the home directory, this can be done with nano for example.

   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()

Save then make the file executable by typing

   chmod a+x paste

Finally to run the script to paste from the clipboard type

   ./paste

Change font size in the Terminal Activity

Here is how to increase the print size in the terminal:

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

And change it to

Font = Monospace 16

(or whatever you want).

  • Press Control-X and answer Yes to save.
  • Close the terminal activity (the X in the top right-hand corner)
  • Re-open the terminal activity, the terminal should now be in larger print.

The Console

Another way to bring up the Linux command prompt is by pressing the Ctrl+Alt+Neighborhood keys at the same time (the Neighborhood view key is represented by a circle with 8 small dots Mesh key f1 small.png). This will switch to a console that runs outside the Sugar UI and X Window System. The console also displays some internal messages during XO operation. (Note that many Sugar binding are not available in the console, so commands such as sugar-control-panel will not work there.)

To return to the X Window System environment, press Ctrl+Alt+Home keys (Home key f3 small.png).

There is a second terminal (technically, /dev/tty2) outside Sugar that you can switch to by pressing Ctrl+Alt+Group keys (Friends key f2 small.png).

Changing font size in the console

To increase the font size in the console, type:

setfont sun12x22

Cutting and Pasting

Using build 650

It is not possible to cut and paste from the terminal to other activities. However you can use the the clipboard function (i.e., to cut and paste) to drop text into a terminal if you attach a 3 button USB mouse to your USB port. After you have copied text from the web page(usually Ctl C), switch to the Terminal activity, put your cursor on the command line and click your middle button. Doing that should cause the text to be copied successfully.

Isn't it possible to configure the X Server so that the "double chord" of pressing the left and the right mouse button at the same time, emulate the middle mouse button? But even simpler would be to use the right mouse button for pasting since it is not currently used in the terminal. -- Dov Grobgeld - 2008-01-23


Also try "CTRL+SHIFT+V" for paste.

gnome-terminal

Chew up some of that precious nand and install gnome-terminal so you can paste those long strings into a shell:

su -1
yum install gnome-terminal

Using joyride build 1606

This experimental OS build has cut & paste included and working. You can update your whole system from the terminal as a super user by typing

olpc-update joyride-1606

[Note to authors: suggest providing (perhaps thru a link elsewhere) any well known pitfalls to using this experimental implementation on an XO used by a child]

See Also

  • BASH Reference A longer list of commands that can be used in the Terminal.