nick geoghegan1 introduction to linux workshop. nick geoghegan2 getting started download the...

27
Nick Geoghegan 1 Introduction to Linux Workshop

Upload: juniper-manning

Post on 26-Dec-2015

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Nick Geoghegan1 Introduction to Linux Workshop. Nick Geoghegan2 Getting Started Download the following files:

Nick Geoghegan 1

Introduction to LinuxWorkshop

Page 2: Nick Geoghegan1 Introduction to Linux Workshop. Nick Geoghegan2 Getting Started Download the following files:

Nick Geoghegan 2

Getting Started

Download the following files:http://www.compsoc.nuigalway.ie/links/downloads/files/putty.exe

http://www.compsoc.nuigalway.ie/links/downloads/files/winscp3.exe Save them to a directory on your U: drive so that the programs will be

accessible no matter what computer you use to login from.

Page 3: Nick Geoghegan1 Introduction to Linux Workshop. Nick Geoghegan2 Getting Started Download the following files:

Nick Geoghegan 3

PuTTY...?

In really simple terms:When you run PuTTY on a Windows machine, and tell it to

connect to (for example) a Unix / Linux machine (like we will!).PuTTY then opens a window and anything you type into that

window is sent straight to the Unix machine, and everything the Unix machine sends back is displayed in the window.

So you can work on the Unix machine as if you were sitting at its console, while actually sitting somewhere else.

Page 4: Nick Geoghegan1 Introduction to Linux Workshop. Nick Geoghegan2 Getting Started Download the following files:

Nick Geoghegan 4

Logging In

Run PuTTY.Click the “Frink”

buttonWhen prompted fill

in yourusername

andpassword.

Page 5: Nick Geoghegan1 Introduction to Linux Workshop. Nick Geoghegan2 Getting Started Download the following files:

Nick Geoghegan 5

Directory Structure

The linux directory structure is very simple once you get used to it,

essentially all files are viewed relative to a single point ‘/’ known as root since it is the start (or root)

of all things./home/users/username is your home directory.

For simplicity’s sake you refer to it as ‘~’(tilde button - on the ‘#’ button)

Page 6: Nick Geoghegan1 Introduction to Linux Workshop. Nick Geoghegan2 Getting Started Download the following files:

Nick Geoghegan 6

Listing Files

To ‘navigate’ through your files we’ll start by listing the files that are in your home directory. So when you are

logged in, from the prompt just type ls(you’ll see as we carry on that most commands are

relatively intuitive, usually just to remove every second letter and sometimes ones thatlook even vaguely like vowels!)

list => ls

Page 7: Nick Geoghegan1 Introduction to Linux Workshop. Nick Geoghegan2 Getting Started Download the following files:

Nick Geoghegan 7

Listing Files

You can find out more information about your files by using: ls -l

this will show you long filenames and the permissions of the files ls -la this will show you all files including hidden

files which won't show up otherwise (they begin with a ‘.’)

ls -lh this is human readable and tells you the size of the files in MBs and KBs instead of in bytes.

Page 8: Nick Geoghegan1 Introduction to Linux Workshop. Nick Geoghegan2 Getting Started Download the following files:

Nick Geoghegan 8

Changing Directory

Linux files are organized into directories (or folders), you’ll usually have several of these inside your home directory and

you can create more as you go along.

Use cd (change directory) to move through these, ie:

cd public_html moves you to public_html directory

cd .. moves you down one directory, ie. fromhome/users/username/public_html to home/users/username

cd on its own, typed anywhere, moves you back to your homedirectory, ie. home/users/username

Page 9: Nick Geoghegan1 Introduction to Linux Workshop. Nick Geoghegan2 Getting Started Download the following files:

Nick Geoghegan 9

Creating / Editing Files

You can create / edit text files easily by using several different programs, like nano, vim, etc. I’ll be introducing

nano . Simply type nano filename and nano will open the file specified if it exists, and if it doesn’t, then it

will create a new file with this name and open it for editing. You can create the file / edit it and use the commands

shown at the bottom to save, etc.ie. ^X Exit - press CTRL and X on the keyboard.

Page 10: Nick Geoghegan1 Introduction to Linux Workshop. Nick Geoghegan2 Getting Started Download the following files:

Nick Geoghegan 10

File Manipulation

You can use touch file1.txt to create a blank

file. You can move (mv) and copy (cp) fileseasily. Use them as follows:

mv file1 file2 or cp file 1 file2This moves (or copies) the file1 to the location file2. This location

can be another file:

mv file1.txt myfile.txtThis renames file1.txt as myfile.txt

cp file1.txt myfile.txtThis creates a copy of file1.txt as myfile.txt

Page 11: Nick Geoghegan1 Introduction to Linux Workshop. Nick Geoghegan2 Getting Started Download the following files:

Nick Geoghegan 11

File Manipulation

mv file1.txt ~/public_htmlThis moves file1.txt to your public_html directory.

cp file1.txt ~/public_htmlThis creates a copy of file1.txt in public_html

Page 12: Nick Geoghegan1 Introduction to Linux Workshop. Nick Geoghegan2 Getting Started Download the following files:

Nick Geoghegan 12

Deleting Files

Once you delete something it is gone. There is no recycle bin! So be sure of what you’re doing!

To delete (remove) individual files use rmie. rm file_name

To remove a directory use rmdirie. rmdir mydirectory

To remove a directory and all the files in it use

rm -r mydirectory (r stands for recursively)

Page 13: Nick Geoghegan1 Introduction to Linux Workshop. Nick Geoghegan2 Getting Started Download the following files:

Nick Geoghegan 13

Creating Directories & Viewing Files

Making a directory couldn’t be simpler.

Simply type mkdir directoryname And you’re done!

To view a file without editing it, just use any of

less, cat or moreie. less filename

Use up and down arrows to scroll.

Press q to quit less

Page 14: Nick Geoghegan1 Introduction to Linux Workshop. Nick Geoghegan2 Getting Started Download the following files:

Nick Geoghegan 14

File Permissions

Most of the time it is important to you that your files are private, and that only you can view them, and then there are other

cases where you would like for other people to be able to view, but not change your files, i.e. for your website.

This is the issue of file permissions.

I will just list the ones you need to use, and you can look up the details on the website under “learning” and “documentation”.

Page 15: Nick Geoghegan1 Introduction to Linux Workshop. Nick Geoghegan2 Getting Started Download the following files:

Nick Geoghegan 15

File Permissions

Firstly, to make a file in your personal directory private, ie. No one elsebut you can view or edit the file. Make sure you are in the directory by

typing cdNext type chmod 700 filename

This gives you access rights of 7 (read, write & execute), and everyoneelse (group & world users) rights of 0 (ie. can do nothing) But say for

example you want to make sure everyone can view your website, then

use chmod 755 -R public_html/This recursively sets the permissions for all files in the public_html

directory to be 7 for you, and 5 for everyone else (read & execute, but not edit).

Page 16: Nick Geoghegan1 Introduction to Linux Workshop. Nick Geoghegan2 Getting Started Download the following files:

Nick Geoghegan 16

Who’s Online

One of the most useful features, is that you can see at any time who else is online,

and what they are doing.

Do this by typing who, w or fingerIt’ll tell you loads of other stuff too, like where they’re logged in from, how long they’ve been

online and how long they’ve been idle (doing nothing) for.

Page 17: Nick Geoghegan1 Introduction to Linux Workshop. Nick Geoghegan2 Getting Started Download the following files:

Nick Geoghegan 17

Communication

You can write a person a message while they’re online using

write username followed by return, then type your message, then press

CTRL + C to exit.Or, even better, you can ‘talk’ to them by typing

talk username and when they do the same, your window splits and you can type in the top section and see what they type in the bottom

section. Again, press CTRL + C to quit.

Page 18: Nick Geoghegan1 Introduction to Linux Workshop. Nick Geoghegan2 Getting Started Download the following files:

Nick Geoghegan 18

Help!

So you want some help?Easy, well it is once you know what to do, if you’re wondering

how to use a command, just type

man command (man stands for manual pages)This can be a little tricky to get used to, but you should be able

to find what you want. Again, press q to quit.

info filename can also be useful Also http://www.google.ie/ can be very very useful!

If you’re looking for a program to do something, eg. A calendar try

apropos calendar

Page 19: Nick Geoghegan1 Introduction to Linux Workshop. Nick Geoghegan2 Getting Started Download the following files:

Nick Geoghegan 19

You’ve Got Mail

You can check your mail from the webmail section of the CompSoc site, but it’s easy and quicker to check it when you are

logged into the server.

The main program people use to check their mail is mutt.mutt is tricky for newbies, but it is one of the best emailclients around. I suggest googling for help! There are so

many features that I could devote a whole workshop to mutt!

Page 20: Nick Geoghegan1 Introduction to Linux Workshop. Nick Geoghegan2 Getting Started Download the following files:

Nick Geoghegan 20

Useful Programs

wgetDownloads files specified to your account.

wget http://www.lotsofstuff.com/file1.jpg will save that exact file to your account, and there are lots of

settings to save multiple pages at a go!

lynxA text-based web browser...

irssiA command line irc client

Page 21: Nick Geoghegan1 Introduction to Linux Workshop. Nick Geoghegan2 Getting Started Download the following files:

Nick Geoghegan 21

Password & Quit

If you wish to change your password then use

passwdYou will be prompted to enter your old password and then to

enter your new password (twice to make sure you don’t make a mistake).

And finally, to get out of PuTTY, you can type exit or logout.

Page 22: Nick Geoghegan1 Introduction to Linux Workshop. Nick Geoghegan2 Getting Started Download the following files:

Nick Geoghegan 22

Transfering Files

Now that we have an idea about how to manipulate files on the

server, we’re going to use a program called WinSCP to transfer files from your computer to the server.

WinSCP will do all basic operations with files, such as copying and moving (to and from a server like we will). It also allows you to

rename files and folders, create new folders, changing the properties of files and folders, and creating symbolic links and

shortcuts

Page 23: Nick Geoghegan1 Introduction to Linux Workshop. Nick Geoghegan2 Getting Started Download the following files:

Nick Geoghegan 23

Page 24: Nick Geoghegan1 Introduction to Linux Workshop. Nick Geoghegan2 Getting Started Download the following files:

Nick Geoghegan 24

Transfering Files

The layout is quite simple:

The left-hand side shows your computer and the files on it.The right-hand side shows your account on rivieria

Transferring files is just a matter of selecting and pressing F5 tocopy (or you can drag and drop).

You can create new directories by pressing F7 once you have click on the appropriate side.

Page 25: Nick Geoghegan1 Introduction to Linux Workshop. Nick Geoghegan2 Getting Started Download the following files:

Nick Geoghegan 25

public html

Just as a side note, any files you have stored in public_html areaccessible to the public, this is where you would upload your

website.

http://www.compsoc.nuigalway.ie/~username/

Sometimes you may have problems viewing some files, this could be because your “permissions” are set incorrectly. We

talked about howto correct this is an earlier section.

Page 26: Nick Geoghegan1 Introduction to Linux Workshop. Nick Geoghegan2 Getting Started Download the following files:

Nick Geoghegan 26

Mailing Lists

CompSoc has several different mailing lists for different purposes:

compsoc-announce - for announcements about events

compsoc-discuss - for all sorts of computer discussion

compsoc-technical - for technical announcements

Page 27: Nick Geoghegan1 Introduction to Linux Workshop. Nick Geoghegan2 Getting Started Download the following files:

Nick Geoghegan 27

Conclusion

Hopefully at this stage you have some idea of the things that you can do on the server.

But, just in case you forget this workshop will be available todownload and view in your own time from the compsoc website,

check under “learning” and “online workshops”.

But if you are having problems then check this file, and then look at the “documentation” or “FAQ” section under “learning”.

If that fails then feel free to email me [email protected] and I'll try to get you sorted