Translations of this page:

Using a terminal: tutorial

This is a brief guide, designed to help you get familiar with using a terminal in Linux. By including very detailed instructions here, they should not be necessary in the main body of the wiki. Once you have worked through this tutorial, you may find LinuxCommand.org a useful next step.

Opening a terminal:

In Easy mode (the out-of-the-factory default Linux), press and hold the Control (Ctrl) and Alt keys at the same, and then press “T”, then release all keys. This is often written as Ctrl+Alt+t or Ctl+Alt+t. This will open up a simple terminal application.

Also in Easy mode you can go Work > File Manager > Tools > Open Console Window (or Work > File Manager and Ctl+T). This gives you a more fully featured terminal application.

If you already went ahead and installed Advanced mode, you can access the run command, but pressing Alt and F2 at the same time (Alt+F2), and then typing the name of a terminal:

xterm

or

konsole

and then press “Enter”

Issuing a command at a terminal:

Type the command you want to run, along with any options, and finish by pressing “Enter” at the end of the line.

For example, to check your TCP/IP settings, you would use the command ifconfig. To do so, type:

sudo ifconfig

and then press “Enter”.

You should see an output similar to:

ath0
Link encap:Ethernet  HWAddr  00:15:XX:XX:XX:XX (mac address)
inet addr: 192.168.1.XXX Bcast: 192.168.1.255 Mask: 255.255.255.0
UP BROADCAT RUNNING MULTICAST MTU: 1500 Metric: 1
RX packets: 33 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets 125 errors: 0 dropped: 0 overruns: 0 carrier: 0
collisions: 0 txqueuelen: 0
RX Bytes: 3402 (3.3 KiB) TX Bytes: 14208 (13.8KiB)
collisions: 0 txqueuelen: 0
RX Bytes: 69453 (67.8 KiB) TX Bytes: 69453 (67.8KiB)

lo
Link encap:Local Loopback
inet addr: 127.0.0.1  Mask: 255.0.0.0
UP LOOPBACK RUNNING MTU: 16436 Metric: 1
RX packets:607 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets 607 errors: 0 dropped: 0 overruns: 0 carrier: 0


wifi0
Link encap:Ethernet  HWAddr  00:15:XX:XX:XX:XX (mac address)
UP BROADCAST RUNNING MULTICAST  MTU: 1500 Metric: 1
RX packets 88602 errors: 0 dropped: 0 overruns: 0 frame: 29523
TX packets 513 errors: 0 dropped: 0 overruns: 0 carrier: 0
collisions: 0 txqueuelen: 199
RX Bytes: 8468525 (8.0 MiB) TX Bytes: 36584 (35.7KiB)
Interrupt: 10 Memory: e0460000- e0470000

How terminal commands are often written:

This section is for information only. You will not be able to run the commands set out below unless you have the build-essential package installed, and are running the commands in a directory containing source files.

When people are writing a series of commands to be performed at a terminal, they are unlikely to include the 'and now press “Enter”' parts. They are more likely to write something like:

./configure
make
make install

What this means is type

./configure

and then press “Enter”. When the command has executed (which may or may not print text into the terminal window, and the terminal shows a prompt again, type

make

and then press “Enter”.

And so on, for each command in the list.

How to copy terminal commands from your browser

You can save yourself an awful lot of typing by selecting the text of the commands (for example, in this wiki) and putting the text in the clipboard (using the menu “Edit –> Copy”). In the terminal window you can paste the text by pressing Shift+Insert.

Exiting the terminal:

You can either click the “X” in the top right hand corner, or else type:

exit

and press “Enter”

Alternatively, you can exit from a terminal session by typing <Ctrl><D>

Editing text with nano:

Editing as a normal user

nano is a console-based text editor, which loads very quickly. To use it, type nano, and the path of the file you wish to edit. (If there is no file in the specified location, nano will create one. As such, you must be accurate in what you type, otherwise you will create unnecessary blank files, rather than opening existing files.)

For the purposes of this tutorial, we will create a new text file in the /home/user directory, add a line of text, save the file, and exit nano.

First, create the new text file, named “text” in the /home/user directory:

nano /home/user/text

nano will open, with a blank document. Type a line of text. Press “Enter” to start a new line.

When you have typed your line of text, you need to save your changes, by writing the file. To do this, press Ctl+O together (that's “O” as in “MNOP” and not “0” as in “0123”).

If you want to change the file name, you can change it here. Then, once you are happy with the file name, or if you wish to overwrite an existing file which you have opened, press “Enter”

When you have saved your file, exit nano by pressing Ctl+X together.

When you have done this, you can open the file to check that your changes have been saved:

nano /home/user/text

You should see whatever text you typed.

If the file name has / requires spaces:

If you wanted to create or open a file with a space in the name, you would need to include the whole path in quotation marks. It is advisable that you do not use spaces in names.

For example:

nano "/home/user/text/name with spaces"

Editing with root privileges

If you need to open a text file in nano with root privileges, preface the usual nano command with sudo:

sudo nano /home/user/text

This is necessary when editing certain restricted system files. For example, to edit the list of repositories available to apt-get / Synaptic, you would need to use sudo:

sudo nano /etc/apt/sources.list

Similarly, to edit the configuration of network interfaces on your EEE, you would need to use sudo:

sudo nano /etc/network/interfaces




Created by Neil. Reference to LinuxCommand.org thanks to deicidist and marduk.

 
guide_to_terminal.txt · Last modified: 2008/11/01 03:53 by mp388
 
Recent changes RSS feed Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
This website is no longer under a Creative Commons license.
All rights are reserved by Eeeuser.com and each individual author
If you want to reproduce content, all individual contributers must be identified and you must seek permission from Eeeuser.com