Linux shell howto

From Fab Lab Wiki - by NMÍ Kvikan
Jump to: navigation, search

What is shell?

There are several types of shells, but we will concentrate on the "Bourne Again SHell" -or BASH for short. If you are wondering whether or nor you are using BASH, look for the "$" in you command line. Mine says "ivan@ivan-laptop:~$" meaning I'm the user "ivan" at "ivan-laptop". The tilde "~" indicates I'm in my "home" folder, and the "$" assures me I'm using BASH.

You can issue commands from the shell to navigate through, and manipulate both files an devices on your computer. The shell is quite powerful and will do what you ask, careful not to ask anything too stupid.


An example

An example of using BASH for problem solving: I try to flash a chip with avrdude, but it gives me the "Permission denied" error message for "/dev/parport0". The easiest way to solve this is to grant everyone full access to parport0 using the chmod command. The syntax for chmod is "chmod [rights] [file or device]". We substitute the [rights] with "777" meaning full access for all, and for [file or device] we put "/dev/parport0". The command will be "chmod 777 /dev/parport0", without the "".

In order to give ourselves privileges we need to issue the command as a superuser. This is easily achieved using "sudo" in front of our command in the shell. What we end up typing into the shell then is "sudo chmod 777 /dev/parport0", we'll be asked for our password, et voila.


More commands

A good list of commands for BASH can be found here.