The Terminal Activity is the most powerful method of interacting with Sugar. However if you are not used to it then knowing some basics can help. The best strategy is to start using some simple commands. Don't attempt to do all your work from the command line straight away. Learn a few commands, use them and add to your understanding of what they can do over time.
Below are some basic commands that you might find useful. Most people find that it is best not to try to learn all of them at once. You might choose a few to learn about and practice, and come back for more after you are comfortable with the first few.
So, let's have a look at each. Feel free to experiment with these commands. Be a little careful as it is possible to do some damage to your computer if you are too casual. If there is a possibility one of the commands can accidentally create havoc then a note warns you about that.
ommand is the List command. You can use this to list the contents of the directory you are in, or you can give it the path to any other directory. Try typing this command by itself in a terminal window and see what you get. Now, one feature of commands is that you can add various parameters to them. This is quite a simple thing to do, and refines the way you use the command. Usually these parameters are added to the command by typing a " - " directly after the command and then the parameter names or abbreviations. For example if you type the following:
ls -l
Then you are passing the l parameter to the ls c
ommand. The l p
arameter is short for "long list". This format gives more information than just typing the ls
command by itself... Try the two out and compare the difference.
You might well ask, "How do I know what the parameters are for each command?" This information can be found by using the "help" parameter for ls:
ls --help
For the ls command you should get familiar with the formats using ls by
itself, as well as ls -al
, and ls -l.
tands for Change Directory. Try it out by typing ls t
o get a list of all the files and folders in the directory you are currently in. Now try typing cd f
ollowed by the name of one of the files in the list, for example if there was a file called "me.txt"
you could type:
cd me.txtThis gives an error! Why? Because you can't change to a directory if it is a file. It's good to try this so that you understand that you can't do any damage by making a mistake with cd.
To change to a directory you type cd f
ollowed by the name of a directory you want to navigate to. If there was a directory called "src" you would type:
cd src
If that was successful then the terminal won't throw up an error. Try it with a real directory on your computer. If you fail it is because either you don't have permissions to enter the directory, you misspelled the directory name, or the directory simply doesn't exist.
If you have navigated to some distant directory, you can get back to your home directory with the command
cd
without any path.
ommand:
mkdir bleepThe above command creates a directory called "bleep" in the current directory
. If a directory with this name already exists, you get an error but fortunately the computer doesn't overwrite the existing directory.
nd it tells you where you are. pwd means Print Working Directory - this command gives you the location or absolute path of where you are. For example, if you are in your olpc
home directory, the output of the pwd c
ommand is:
/home/olpcExperiment with changing directories with c
d then typing pwd t
o see where you are.
llows you to move files around on the computer. To use mv y
ou must first type the command, followed by the file you want to move and then the place where you want to move the file to. For example, if you wanted to move a file "me.txt" from your current directory to the "bleep" subdirectory in the current directory you would type the following:
mv me.txt bleepNote: You don't have to type the filename in the path name where you want to move the file unless you also wish to change the name of the file. If for example while you were moving "me.txt" you wanted to change the filename to "you.txt" you would type:
mv me.txt bleep/you.txtIf you just wanted to rename the file and not move it you could use mv
by typing this:
mv me.txt you.txtNote that when you use mv yo
u are moving the file not copying it. Be a bit careful because you can overwrite files accidentally. If for example there is already a file named "you.txt" in the example above, is it overwritten with the data from "me.txt".
s short for Remove, and is the command you use to delete a file or directory. To use this command type rm f
ollowed by the name of the file you wish to destroy for good. To remove a directory you can use the same command with the parameter -R like so:
rm -R directoryname
In this example "directoryname" is the name of the directory you wish to delete. You can also use rmdir f
or this. Be EXTREMELY careful when using these commands. If used unwisely they could cripple your operating system, possibly requiring reinstallation.
ping cnn.com
If that computer gets the request you get some information coming back through the terminal... this keeps scrolling so to stop it type ctrl + c.
If you get no response from ping then you are probably offline. However, some machines online don't answer ping requests for security and other reasons, so make sure you really know that the machine you are pinging does reply to these requests. Some Internet connections won't allow ping.
ls | less
If you used this in your 1000 file directory you get one page at a time of output and pressing the spacebar shows the next page. You can move to the previous page display with up arrow. What do you think down arrow does? Pressing q quits less. Ok, so you might be wondering what the funny straight line is in the above command... well, this is known as the pipe command.
pipe allows you to combine commands together to control the kind of output you get, usually it's used to refine a command (which is what the command parameters also do). So, when you get really fluent with these commands you can write things that look more like equations but are really efficient ways of using standard commands... pipe will be central to enhancing your efficiency.
This command tells you the time and date as it is set on your computer. Read the help to find out how to set the date and time.
cat displays the contents of files in your terminal window. You must type the name of the file you wish to display after cat. For example if you want to see the contents of the file "README" you would type:
cat README
If that file is too big to have its contents displayed in the terminal you might use it in combination with the less command like this:
cat README | less
The cat utility was originally created for combining text files, a function called concatenation by some, and catenation by those who detest unnecessary syllables.
The top command tells you which operations on your computer are using memory and your cpu. It's really only useful if you wish to see if there is an Activity or command slowing down your computer. The output of top continues running until you press q.
There has been error in communication with Booktype server. Not sure right now where is the problem.
You should refresh this page.