Contents |
Using The Terminal - Basic Guide
Sometimes it may be practical to know how to use the terminal, most likely when following tutorials where you need to use the terminal.
Here is a short guide on how to perform some basic commands on the terminal.
To start a terminal, go the menu and choose the Terminal Emulator
Starting an application, and using the Tab key
To start an application from the terminal, just type the name. Let's start gedit, and use Tab to complete the name.
First, type ged as done below
user@host:~$ ged
Press the Tab key to auto-complete the name. It should now read:
user@host:~$ gedit
Press Enter to start gedit from the terminal. Before continuing, quit gedit.
Installing applications
Installing applications from the terminal is easily done using apt-get. To search for applications, we use apt-cache. Both belong to the same program called apt.
Search for videolan:
user@host:~$ apt-cache search videolan
You should get a long list of packages related to videolan. To install vlc-plugin-jack (will allow you to use vlc with jack):
user@host:~$ sudo apt-get install vlc-plugin-jack
What is sudo?
Sudo is a command that lets' you perform other commands as 'superuser'. Installing programs is not allowed for a normal user. When using sudo, you need to use your user password to allow passing the command that follows it.
More basic commands, and starting scripts
Up and Down Arrow Keys
You already know how to use the Tab key, which saves you a lot of effort when typing. Other helpful keys are the up and down arrow keys. Pressing up will page back in history of the commands you have used. Pressing Down will page forwards.
Download a script
This script is called myscript.sh, and the only thing it does is prints some text when you execute it from the terminal. Download it into your Download folder.
Change to another directory and start the script
Now, if you downloaded the script into your Download folder in your user home directory, you could do following to start it from the terminal.
Try the ls command:
user@host:~$ ls
You should see a list of files and folders in your home directory. To change to the Downloads directory use the cd command:
user@host:~$ cd Downloads
Notice that the prompt looks different now:
user@host:~/Downloads$
Now, you could do ls again to see what is in the Downloads directory. And to start the script, you do:
user@host:~/Downloads$ ./myscript.sh
If you aren't able to start the script, it may be that it isn't set to be executable. To make the script executable, do:
user@host:~/Downloads$ chmod +x myscript.sh
And then, try again.
Finally, to get back to your home directory you can do:
user@host:~/Downloads$ cd ../
Also, just using cd without an argument will get you back to your home directory.
How to find help about different commands
Each command usually has one or two help sections. To see a shorter help section for the ls command, do:
user@host:~ ls --help
To get the more extensive manual, do:
user@host:~ man ls
To quit the manual, press q.
That's all for this short guide. Hopefully you have learned enough about using the command line to know how to follow simple tutorials and guides that involve the terminal.
More Information
More detailed info on using the terminal