270 likes | 352 Vues
Introduction to Linux W orkshop. 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
E N D
Introduction to Linux Workshop Nick Geoghegan
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. Nick Geoghegan
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. Nick Geoghegan
Logging In Run PuTTY. Click the “Frink” button When prompted fill in your username and password. Nick Geoghegan
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 rootsince it is the start (or root) of all things. /home/users/usernameis your home directory. For simplicity’s sake you refer to it as ‘~’ (tilde button - on the ‘#’ button) Nick Geoghegan
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 that look even vaguely like vowels!) list => ls Nick Geoghegan
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 -lhthis is human readable and tells you the size of the files in MBs and KBs instead of in bytes. Nick Geoghegan
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_htmlmoves you to public_html directory cd ..moves you down one directory, ie. from home/users/username/public_html to home/users/username cdon its own, typed anywhere, moves you back to your home directory, ie. home/users/username Nick Geoghegan
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 filenameand nanowill 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. Nick Geoghegan
File Manipulation You can use touch file1.txtto create a blank file. You can move (mv)and copy (cp)files easily. Use them as follows: mv file1 file2or cp file 1 file2 This moves (or copies) the file1 to the location file2. This location can be another file: mv file1.txt myfile.txt This renames file1.txt as myfile.txt cp file1.txt myfile.txt This creates a copy of file1.txt as myfile.txt Nick Geoghegan
File Manipulation mv file1.txt ~/public_html This moves file1.txt to your public_html directory. cp file1.txt ~/public_html This creates a copy of file1.txt in public_html Nick Geoghegan
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 userm ie. rm file_name To remove a directory use rmdir ie. rmdir mydirectory To remove a directory and all the files in it use rm -r mydirectory(r stands for recursively) Nick Geoghegan
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, cator more ie. less filename Use up and down arrows to scroll. Press q to quit less Nick Geoghegan
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”. Nick Geoghegan
File Permissions Firstly, to make a file in your personal directory private, ie. No one else but you can view or edit the file. Make sure you are in the directory by typing cd Next type chmod 700 filename This gives you access rights of 7 (read, write & execute), and everyone else (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, butnot edit). Nick Geoghegan
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 typingwho, wor finger It’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. Nick Geoghegan
Communication You can write a person a message while they’re online using writeusername 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. Nick Geoghegan
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(manstands 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 qto quit. info filenamecan 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 Nick Geoghegan
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 theserver. The main program people use to check their mail is mutt. mutt is tricky for newbies, but it is one of the best email clients around. I suggest googling for help! There are so many features that I could devote a whole workshop to mutt! Nick Geoghegan
Useful Programs wget Downloads 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 ago! lynx A text-based web browser... irssi A command line irc client Nick Geoghegan
Password & Quit If you wish to change your password then use passwd You 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 exitor logout. Nick Geoghegan
Transfering Files Now that we have an idea about how to manipulate files on the server, we’re going to use a program called WinSCPto transfer files from your computer to the server. WinSCPwill 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 Nick Geoghegan
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 to copy (or you can drag and drop). You can create new directories by pressing F7 once you have click on the appropriate side. Nick Geoghegan
public html Just as a side note, any files you have stored in public_html are accessible 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. Nick Geoghegan
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 Nick Geoghegan
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 to download 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 at number6@compsoc.nuigalway.ieand I'll try to get you sorted Nick Geoghegan