linux for blondes

Commands

Most people are scared of linux because of the archeic image of it as text only and comand line based. Hopefully this website has shown you that linux now has a lot more to offer than just comand lines. However, linux comands are very powerful and once you get started you will soon see how quick and useful these comands are.

If you have never used a terminal or comand line before then check out the starting section. If you're up for something more complicated check out the sections on more complicated commands or the section on bash scripting

Top tip: hold down control and c when things all go wrong to stop whatever crazy comand you started

chmod -- (change access modes)

This changes the permissions on the file/folder to determine who can access it.

$ chmod 755 thisfile.txt

This changes the permissions of thisfile.txt so that it can be read and executed by everyone but only the "user" (you) can change it.

The type of permission can either be written in numbers or letters.

Some useful numbers are:
755 - user reads writes and executse, groups read and write
777 - this is dangerous as it means anyone can do anything to the file

$ chmod -R 755 *

This is a handy comand. It chances the permissions to 755 recursively for everything in that directory ie all the files in that directory and all the files in all the folders in that directory and all the files in all the folders in all the folders in that directory ......

chown -- (change owner)

$ chown fred word.txt
$ chown -R michelle *

Chown is very useful, particularly when you have copied stuff off a cd as root by accident. It chances the "owner" of the files ie who can access them.

The first word is the user who you want to assign access to and the second word (or the star for all files) is the thing you want to let them access.

-R is useful as it does the operation recursively ie to all the files in all the folders in the directories below.

cp -- (copy)

cp copies a file from one location to another.

$ cp mog.gif /images/cat/mog1.gif

This copies the file mog.gif to the folder /cat in the folder /images and makes the name of the copied file mog1.gif

dmesg

Displays what the computer has been up to since the last time you booted eg things like USB divices being connected to it. These messages are "system control messages from the kernel ring buffer" (whatever that is...)

killall

The killall comand stops programs working when they break/crash. I seem to have a nack for crashing things in linux which most other people find virtually impossible. It means I am an excellent software tester!!!

$ killall -9 nameofprogram

The -9 part is useful when the plane old killall comand doesn't work.

locate -- (locate files)

A quick way of finding files/folders on your system.

$ locate memo.txt
$ locate *.doc

lpq -- (lists print queue)

This lists the docuements etc which are lined up to be printed.

$lpq
PSC-2350 is ready
no entries

This shows that there is nothing in the print queue waiting to be printed.

lpr -- (send to printer)

This comand sends things to the printer to be printed.

lprm -- (removes things from print queue)

This is a useful comand which remove things from the queue of things to be printed.

$ lprm -
This is a handy version of the command which allows you to delete all the things in the printer que which are owned by you the user.

ls -- (list)

This lists all the files in the current directory.

mkdir -- (makes directory)

This makes a new directory (or folder)

$ mkdir /home/files

This makes a new folder called files in the folder /home (which already exists!)

mv -- (move)

Moves stuff but also note that this is how to change the name of a file/folder.

$ mv /home/address.txt /addressbook/address01.txt

This moves the file address.txt into the folder /addressbook and also renames it to address01.txt

rm -- (remove)

Removes or deletes files.

$ rm badpicture.jpg

Deletes the file badpicture.jpg

rm -dir -- (removes directory)

Deletes a directory/folder (which must be empty already)

$ rm images

deletes the folder /images

rm -r -- (removes recursively)

This removes a folder AND all its contents.

Do not type this in unless you know what you are doing as you could quite easily delete ALL of the stuff on your hard disc (i speak from rather embarased experience).

This comand is all the more reason to maintain uptodate backups of all your files and very uptodate backups of anything that is important to you. I would strongly recomend this anyway as having decent backups means that you will explore your computer and what you can do with it much more freely as you do not learn anything new without taking a risk.

scp -- (secure copy program)

This alows you to copy files from one location ie your computer to another ie an external server.

$ scp /images/red/redcar.jpg vaxhal.com:images/cars/

This copies the file redcar.jpg from the folder red in the folder images on your computer to the server vaxhal.com and puts it in the folder cars in the folder images.

ssh -- (secure shell)

This connects you to an external server.

$ scp vaxhall.com:images/cars

this connects you to the server vaxhall.com
and into the folder /images and its subfolder /cars
you will probably then be prompted to enter a password

Top tip: remeber that colon in between the server name and the location on the server - it's a killer when you forget it!