User:Tdang/XO Command Line Tips
I'm a Linux novice, so I can't give much advice, but hopefully the advice I can give is handy for other novices. I'm not going to worry here what's Linux-general and what's XO-specific.
su and root
On most systems, you'll need a special password to do system-wrecking things. On the XO, it's easy to do it. Of course, being able to do system-wrecking things also means being able to do very useful things.
In Terminal, you'll need to become a superuser to do many things. To do this, simply type "su" at the command line. When you don't want to be superuser anymore, type "exit" and it will return you to your normal login.
If you find yourself at the "console" (black screen, small print, actually outside of Sugar so the Home View key doesn't work), you can login with the username "root" and no password. Then you're superuser automatically.
directory paths
Directory paths are built with "/" characters. You move around with the "cd" command.
For instance, if I'm in /home/olpc and I want to go to /home/olpc/Activities, I type:
cd Activities
A double dot ".." means to go back up one level, so to get back to /home/olpc, I type:
cd ..
I can always type a full path, so I can go from /home/olpc to /home/olpc/Activities/Speak.activity by typing:
cd /home/olpc/Activities/Speak.activity
I can find out what directory I'm currently in with the command "pwd".
"ls" is the command to look at the contents of a directory. A very useful variant is:
ls -a
That shows you all the contents of a directory, including "hidden" files and directories. You can always give it a full path if you want to look at a directory you're not in:
ls /home/olpc/Activities/Speak.activity/ -a
Whenever you're typing in a directory path or filename, you can use "tab-complete". If I've typed part of a valid filename, and then hit (TAB), the computer will try to finish it for me. If there's several possible ways to complete it (several files with the same starting characters) it won't really be able to to it, but it can speed things up a lot.
I type:
ls /h(TAB)
It becomes:
ls /home/
I continue:
ls /home/o(TAB)
It becomes:
ls /home/olpc/
...and so on.
useful paths
There's three path-areas which I find myself wanting to use most.
The first is the location of your USB stick, if you've got one (or more) plugged in.
ls /media/
This shows me a weird-colored name called (in my case, yours will probbly be different) "001B-9622".
ls /media/001B-9622/
This gives me the directory of things on my USB stick.
The second is the general user / activities area. This is:
/home/olpc/
Activities which you install (not the pre-installed ones) go into:
/home/olpc/Activities/
You'll be able to edit things in the /home/olpc area without being superuser.
The third is where Sugar's (mostly) at:
/usr/share/sugar/shell/
I've so far only wanted to make changes in:
/usr/share/sugar/shell/view/home/
and:
/usr/share/sugar/shell/view/frame/