This page is for beginners to Linux that would like to try the terminal. Below are some basic commands you can use in the terminal app to get you started.


Opening the terminal


  1. Navigate to the application menu
    • If using a firmware release older than PR1.2, navigate to ‘More...’
  2. Tap ‘X Terminal’

Alternatively, use the Ctrl+Shift+X key combination even without opening the application menu.

N800 and N810

  1. Click the command button on the main page
  2. Select ‘Utilities’
  3. Select ‘X Terminal’


Terminal is not installed by default on the 770. You need to install it from the Application manager first. After that it will be available in the same menu as on the N8X0.

Using the terminal

Before you start, backup your data So long as your data is backed up, then you can start to try out the terminal without any fears of losing any data. This page does not cover gaining 'root' on your device so you should come to no harm. If you are gaining root, then it would best to not only have a backup before you start tinkering, but also to familiarise yourself with how to reflash your device in extreme cases where you need to get back to where you started.

But don't be afraid of the terminal and command line, it can be a fast and powerful tool when used correctly and non-destructive commands will not harm your device or your data.

Understand what a command does before you type it Fundamentally you should understand what a command does before typing it in and pressing enter. If you have a linux desktop distribution, like Ubuntu, you can normally type the command with the parameter --help to get a list of options, i.e. ls --help, or look up manual pages if installed, with:

man ls [enter]

to find out what the commands are and their options. However you can't do this on the tablets though as the tablets use cut down embedded commands, (BusyBox - I think?), so look at Linux commands or Busybox list of Linux commands and options for each one


Basic commands

Some example commands, all here are non-destructive. Press enter after each command to execute it.

The terminal should open with a

~ $

To exit the terminal at any time type, exit and enter, so

~ $ exit

echo outputs/prints text to stdout:

~ $ echo "hello world"
hello world

Echo can also be used with variables, such as USER, which contains the current user’s username. Variables are prefixed with a '$':

~ $ echo $USER

Use uname to list the kernel version, and use the -a argument to output all known information:

~ $ uname -a

cat spits out an entire text file to terminal. resolv.conf (remember *NIX is case-sensitive) is where DNS servers are stored. The # hash/pound character is a comment, which means that the rest of the line is ignored.

~ $ cat /etc/resolv.conf



Basic example of a variable:

~ $ foobar='example'; echo $foobar

Example of directing output to a file. Files stored in /dev/shm are stored directly in RAM and thus are deleted on shutdown:

~ $ uname -s > /dev/shm/os; cat /dev/shm/os

Tab autocompletion

In the bottom of the X terminal you find the "tab-key" (it does not exist on the hardware keyboard. The tab-key will autocomplete commands/directory/files when pressed. If you want to see what is in a specific directory you could double-tab. The tab function is a very good way and should be a habit. It not only makes using the terminal faster. It also makes sure you spelt everything correctly.

ls /home/opt/themes/sun[tab] 

will finish the word as "sunset".

ls /home/opt/[tab][tab] 

shows you what is in the opt folder, for example the "themes" folder

Another good tip is "ctrl+c". You will find Ctrl-key on the keyboard. Together with "c" it will cancel (interrupt) any previously given command (NOTE: can also be used in DOS terminals)

[Ctrl-key] c

For example, if you write "find /" it will start listing all the files on the N900. If you press ctrl+c it will stop.

Managing Files

Listing files

To list files in a directory type ls and hit enter, so

~ $ ls

To list files in a directory with permissions, owners, time, the use the long format with ls, which is ls -l:

~ $ ls -l

To list hidden files and directories

~ $ ls -la

To list all mp3 files on memory card mmc1

~ $ ls -l /media/mmc1/*.mp3

Copying files

To copy files use cp, so

~ $ cp file file2

This would make a copy of file and call it file2. Note that "file2" can be a whole other path (like /home/user/MyDocs/afolder/file2). If file2 already exists it will be overwritten.

You can also copy multiple files in one go, like so:

~ $ cp file1 file2 file3 /the/destination

Where the destination must be a directory.

Moving files

To move files use mv

~ $ mv file2 mydirectory/file2

moving file2 to mydirectory directory

You can also use mv to rename a file

~ $ mv file newname

But what happens if I want to copy stuff into the directory I am already in do I have to type out the whole directory tree again. Well you can but it is much simpler to do the following:

~ $ mv mydirectory/file .

The dot at the end of the command means the current directory.

You can also move multiple files in one go, like so:

~ $ mv file1 file2 file3 /the/destination

Removing files

To delete a file, use the rm command:

~ $ rm file

To delete a directory and all of its subdirectories and files, use the recursive option with rm:

~ $ rm -r directory

Be careful when you use the recursive delete, it will remove everything under the given directory without asking you for a confirmation.


To change directory use cd, so

~ $ cd MyDocs

To go back a level on a directory

~/MyDocs $ cd ..

To go back two levels on a directory

~ $ cd ../..

To go back three... I think you get the idea

By the way, the bit before the $, tells you the directory you are in. The symbol ~ means your home directory, however to find out which directory you are in

~ $ pwd

pwd stands for present working directory

To create a directory, use mkdir

mkdir mydirectory

And to remove an empty directory, use rmdir

rmdir mydirectory

Directory structure

One thing to note is the directory structure on a Maemo device. When you open the terminal on the device you are in the directory /home/user Equivalent to MyDocuments in Windows. The top level directory like C: drive on Windows is a / known as a root directory. Try and stay in the /home/user directory at first, or look at your memory cards which is in the directory /media. Further information about filesystem can be found at an article named N900 filesystem.

Finding files

find /media -name "*.jpg"

Finds all files ending with a .jpg, i.e. photo files in /media directory, memory card. The * is a wildcard.


  • * means any number (zero or more) of characters
  • ? means exactly one character
  • [a-d] means exactly one character from the range 'a' to 'd' (ie 'a', 'b', 'c' or 'd')
  • [xyz] means exactly one character from the set 'x', 'y' and 'z'
  • [a-ckp1-3] means one of 'a', 'b', 'c', 'k', 'p', '1', '2' or '3' and so on...


find . -name "birthday?[bg]*"

Will find any files starting with birthday, followed by any one character, then either a lowercase b or g, with * meaning any other characters if any.

If you want to stop a search, or any command for that matter press and hold Ctrl and then press c:

<Ctrl> c

To find a word in a file you use grep. For example, if you want to find the word Maemo in file mydocument you type

grep "Maemo" mydocument

Opening tar.gz files

To open a tar.gz you need to unpack it, it is an archive file, like zip files. I recommend creating a new directory before unpacking, so

mkdir mynewdirectory
cd mynewdirectory/
tar -xvfz myarchive.tar.gz

This will unpack myarchive.tar.gz into mynewdirectory/

Starting a GUI application

Everything is run from a terminal in *NIX. A GUI program is a running instance of a terminal process. Therefore the camera program can be launched. The & (ampersand) tells the shell to run the command as a background job:

~ $ /usr/bin/camera &

Show disk usage in megabytes

~ $ du -m

To show disk (memory cards, etc.) partitions and their space

~ $ df -h

Show a list of installed packages

Show a list of all your programmes installed including those not visible in the Application Manager"

dpkg -l


You can do fancy things and link commands together with what is called a pipe (this symbol: | ). Press Chr on the N810 or Fn on the N900 to find the pipe | symbol. You can program the terminal to show the pipe symbol, by going to tools->settings and entering bar as a toolbar shortcut. What the pipe does is that it takes one program's output and gives it to another as input.

So using du with the sort command you can list files and sort in order of megabytes,

~ $ du -m | sort -r -n | more

du -m lists files in megabytes then pipes it to sort to sort it in order of megabytes, largest first, then the more command shows you one page of the screen at a time, pressing enter to show more pages.

Show Linux Kernel messages:

~ $ dmesg | more

ps lists running processes, you might also be interested in the interactive top command. Piped to awk which in this case says to only show the 5th column (separated by tab characters)

~ $ ps | awk '{ print $5 }'


The user PATH does not include /sbin for some reason by default on NITs, which is annoying as yoou need to type in /sbin/ifconfig when normally just ifconfig would be sufficient. You can create a symlink to /usr/bin to make things easier:

~ $ ln -s /sbin/ifcongig /usr/bin/ifconfig

Example use of grep, which outputs the entire line matching the pattern, in this case "inet addr" which is piped into it from the output of ifconfig:

~ $ ifconfig | grep "inet addr"

This advanced example pipes from ifconfig to grep to awk and finally to cut to output the clean IP address which can then be fed into something else if desired:

~ $ ifconfig | grep "inet addr" | awk '{ print $2 }' | cut -d : -f2

Writing a shell function

A simple shell function that uses a variable and if/then/else logic:

~ $ minute() { foo=`date +%S`; echo $foo; if [ "$foo" -lt "30" ]; then echo "under half"; else echo "over half"; fi; }
~ $ minute
under half

Using the shell function we just wrote, outputs the current time in seconds (only the seconds part) and whether it is closer to the last minute or next minute. Shell functions are only available for the terminal session. Save in .bashrc or .profile to be persistent.

Gain root access

You might need root access in order to make some advanced changes.

Debian package management

Update local metadata detailing what apps are available in the repositories. This is important so apt-get can find the latest software:

apt-get update 

Upgrade any installed apps with newer versions (the -y is optional and just avoids it prompting you as to whether or not to proceed):

apt-get upgrade -y 

Remove any downloaded package archives. Once the package is installed the downloaded file is no longer needed. The Application Manager does this automatically but if you are using "apt-get" you'll have to do it manually:

apt-get clean

The same as "apt-get clean" but only remove package archives which are obsolete (no longer in repsitories). Having run "apt-get clean" it is pointless to run this command:

apt-get autoclean

Remove any packages which are no longer needed. These are applications/libraries which were automatically installed because of dependencies but are no longer required:

apt-get autoremove

Install any missing dependencies (which should fix the broken packages issue I had):

apt-get -f install

Search repositories for packages by keyword:

~ $ apt-cache search nano
nano-tiny - free Pico clone
traceroute-nanog - Determine route of packets
nano - nano editor

Install the nano package (an easy to use CLI text editor):

~ $ apt-get install nano

Instead of using the repos, use wget to download a .deb package from a website:

~ $ wget http://nitstuff.appspot.com/dists/chinook/user/binary-armel/nano_2.0.6_armel.deb

Install a locally-stored Debian package:

~ $ dpkg -i nano_2.0.6_armel.deb

Further reading

There are infinite possibilities with the terminal, I'd recommend using google if you want to find out more or look at Busybox commands or learning the shell. Again to reiterate please make sure you backup your data before tinkering and when you want to try a new command, make sure you understand what it does first.