N900: using commands in X-Terminal

rm 2010-03-15

Diese Seite auf deutsch

Nokia N900 with Linux Maemo 5

useful commands in the X-Terminal app

open X-Terminal and type in:

0. Basic Commands:

> ls
shows the content of the current dir(ectory)
> ls -l
dir content in long form with many details like access rights and sizes
> ls -a
content of current dir including hidden files (i.e. such files whose name begin with a dot)
> cd dirname
”change dir“ changes into the dir dirname
> cd
changes into the homedir (usually /home/user on the N900)
> pwd
shows the complete path of the current dir
> mkdir dirname
creates the new dir dirname inside the current dir
> rm filename
removes file filename from the current dir
More info about commands like cd, ls, ln, mkdir, rm, rmdir etc.:
In the search line in the app ”Internet“ type: man cd
Google will find a page explaining the command as a ”man page“.

1. show the running processes, ordered by CPU-usage:

> top
the list will be updated automatically, exit by typing ‚q‘
-> interesting is also the header part of the top-listing, especially the percentage before ‚idle‘: should be more than 90, while the N900 is not used
-> a high value for ‚mem‘-usage is normal in Linux, nothing to worry about.

2. Overview of used/free space on mounted volumes (flash memory etc.):

Important is the free space on ‚rootfs‘. Each OTA system update needs plenty free space in rootfs.
> df -h

3. Volume space as used by subdirectories:

> cd
> du -sh

shows the summary usage of the current dir, or use:
> du -h | more
to see the space used by each subdirectory, click through the long listing with ‘space‘.
Or firstly change into the interesting subdir, for example ‚MyDir‘,
> cd MyDocs
> du -h | more

4. How to find out the current IP address:

> /sbin/ifconfig wlan0
this works fine as normal user, you do not have to be root, gainroot is not needed here!
In Linux (o.o. Unixes) you should not use root without need.

5. Becoming Superuser:

You have to install one of the root packages first.
Beware! As superuser (‚root‘) you can ruin everything in the system instantly.
> sudo gainroot
now you are root. Do what you have to. Remember that all files and dirs created while you are root belong to root and are not usable by the normal user. Leave root as soon as possible. The root prompt ‚#‘ reminds you that you are still root.
Leave superuser mode:
# exit

6. Battery state and simple scripts:

The following command shows all the N900 knows about its battery state:
> lshal -u /org/freedesktop/Hal/devices/bme
Much text will be displayed. If you only want to know the remaining percentage:
> lshal -u /org/freedesktop/Hal/devices/bme | grep percent | tail -c +34
Long commands like this are better stored as a script file, in order to avoid typos. The first line of the script should be:
and the next line(s)s contain(s) the command(s).
Save the script file under filename and make it executable with chmod:
> chmod a+x filename
Later you can call the script by just typing:
> ./filename

Leave a Reply

You must be logged in to post a comment.