Editing Terminal

Warning: You are not logged in. Your IP address will be recorded in this page's edit history.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 16: Line 16:
# Select ‘Utilities’
# Select ‘Utilities’
# Select ‘X Terminal’
# Select ‘X Terminal’
-
 
-
=== 770 ===
 
-
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 ==
== Using the terminal ==
'''Before you start, backup your data'''
'''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 access|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.
+
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'''
'''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 installed on your desktop PC, there you can normally type the command with the parameter <code>--help</code> to get a list of options, i.e. <code>ls --help</code>, or look up manual pages if installed, with the most helpful linux command <code>man</code> for "manual", like:
+
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 <code>--help</code> to get a list of options, i.e. <code>ls --help</code>, or look up manual pages if installed, with:
  man ls [enter]
  man ls [enter]
-
or
+
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 [http://ss64.com/bash Linux commands] or [http://www.busybox.net/downloads/BusyBox.html Busybox list of Linux commands and options for each one]
-
+
-
man man [enter]
+
-
 
+
-
to find out what a command does and what are and the options it allows.  
+
-
 
+
-
However on maemo the default shell is busybox which has lots of commands like <code>ls</code> built in, and most of them are crippled in functionality so don't support a really helpful --help function. Also the <code>man</code> command is not available on standard maemo. So maemo NITs are basically a hostile environment for beginners to learn about linux.
+
-
 
+
-
There are ways to mitigate this:
+
-
* install man. The pkg is available e.g. here:[http://maemo.org/packages/view/man-db-n900/] and also in your application manager when you got the extras-devel catalog enabled.
+
-
* install bash (version 3 or 4), a proper fullsize shell though without many builtins. (http://maemo.org/packages/view/bash3/ http://maemo.org/packages/view/bash4/, again also in your application manager, from extras catalog.
+
-
* install proper original tools to replace the crippled ones of busybox, when you  already installed bash. Refer to e.g. [[User:Joerg_rw/tools]]
+
-
 
+
-
WARNING: You might feel like getting rid of supposedly useless busybox when you did the above suggested installation of bash and tools. ''DO NOT uninstall busybox'', it's needed for maemo bootup!
+
-
 
+
-
If you're reluctant to do all of the above (installing man package mandb-N900 is strongly recommended anyway), you may look up general linux cmdline help here: [http://ss64.com/bash Linux commands], and details about crippled busybox here: [http://www.busybox.net/downloads/BusyBox.html list of Busybox Linux commands and options for each one]. Man pages online you'll find at [http://manpages.courier-mta.org/manpageindex.html], further links are listed at [http://tldp.org/manpages/man.html].
+
-
 
+
-
You find more links that give you easy as well as ambitious starts on linux shell here: [http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_01_01.html Bash-Beginners-Guide] [http://tldp.org/LDP/abs/html/why-shell.html "Shell Programming!"] [http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_01_01.html Common shell programs] [http://www.faqs.org/docs/bashman/bashref_toc.html#SEC_Contents Bash reference] [http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html BASH Programming - Introduction HOW-TO] and generally under http://tldp.org/
+
=== Basics ===
=== Basics ===
-
 
-
One of the most useful yet unknown to beginners: <TAB> completes anything at any moment, If there are ambiguities, <TAB> will complete only the unambiguous part. Two times <TAB> shows all alternatives when there are ambiguities.
 
-
 
-
Try <TAB><TAB> on an empty line to get a list of all commands that are "known" to the shell (will not find commands that are not in $PATH and so would need full pathname to invoke them)
 
==== Basic commands ====
==== Basic commands ====
Line 167: Line 141:
The dot at the end of the command means the current directory.
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 ====
==== Removing files ====
Line 181: Line 151:
  ~ $ rm -r directory
  ~ $ 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.
 
==== Directories ====
==== Directories ====
Line 209: Line 177:
  mkdir mydirectory
  mkdir mydirectory
-
 
-
And to remove an empty directory, use <code>rmdir</code>
 
-
 
-
rmdir mydirectory
 
=== Directory structure ===
=== Directory structure ===
Line 265: Line 229:
  ~ $ du -m
  ~ $ du -m
-
 
-
To show disk (memory cards, etc.) partitions and their space
 
-
 
-
~ $ df -h
 
-
 
-
To show only rootfs partition
 
-
~ $ df -h /
 
=== Show a list of installed packages ===
=== Show a list of installed packages ===
Line 288: Line 245:
<code>du -m</code> 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.
<code>du -m</code> 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.
 +
 +
To show disk (memory cards, etc.) partitions and their space
 +
 +
~ $ df -h
Show Linux Kernel messages:
Show Linux Kernel messages:
Line 305: Line 266:
=== Networking ===
=== Networking ===
-
The user PATH does not include /sbin for some reason by default on NITs, which is annoying as you need to type in <code>/sbin/ifconfig</code> when normally just <code>ifconfig</code> would be sufficient. You can create a symlink to <code>/usr/bin</code> to make things easier:
+
The user PATH does not include /sbin for some reason by default on NITs, which is annoying as yoou need to type in <code>/sbin/ifconfig</code> when normally just <code>ifconfig</code> would be sufficient. You can create a symlink to <code>/usr/bin</code> to make things easier:
-
  ~ $ ln -s /sbin/ifconfig /usr/bin/ifconfig
+
  ~ $ ln -s /sbin/ifcongig /usr/bin/ifconfig
Example use of <code>grep</code>, which outputs the entire line matching the pattern, in this case "inet addr" which is piped into it from the output of <code>ifconfig</code>:
Example use of <code>grep</code>, which outputs the entire line matching the pattern, in this case "inet addr" which is piped into it from the output of <code>ifconfig</code>:
Line 338: Line 299:
  apt-get update  
  apt-get update  
-
<s>Upgrade any installed apps with newer versions (the <code>-y</code> is optional and just avoids it prompting you as to whether or not to proceed):
+
Upgrade any installed apps with newer versions (the <code>-y</code> is optional and just avoids it prompting you as to whether or not to proceed):
-
  apt-get upgrade -y </s> DEPRECATED!
+
  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:
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:
Line 347: Line 308:
  apt-get autoclean
  apt-get autoclean
-
<s>Remove any packages which are no longer needed. These are applications/libraries which were automatically installed because of dependencies but are no longer required:
+
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
  apt-get autoremove
-
</s> DEPRECATED! May remove essential pkgs, see http://talk.maemo.org/showthread.php?t=70875
 
Install any missing dependencies (which should fix the broken packages issue I had):
Install any missing dependencies (which should fix the broken packages issue I had):
Line 373: Line 333:
  ~ $ dpkg -i nano_2.0.6_armel.deb
  ~ $ dpkg -i nano_2.0.6_armel.deb
-
 
-
To extract the .deb file for any reason
 
-
~ $ dpkg -x nano_2.0.6_armel.deb /path/to/extraction/directory
 
-
 
-
To extract the control file from the .deb file
 
-
~ $ dpkg-deb -e nano_2.0.6_armel.deb
 
-
then you will find the control file named as "control" in "/home/user" if you used "sudo gainroot" to gain root access or in "/root" if you used "root" command to gain root access
 
== Further reading ==
== Further reading ==

Learn more about Contributing to the wiki.


Please note that all contributions to maemo.org wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see maemo.org wiki:Copyrights for details). Do not submit copyrighted work without permission!


Cancel | Editing help (opens in new window)