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 could try starting with. Don't try and learn all of these at once. Just choose a few and practice them.
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.
Then you are passing the l parameter to the ls command. The l parameter 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:
For the ls command you should get familiar with the formats using ls by itself, as well as ls -al, and ls -l
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 followed by the name of a directory you want to navigate to. If there was a directory called "src" you would type:
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.
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.
/home/olpcExperiment with changing directories with cd then typing pwd to see where you are.
mv me.txt /usr/binNote: 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 /usr/bin/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 you 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".
rm -R directoryname
In this example "directoryname" is the name of the directory you wish to delete. You can also use rmdir for this. Be EXTREMELY careful when using these commands. If used unwisely they could be the end of your operating system.
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. 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.
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:
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 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.