Home

An Introduction to Linux

image

Contents

1. or in mnt It makes no difference to Linux making it a very flexible and scalable OS THE COMMAND LINE INTERFACE CLI The Command Line Interface is the most important interface to learn for Linux Linux users will often be asked to perform commands through the use of the CLI and not through a GUI As many of the ISG courses require the use of a CLI it is important that you are comfortable with working with it To this end we will work through all of the following exercises using the CLI and not the GUI However all of the following can be accomplished through the GUI Running the same commands on the CLI will give you a better understanding of how Linux works behind the scenes and allow you to appreciate the complexities of the system IMPORTANT The following practical exercises have been written with the user msai135 as an example When attempting the following commands for yourself please substitute msai135 for your own username which has been pre issued to you by Royal Holloway University This username should consist of four letters and three numbers NAVIGATING THE FILE SYSTEM First we need to learn how to move around the Linux file system At this point you should already have logged into the Linux Environment using PuTTY Once you have logged in the directory you start in is your home directory Each user is given their own local home directory which is independent trom everyone else s
2. Details Columns MJ Preview trash desktop lt ee m gt server gt svnserver gt estilo gt 43 Split play ever To v lt christi ov k Subject Message Edit View Options Attach Tools Settings Help you world kde s Places network A B root Y trash 6 search KDE 4 3 is out KMail Queue Attach lt Cut v KDE 4 3 is out ot _ Copy r Paste V Sign a Disk Space r s home 55 Z 8iB lI D k TTT TT Ta Shana E Bree Encrypt Select Midnight_in_Karelial1 jpg 1 Folder 3 Files 5 3 MiB EKDE 4 3 is out KMail KDE is happy to announce version 4 3 of its desktop Spellcheck on Column 53 Line 1 E lt ts OL 48 29 i WHAT IS LINUX USED FOR TODAY Today Linux has found a home on smartphones Android Meego Moblin Maemo Zaurus Network Appliances NAS Firewall Load Balancing TVs Laptops Netbooks Desktops Servers Games Consoles Linux is usable in every area that Microsoft Windows is and many more Some noteworthy products using Linux today NETGEAR e Android phones Manufactured by HTC Sony Motorola Samsung Acer amp more e Netgear ReadyNAS Series e Synology DiskStation NAS series e Nokia Meego smartphones Runs Meego originally based on Debian BusyBox e TiVo DVR America s most popular Digital Video Recording al
3. LINUX AN INTRODUCTION TO LINUX BY TRISTAN FINDLEY ROYAL HOLLOWAY UNIVERSITY OF LONDON BEFORE WE BEGIN COMMANDS All commands in the following guide are highlighted inside grey boxes with the command as it should be typed in the left and the description on the right All commands are case sensitive and are dependent on having the correct number of spaces characters Please be sure to copy it exactly Ping the IP Address 10 203 1 5 ping c 5 n 10 203 1 5 for a count of 5 c 5 outputting l _ numerical values only n SPECIAL CHARACTERS Be aware of special characters and don t get them confused with standard letters this is the Pipe character used to pipe output from one command into another To type Pipe use Shift located on the left side of the keyboard next to the shift key Example Command man k directory grep ls USERNAMES Throughout this document the username msai135 is refered to as a sample account When you are working through this document you should use your username in place of msai135 BEYOND THIS WORKBOOK There is more included in this worksheet than you can accomplish in the session time allotted This is so you can continue your study of Linux outside of the session using this workbook as your starting point Even if you do not have access to a Linux environment to work with you should still be able to read through and gain knowledge and understandin
4. amp Microsoft Windows Redhat Redhat is known for it s RPM Redhat installation system and for their Package Manager l goal to provide a stable supported and viable alternative to Microsoft Server operating systems Offering paid for support packages with its operating systems Redhat makes for an attractive desktop and server platform for business Redhat was originally available for free with support packages being an optional extra for those that required it but has now become a pay for only product Redhat are allowed to continue this practice as long as un compiled source code remains freely available Today Redhat finds its home in various businesses education establishments and government facilities Two major forks sprang from this restriction on the availability of Redhat CentOS focusing on creating a free EY x Redhat based OS to MAS use on dedicated server hardware When Redhat became a pay for product CentOS became a very popular OS among the desktop Redhat community Fedora Redhat Desktop based OS designed to run on all desktop and mobile machines Upon the move to a pay for scheme many Redhat users moved to Fedora allowing them to retain their familiarity with the OS and the support for their pre written configuration files and installation files Other Distributions There are lots and lots of Linux distributions out there The
5. the list Type q at any time to return to the command prompt Piping output from one command into another is a very useful way of working at the command prompt It can allow you to output the results of a command into a file or even allow you to search through the output for a specific string Let s try looking for the same man pages again but this time we will redirect the output to the Linux search system grep and search for a specific line of text clear Clear all previous output This pipes the output from the man k command into grep In this instance man k directory grep ls we have told grep to search for the String ls NOTE Pipe Cl ls not a capital 1 As you can see now only a few results are displayed Only the results from man k directory containing that search string ls are displayed and the lines not meeting the search criteria are discarded Grep can be useful when searching through a long list of files folders for one specific entry or when working with any large amounts of data In this case we simply used it to filter search results Using the command man k directory grep lt keyword gt try searching for some other keywords replacing lt keyword gt with the word of your choice For example run NT ACL In NEED MORE HELP If at any point you require more help than the man pages can provide there are a number of other resources One of these resources
6. LT 6 LT 6 9T 80 cL 6 9T ajy sejna ed e JO SEY s uo I A JEU suoSIWJ g SUOISSIWJad 13470 ally JE NIed e 10J sey dno18 paljigads e eyy SUOISSILWJad ayq SUOISSILUJag Gnol5 all JE NIed e J04 sey Jasn palisads u1 JEU SUOISSILUJad Sy SUOISSILWWJadg sasn 8T 60 600 0 TO L00 8T 60 600 e 80 60 TTO SO L0 900 e SO L0 900 S0O L0 900 80 60 TTO l 60 TT0e 80 60 TTO w pue ajep uOe pow 9605 SIEN ee E Z IZ IENID 9605 sz sn ureuoq s TTesur X IX IXMIP 9605 sz sn urwuoq s ITesu Z 960 sz sn UTLUWOQ SETTESU Z LZZZ sa sn urwuoq sgITesu I 1 1 M1 FTP Sz sn urwuoq s ITesur T 1 1 M1 OZZ SI SN urwuoqlscITesu T z 2 mz LZ sz sn urweuoqsc TITesur T Oo 2001 4001 f 9605 SIEN UTeMOg seTTeSM 9 98 TU101 ET ET uanaesgsettesu ias a sn a SUOISSIWUId ZzIS J UMO J 4yio dnoiD sasn SsuUoISSIWJ d SUOISSIWJ d SUOISSIWJ3q PUBLULUOS Bl Si 94 JO INdjNO 31M peal J aama io133uiq B und isnt puewwo ul 26 SETTING PERMISSIONS Permissions can be set on a file or folder using two simple methods The two methods available are The Binary Method and The Symbolic Method Choose the one that is easiest for you USING THE BINARY METHOD Through the binary method each permission is assigned a binary value and added together to give a thre
7. Print the current Working Directory You can also move deeper into the file system using relative paths cd pwd Ls First return to your home directory Print the current working directory to check out location This will print display on screen a list of files and folders stored in the current working directory In this instance we re printing the contents of your Home Directory You will see a list of folders and files appear This is the current contents of your home directory We are going to move into the directory Desktop using a relative path cd Desktop pwd This changes the current working directory to Desktop which is located in your current working directory IMPORTANT ALL Commands are Case Sensitive Print the current working directory to check out Location Now we will return to your home directory and use commands to move around using relative and absolute paths IMPORTANT In the following list of commands replace lt your home directory path gt with the path to your home directory that you wrote down on Page 16 cd pwd cd lt your home directory path gt pwd cd pwd cd Desktop pwd cq pwd Changes Directory to your home directory donated by Print the current working directory You should be in home msail35 where msai135 ls your own username Changes directory using an absolute path the denotes the root of the filing
8. THIS SYSTEM si WA j E as 2 i l wa im p TEMPORARY FILES F MEE MULTI JUSER UTILITIES AND APPLICATIONS IUST TECONDART WIFRARCHY REQUIRED BIREETORIED BIN INWCLEO DE CIR COAL FRIN SHARE Var VARIABLE FILES u root HOME DIRECTORY FOR THE ROOT USER proc VIRTUAL FILESYSTEM DOCUMENTING KERNEL AND PROCESS STATUS AS TEXT FILES CINDE ORG The folder you operate in 95 of the time is which usually equates to home lt username gt See previous page for notes on the location of your home directory and how to find it e g home msai135 Even devices exist as files within a Unix system They are located in dev If you insert a CD the drive will be mounted to media cdrom Some systems do this automatically however sometimes this needs to be done manually An example command to run to do this would be mount dev sdb1 media cdrom This would allow you to access the CD ROM by browsing media cdrom Before ejecting the disk you would exit from the mounted directory then run umount media cdrom and then eject the disk from the computer Some systems will respond to the command eject for CD ROMs automatically unmounting and ejecting the drive in one command USB Sticks Memory Cards and Hard Disks are all mounted in the same way having a corresponding dev lt tilename gt file and a location to mount it to This could be in home lt username gt Storage
9. connection to a Linux server Please refer to the guide Connecting to the ISG Linux Terminal Server Saturn guide as issued by the Information Security Group Establish a connection to Saturn saturn isg rhul ac uk using PuTTY as detailed in the guide IMPORTANT During password entry you will not see any characters e g appear this is normal behaviour for Linux Passwords are Case Sensitive INTRODUCTION TO THE COMMAND LINE INTERFACE Once you have successfully logged in you will be presented with the Command Line Interface also known as the Command Prompt The prompt should read lt username gt lt computer gt lt path gt so for example msail35 Lab t1L243 QQ08 home msai135 The anatomy of a command line interface is as follows Command Prompt with information lt lt lt lt lt gt gt gt gt gt Command entry msaii35 lab t1243 008 home msaii35 pico O etc ssh sshd conf Current Working A Directory Command Option username Privilage Identifier Pnvilaged Use Current machine the user is logged onto Target path and file of the command Root User eine run i IF YOU GET LOST The Tilde icon is used to represent your home directory If you ever need to get back home you can type the following to return to your home directory cd The parameter can be passed in a string of commands as you will see further on to directly access the Home di
10. find out how to interpret the output If you re not sure what manual page you want to see you can use the k option man k lt keyword gt Replace lt keyword gt with your search term Once you have found your desired man page you can go ahead and open it Like before man lt resuLlt gt Replace lt result gt with the desired result from your previous search This will open the man page Sometimes k will give you a surprisingly long list of results So long that it will scroll off the screen You can scroll back up the screen by using Shift Page Up amp Shift Page Down Another method of reading all the results is to pipe l the results into less Try the following commands clear This will clear the visible terminal of all previous output You can still return to the previous screen by using Shift Page Up Page Down to scroll back through the terminal man k directory This will search for a keyword that displays lots of results By piping this output to another l command we can filter these results man k directory Less Use the character to try piping hte output into less see what happens With the less pipe invoked the output from the man k directory part of the command gets piped into less which then displays it on the screen You will notice that at the end of the list there is a blank line with displayed You can now use the return or spacebar key to move down through
11. system Print the current Working Directory to confirm your current Location Return to your home directory Print the current Working Directory to confirm your current Location Change Directory to your Desktop folder which is absolute to the root of the system Print the current working directory to confirm your current Location The tells the system to navigate up exactly one level relative to your current working directory Print the current working directory to confirm your current Location As you can see you can chain different folders together to move between many levels in a single command The command you ran was cd The part of this is the path that you are moving to This is what is known as a relative path as you moved up one level to home relative to your starting position from home msai135 WORKING WITH FILES First create a directory i e folder for today s session move to it and verify where you are eto Change directory to your home directory mkdir unixintro Make directory unixintro cd unixintro Change directory to unixintro Now copy some files to it and get a directory listing Be careful with your typing and don t ignore error messages cp usr share unixintro Copy all the files in a directory to the current working directory Asterisk means all files Dot means current working directory IMPORTANT There 1S a
12. the world This massive world wide development effort is largely uncoordinated Sure Linus calls the shots where the kernel is concerned but Linux is more than just the kernel There s no management infrastructure a student in Russia gets a new motherboard and writes a driver to support a neat feature the motherboard has A system administrator in Maryland needs backup software writes it and gives it away to anyone that needs it The right things just seem to happen at the right time 1969 1971 to 1973 1974 to 1975 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 to 2004 2005 2006 to 2007 2008 2009 2010 2011 2012 to 2013 Unnamed PDP 7 operating A BRIEF HISTORY OF LINUX ea BSD 1 0 to 2 0 Unix Version 7 BSD 3 0 to 4 1 O Unix Version 8 Unix 9 and 10 last versions from Bell Labs BSD 4 3 Linux 0 0 1 BSD NET 2 NEXTSTEP OPENSTEP 386BSD 1 0 to 4 0 NetBSD 4 4 to FreeBSD 4 4 lite2 Laelia 22X NetBSD 14 41 Linux 0 95 t0 12X NetBSD 1 3 FreeBSD STONO 2 Mac OS X Server Linux 2 0 to 2 6 x FreeBSD NetBSD 16 Ce oe UEH Mac OS X 10 0 to 10 9 x Darwin system Open Source Mixed Shared Source Closed Source PWB Unix Unix 32V i Xeni
13. toolkit oo gt 9 0 0200 HHL Emcee eae Gem Gene fame Gos Coe IA Eo o NESE SETS EES fly Computer ACD Foust ARER 3 REIH amp GAMES filozil F x Wl S ey RE 2 31 4 Hatem D mc icewm mc J aterm Root cz lin Past LAA i 21 52 11 CDE A BLAST FROM THE PAST OTHERS CDE Common Desktop Environment is a commercial Graphical User Interface e FluxBox for UNIX and various other flavors which was jointly developed by Hewlett Packard IBM Novell and Sun Microsystems The Window Manager for CDE is BlackBox dtwm pictured right pEm T e Sawfish A File Edit Search Navigate File Selected View Help A volume Introducing the Desktop _x _xJ _xJ _x _ Introducing the Desktop fecktiank Z h 5 Sic ee eee LXDE Getting Help Index u G cs ya Top Level EDE ktop e JD4X Choose one of the following topics Basic Desktop Skills The Desktop at a Glance How to Get Help e AfterStep 68 Items 45 Hidden To Choose a Help Topi mA With your mouse 2 i en s Move your mouse to place the pointer over the _ e M eta C ty N underlined topic you want to view then press and A release mouse button 1 app defaults include appres java pics xcess public_html xpm ipts KUSA be in lib scrip lt Press Tab and the ar
14. ubuntu com burnt to a CD then installed onto a computer Of course the Teaching CIM Server will always be available While you won t be able to install your own software you are tree to explore the system and try out commands You will not be able to cause any damage to the system so don t be afraid of breaking things Just make sure you ve backed up your own documents first just in case Introduction to Linux by Tristan Findley Updated September 2015 ROYAL HOLLOWAY ee RIM UNIVERSITY Copyright Royal Holloway University 2015 See OF LONDON
15. working directory Make a note of the original permissions for phonebook you will need to restore them Read the contents of the file phonebook Change permissions of phonebook Now try to read the file phonebook What happened Now restore the original permissions and try again CHANGING OWNER AND GROUP WARNING DO NOT ATTEMPT THIS If you change the permissions of your own files you will not be able to recover them In order to change the owner and group of a file the commands chown and chgrp are used To change the owner and group simultaneously one can simply issue the chown command specifying a group after the username separated by a colon If we attempt to change the ownership of a file to something other than ourselves then we could potentially lose the ability to manage it delete move rename etc rw r r msai135 Domain Users echo java rw r r msai135 Domain Users hello c rw r r msai135 Domain Users phonebook Command chown root hello c chgrp Domain Admins echo java chown www data www data phonebook Effect Change owner of file Change group of file echo java from Change the owner and group of file hello c from msai135 to Domain Users to Domain Admins Not the phonebook to be www data Note that this root speech marks allowing you to use spaces in command has simultaneously changed the user the
16. First you need to take note of your home directory as this is different for every user pwd or print working directory 1s a useful command to check the full path of where you are currently located within the Linux File System pwd This can save you from getting lost or as a confirmation that you are working in the correct directory My Home directory is 22 Your home directory cannot be accessed by others and nothing that you do within this directory can have a system wide effect You are safe to explore without fear of breaking something IMPORTANT Your Home Directory at Royal Holloway may be different to that on a standard Linux Machine Normally your home path would be home lt username gt but because the Royal Holloway utilise Network Storage your home path could be something like nas ganymede home msc lt username gt Now we will move to the root directory and then run a command to list all directories inside of it cd pwd cd pwd Changes Directory to your home directory donated by Print the current working directory You should be in nas ganymede home msc msa1135 where msai135 is your own username The command cd stands for change directory This 1S used to move to different directories and can be used with absolute or relative paths tells the system to navigate to the root directory of the filing system irrespective of your current working directory
17. Get help this provides information on navigating through files and common keyboard commands USEFUL COMMANDS TO RESEARCH AND TRY ssh Secure Shell used to remote control a system via the command prompt scp Secure Copy used to transfer files between computers over SSH cat Concatenate used to print a view the contents of a file chmod Change file mode bits used to change permissions of a file for user group amp other chown Change Owner used to change the user ownership of a file chgrp Change Group used to change the group ownership of a file gzip Gunzip file compression decompression command for the gz format tar file compression decompression command for the tar format sudo command to gain root access to a system useful when combine with su e g sudo su lynx console based web browser alpine pine an email client nano text editor See previous pages for a brief How to vim advanced text editor not for the faint hearted try the command vimtutor ping Sends ICMP ECHO_REQUEST to network hosts to determine their connectivity status nc netcat used to listen send TCP amp UDP packets nmap Network Mapper Tool for network exploration amp Security auditing Very involved telnet basic unencrypted method of controlling a system Usetul for interrogating ports SOME S
18. IMPLE PROJECTS TO ATTEMPT Bash Scripting Building a Fileserver using SMB Samba CIFS Building a Router using IP Tables Tip IP Masquerade How to Building a Webserver using a LAMP platform Linux Apache MySOL PHP USEFUL LINKS http tldp org The Linux Documentation Project Number one go to place for How to guides and FAQ s htto www tuxtiles org linuxhelp shell htm TuxFiles Linux Help The Shell Terminology htto www freesoftwaremagazine com articles command_line_intro Free Software Magazine Beginners Introduction to the GNU Linux Command Line htto www unixguide net linux linuxshortcuts shtm Linux Newbie Guide Shortcuts amp Commands http dsl org cookbook cookbook_5 html The Linux Cookbook Chapter 5 The Shell OTHER THINGS TO TRY A great way of learning Linux is to install it onto one of your own computers This could be a desktop or a laptop If you are unfamiliar with Linux we would not recommend attempting this on your main computer but in a Virtual Machine available for free with Virtual Box httos www virtualbox org or on older equipment that you may own If you make a mistake during the installation on your main computer you could erase your data and or operating system from your computer not something you want if you ve only got one computer to use We recommend and support OpenSUSE and Ubuntu Linux These can be downloaded from www opensuse org and www
19. best way to find out about each and every distro is to visit the homepages for each one and read up on their features and benefits The important thing to remember is that all Linux distributions are more or less the same underneath The commands you will learn in this introduction can be used with any of the above distros with the same affect Some distros have proprietary commands that only work in that distro such as rom and dpkg etc however these are clearly documented by the creators With so many distros the trick is to find the one that works for you and stick with it Here in the ISG we recommend Ubuntu for Desktops and Debian for servers however the reasoning behind your choice of OS will be different from ours Linux gives you freedom by giving you choice DIFFERENT LINUX DESKTOP INTERFACES There are two primary desktop interfaces in the Linux world that you are likely to encounter GNOME and KDE These are known as Window Managers Below the Window Manager sits the actual desktop environment X11 The Window Managers give the Desktop Interface its look and feel Like with the different Linux Distributions whichever Desktop interface you choose is dependent on which you prefer and which one fits your specific purpose XFCE XFce is a lightweight desktop environment for UNIX AREA 1 WORK SPACE platforms It is similar to the commercial CDE and is now based on the GTK
20. e digit number one digit for each party user group other The end result will be something along the lines of chmod 755 test sh which assigns the permissions of User Read Write Execute Group Read Execute Other Read Execute The binary values for each permission are Execute 1 Write 2 Read 4 If you wanted to assign a party read and write only permissions then it would be a total of 6 while a party with permissions of read only would be 4 E g To change a file called ohonebook located in the same folder you are currently inside to User RWX Group RX Other R as above you would therefore run the command chmod 754 phonebook Lets try this now cd un1ixintro pwd Ls Lla cat phonebook chmod 044 phonebook cat phonebook ugo 754 access rwx rwx rw 421 421 42 1 1 1 101 1 0 x x x A N A A x y gn A Changes Directory to unixintro located inside your home directory Print the current working directory and check it s correct List the contents of the working directory Make a note of the original permissions for phonebook you WLLL need to restore them Read the contents of the file phonebook Change permissions of phonebook Now try to read the file phonebook What happened Now restore the original permissions and try again O e x iS USING THE SYMBOLIC METHOD Using the Symbolic Method you can set
21. emember if you use spaces in a command you must encapsulate that section of the command in speech marks as per the example Now cat the file What do you notice The words Hello World have now vanished and been replaced with the text you inputted This is not very useful if we want to append ada text to the file This time run the command again with different text but instead of a single gt use two gt gt Now cat the file again This time you should see that the text was added to the bottom of the file Play around with the echo command and use the man pages to find out more about it PERMISSIONS AND OWNERSHIP WARNING Please read through this entire section BEFORE attempting it Altering the permissions of the contents of your home directory could remove access for yourself meaning that a Systems Administrator has to come along and fix them Permissions in Microsoft Windows are a little easier to understand and configure than those in Linux In Windows you simply right click on a file or folder and specify the username and what permissions you would like for it The bonus with this is that you can have as many different permissions for as many different groups or individual users that you want this is achievable in Linux through the use of ACL s although this is much more advanced In Linux things are generally a little more restrictive A file or folder only has three
22. g from the examples in this workbook CONTENTS What is Linux A brief History of Linux Different Linux Distributions Different Linux Desktop Interfaces What is Linux used for today Before we get started Accessing the Linux Command Prompt Introduction to the Command Line Interface The Linux Filesystem The Command Line Interface CLI Executing Commands Improving your productivity in the CLI Getting Help and Searching Creating Files Permissions and Ownership Setting Permissions Editing Files Nano Quick Reference Useful commands to research and try Other things to try 10 10 12 13 14 14 15 16 20 21 ZZ 24 25 27 30 J2 So 4 WHAT IS LINUX Linux is an operating system much like Microsoft Windows or Apple Mac OS Unlike other mainstream Operating Systems Linux is made freely available and is Open Source A VERY BRIEF HISTORY OF LINUX Back in August of 1991 a student from Finland began a post to the comp os minix newsgroup with the words Hello everybody out there using minix I m doing a free operating system Just a hobby won t be big and professional like gnu for 386 486 AT clones The student was Linus Torvalds and the hobby he spoke of eventually became what we know today as Linux A full featured POSIX like Portable Operating System Interface Unix operating system Linux has been developed not just by Linus but by hundreds of programmers around
23. group name and group Changing permissions on files can be problematic if you do not have super user admin root access to the system you are working on and will generally result in a rather annoyed Systems Administrator having to fix permissions on the changed files EDITING FILES NANO FORMERLY PICO echo is a very useful command if we want to add text to a file however it cannot be used to modify an existing file For this we have to use a text editor The two standard text editors in Linux are vim and pico now known as nano vim also known as vi vee eye is a rather hardcore text editor which is remarkably non user friendly It is the preferred text editor by the highly experienced of console users however it is very complicated to learn Feel free to read up on vim in your own time by looking at its man page and looking online for help For today we will learn to use pico to modify the contents of a file Pico is very much like Notepad but without a mouse All commands are executed through the use of the keyboard using the lt CTRL gt key modifier It can be used to edit virtually any kind of text file from the command line and is frequently used to configure services after they have been installed Cur Pos To Spell ma Cut Text W Where Is oe UnCut Text a Read File is Prev Pace m Next Page This is a standard blank Pico window as you will see
24. if you run the command pico from the command prompt At the bottom of the screen there are commands with a symbol in front These are the commands that can be used The shows that you need to hold down the Control Ctrl key and then press the corresponding letter of the command you wish to use For Example Ctrl X will exit Pico and return you to the Command Line NANO QUICK REFERENCE Ctrl X Exit the editor If you ve edited text without saving you ll be prompted as to whether you really want to exit Ctrl O Write output the current contents of the text buffer to a file A filename prompt will appear press Ctrl T to open the file navigator shown above Ctrl R Read a text file into the current editing session At the filename prompt hit Ctrl T for the file navigator Ctrl K Cut a line into the clipboard You can press this repeatedly to copy multiple lines which are then stored as one chunk Ctrl J Justify fill out a paragraph of text By default this reflows text to match the width of the editing window Ctrl U Uncut text or rather paste it from the clipboard Note that after a Justify operation this turns into unjustify Ctrl T Check spelling Ctrl W Find a word or phrase At the prompt use the cursor keys to go through previous search terms or hit Ctrl R to move into replace mode Alternatively you can hit Ctrl T to go to a specific line Ctrl C Show current line number and file information Ctrl G
25. is TLDP The Linux Documentation Project Not only does this contain a copy of all the man pages but there are Howto guides and FAQs on various Linux related subjects Take a look at htto www tldp org in your own time By far the best source of information for Linux is Google If you are ever stuck try Googling for the solution You will always feel a greater sense of accomplishment if you solve a problem yourself Never underestimate forums or newsgroups While a solution may not immediately be apparent especially from the first few posts the users that have posted will normally work toward a solution and the forum is a very good way of finding out what has worked and not worked previously When Googling remember to put exactly what you re looking for It is recommended that you put your linux distro into the search string as some problems and solutions may be distro specific Another key word to use is howto If you are looking for a guide this can provide the best results Try it by Googling for linux dhcp howto in your free time and take a look at the results After and only after you have exhausted ALL other avenues for help ask someone People are more willing to help if you have tried to solve things yourself REMEMBER Always try to help yourself first by researching the problem CREATING FILES Please note To complete this exercise you must have completed the previous exercises and have a di
26. permissions exactly like you do using the Binary method The only difference is you use a verbose way of setting the permissions instead of a mathematical way To do set the same permissions as in the Binary Method example we would use the commands chmod u rwx g rx o r test sh You can work out how to build the command up each time using a very simple table Note that in the example above we have used commas to separate each permissions for each party Which party u user g group What to do add this permission remove this permission o other set exactly this permission X execute Which permissions read write is g Some other examples of chmod using the Symbolic method are as follows rw r r msai135 Domain Users rw r r msai135 Domain Users rw r r msai135 Domain Users echo java hello c phonebook Before rw r r echo java Command chmod o rw echo java After rw r rw echo java rw r r searchfor c chmod g searchfor c rw r searchfor c rw r r phonebook chmod og rwx phonebook rw rwxrwx phonebook Lets try this using the same example as in the binary method cd un1ixintro pwd Ls Lla cat phonebook chmod u g r o r phonebook cat phonebook Changes Directory to unixintro located inside your home directory Print the current working directory and check it s correct List the contents of the
27. re usually run from the command line Most people today will be brought up with computers only knowing how to use a WIMP Window Icon Menu Pointer interface People rarely understand how to interact with the computer when we take away the mouse and limit them to a Command Line Interface This guide has been written to help eliminate at least some of the confusion associated with text based interfaces As part of your grounding in the world of Information Security you will increasingly be expected to interact with systems in a more direct way SOME BRIEF WARNINGS e The command line interface is case sensitive It does understand the difference between i a lower case t and an upper case T Check what you re typing as one wrong character can cause a lot of problems e Unlike in Windows Linux has no magic Undo command and no safety net that is the Recycle Bin Anything that you execute run in the command prompt would need to be fixed manually Double Check EVERY command that you type to make sure it is correct The command line is a very powerful tool and it requires a little more finesse and learning than the GUI Graphic User Interface REMEMBER If you delete something it is gone Check everything BEFORE you press enter IMPORTANT EVERYTHING in Linux is Case Sensitive This is important when typing commands ACCESSING THE LINUX COMMAND PROMPT To begin working through this guide you will need to establish a
28. rectory called unixintro in your home directory cd pwd touch unixintro sample txt cd unixintro Ls Lla Changes Directory to your home directory donated by Print the current working directory You should be in home msail35 where msa1135 1S your own username Create a Text file in hte folder unixintro called sample txt Change your Working Directory to unixintro List the contents of the working directory What does la do Write the text Hello World to the echo Hello World gt sample txt fle you created sample txt Concatenate read the file sample txt cat will print the contents cat sample txt In this exercise we created a new file called sample txt and then wrote the text Hello World to it This was done using the command echo echo will print whatever text you feed into it Try it now on the command line by typing echo Hello everyone This will print Hello everyone on the command line To write this text to a file we redirected the output using the gt option This redirected the example text Hello World into the file called sample txt Once we did this we then read the contents of the file by using the cat command short for concatenate Try running the command again but this time replace Hello World with some text of your own Make sure to write to the file sample txt R
29. rectory when you are in other parts of the system On most systems your home directory should be home lt username gt however on some centrally managed or network systems your home path could be different Run cd to change directory to your home directory then pwd to find the full path of your home directory THE LINUX FILESYSTEM The linux File System is different to that of Windows in that the File System is not represented by Hard Drives and CD Drives like c amp d etc Instead the whole system is represented by the root directory or Files folders and drives all exist within this Within exists a standard core directory structure ibin ESSENTIAL USER COMMAND BINARIES Iboot STATIC FILES OF THE BOOT LOADER a evli DEVICE FILES La AOST SPECIF G SYSTEM CONFIGURATION etc PROVED BARRE TORES OFT Fil SEAL DE F i AE USER HOME DIRECTORIES JI F i Nib ESSENTIAL SHARED LIBRARIES iii II lID AND KERNEL MODULES ROOT DIRECTORY WPA OF THE ENTIRE FILE SYSTEM E HIERARCHY St i k i s med iq MOUNT POINT FOR REMOVABLE MEDIA MOUNT POINT FOR A TEMPORARILY MOUNTED FILESYSTEMS mnt opt ADD ON APPLICATION SOFTWARE PACKAGES FILESYSTEM HIERARCHY STANDARD FHS Ws PRIMARY WTRARCAY AN 3 is D Tall SYSTEM BINARIES E WS WO F r A TA FOR SERVICES W N SI V PROVIDED BY
30. row keys up down left and bitmaps man sre S m right to move the highlight to the underlined topic you games perl tmp gt want to view then press Return iw z pie e MWM T n GNOME GNOME is the default Window Manager for Redhat and Ubuntu and the one that you will be using on the Linux Terminal Server The GNOME pronounced Gah NOME project s aim is to build a complete user friendly desktop based entirely on free software It is not a window manager and in fact has to be run in conjunction with a window manager GNOME has advanced rapidly and is now very popular particularly on the Linux platform Q Type to search SE 4 lt q te K T CU s gt N Poan I lt 2 s h EI wq 2 gt y wr lt A SMS f KDE Rien v Mon 12 16 a i k gt Ear Make 3 aniano aye We L TNS oe cS y blender org Home of the Blender project Free and Open 3D Creation Software KDE is a modern network transparent desktop environment which uses the Ot cross platform GUI toolkit It contains a base set of applications such as a window manager called kwm web browser instant messenger and integrated help system all with a consistent look and feel and translations for over 50 languages Desktop d pea w we a W T documents images personal video presentation odp SKO aA Fie Edit View Go Tools Settings Help lt Back g gt Forward 222 Icons
31. sail35 ping c 5 n 10 203 1 5 PING 10 203 1 5 10 203 1 5 56 data bytes 64 bytes from 10 203 1 5 i1cmp_seq ttl 63 time 0 536 ms 64 bytes from 10 203 1 5 icmp_seq 1 ttl 63 time 562 ms 64 bytes from 10 203 1 5 icmp_seq 2 ttl 63 time 0 645 ms 64 bytes from 10 203 1 5 icmp_seq 3 ttl 63 time 0 668 ms 64 bytes from 10 203 1 5 i1cmp_seq 4 ttl 63 time 0 640 ms 10 203 1 5 ping statistics 5 packets transmitted 5 packets received 0 0 packet Loss round trip min avg max stddev 536 0 610 0 668 0 052 ms tundra msai135 IMPROVING YOUR PRODUCTIVITY IN THE CLI Working within the confines of the Command Line Interface can sometimes be frustrating The lack of a copy paste menu on the right click of the mouse can be a major headache when it comes to repeating commands TAB TO COMPLETE If you begin typing a command or path in the CLI you can auto complete this by pressing the tab key For example if you want to navigate to etc samba you can just type et and then hit tab which will auto complete it to etc You can then append sam and hit tab and it will auto complete to etc samba This is incredibly useful when accomplishing tasks quickly If the command does not complete after a single tab press it again and the system will display a list of options that matches what you have entered so far EDITING A COMMAND You can use the Left back and Right forward arro
32. so used by Virgin Media e Linksys WRT54G Routers The most popular router for home modders e Sony BRAVIA TVs e Samsung TVs Most models e Panasonic Viera TVs New models such as the G20 now use FreeBSD e Archos tablets media players e GP2X Handheld Games Consoles e Pleo Animatronic dinosaur robot toy BEFORE WE GET STARTED WHY THE COMMAND PROMPT Why would we use a command prompt over the Graphic User Interface that we all know and love The reason is simple Control A command prompt gives us greater control and flexibility over the system or software we are creating We have no way of knowing if configuring a service using a graphical user interface is doing exactly what we want it to or if it s doing something that its interpreted as what we want In the world of security the risk is not worth taking The command line can be used if you wanted to perform a task multiple times You could script the command and then run the script making sure that the command run is 100 accurate If you wanted to run a command once a year you would probably use the CLI Command Line Interface over the GUI Graphic User Interface GUI s will change and documentation will need updating regularly The CLI is a more static environment requiring little to no documentation changes While you are studying the ISG course you will be asked to use certain tools and commands from within Linux These tools a
33. space between the Asterisk and the DotcC Ls List all files in the current working directory The command Is simply lists the contents of the directory you are in Now to learn how to rename files and delete them cp phonebook junk Copy file Cor folder phonebook to junk Move a file Cin this instance we re mv junk junk2 moving the file junk to junk2 effectively renaming it List all files in the current working Ls directory rm junk2 Remove the file or folder junk2 ls List all files in the current working directory EXECUTING COMMANDS For upcoming labs and courses you will require many different commands Probably the most basic of these is ping Try running the following command to ping the Google OpenDNS Server 8 8 8 8 located at 10 203 1 5 Ping the IP Address 10 203 1 5 _ for a count of 5 c 5 outputting BL DP ail Boog numerical values only n WHAT IS PING The command you just ran ping is a command designed to test the connectivity between two networked computers Simply put the ping command sends ICMP packets from your computer to the target computer in this case 10 203 1 5 which then returns the packets to your computer Your computer measures the journey time of each individual packet deriving metrics from this thus giving you useful information about the network connection and possibly the machine you re pinging EXAMPLE tundra m
34. th every other package This ensures no conflicts and no issues of stability This approach does sometimes slow progress with packages in the Debian distro being behind current versions Debian is a popular server Operating System due to its stability and has multiple flavours designed purely for devices as an integrated OS Ubuntu Designed to be friendly to the a average user and the best desktop ty operating system that it can be Ubuntu is based on Debian and has a number of forks including Kubuntu Edubuntu and Xubuntu Today Ubuntu and its derivatives is one of the more popular Linux Desktop operating system and is currently in use on home computers servers business education government and charity machines SUSE Incorporating many features and CFE aspects of Redhat SUSE was suse Desktops with its acquisition by Novell in 2003 Novell quickly used the a popular choice on OS to launch a counter offensive against Microsoft offering a _ paid for support scheme similar to that of RedHat giving companies an enterprise level OS with enterprise level support but with the flexibility and low implementation and maintenance costs of Linux A free home version of SUSE OpenSUSE was released by Novell during the acquisition drawing a parallel with CentOS Fedora from Redhat In 2006 Novell signed a controversial agreement with Microsoft to improve interoperability between Novel SUSE
35. user categories User Group Other Each user category can only have three sorts of permission applied to it Read Write Execute You can see some existing permissions by running the following commands Change your working directory to your home directory cd Print the current working directory You should be in home msail35 where msa1135 1S your own username man k directory Runs the List directory contents command with the arguments long List format l and sabi a Ls Lla Once you run this command you should see something like the following msaii3S saturn ls la total 36 dadrwx msaii3S Domain Users 4096 2011 09 08 16 29 drwxr xr x root root 0 2011 09 12 12 08 rw msaii3S Domain Users 27 2011 09 08 16 29 bash history rw r r msaii3SS Domain Users 220 2006 07 05 17 39 bash logout rw r r msaiiSS Domain Users 414 2006 07 05 17 39 bash profile rw Ir r msaii3S Domain Users 2227 2006 07 05 17 39 bashrc arwx msaii3S Domain Users 4096 2011 09 08 14 46 cache drwx msaii3S Domain Users 4096 2009 09 18 16 30 Desktop drwxr xr x msaii3S Domain Users 4096 2007 01 03 19 14 kde drwxr xr x 3 msaii3S Domain Users 4096 2009 09 18 16 51 nautilus msaii3S saturn E This might initially look confusing so let s break this down sntTtaneu px do3axs q Jye sIyseq aTtyozd useq 4noBoT useq Azoisty useq TS 9T FT 6T O 9T 9F FT 6 LT 6E
36. ws on the keyboard to move backwards and forwards through a typed command Very useful if you want to modify something right at the beginning of the long line you just typed HISTORY At any point you can recall previous commands that you typed by using the Up and Down arrows on the keyboard Up goes back through the commands you ve used in reverse order going back into the past Down brings you back to the present until you reach a blank line to input a new command Your history is stored in bash_history You can view it by running the command cat bash_history Your history does not store the output from the terminal nor your interaction with any programs or applications that have been run only the commands that you inputted straight into the command line are stored GETTING HELP AND SEARCHING The behaviour of many commands can be modified by using switches or arguments These are described in the online manuals man pages which can be ready using the man commana Information is also available about programming libraries and other operating system features To advance through the text use the Page Up amp Page Down keys Type h to discover more sophisticated commands and type q to quit the man page Ts Get a list of files and folders in long format now you need to know how to interpret it man Ls Opens the man User Manual page for the Ls command Read this to
37. x 1 0 to 2 3 System lll Xenix 3 0 System V SCO Xenix R1 to R2 SCO Xenix AIX V 286 System V 1 0 A SCO Xenix V 386 HP UX 1 076 12 Sun OS 1210 30 HP UX 2 010 30 lt 6 Se co gt lt Oo HP UX 6 to 11 ee we UnixWare E 1 x to 2 x OpenBSD 5 penServer TONOZ 2 Solaris 5 0 lo 5 04 Sorat AIX SXI i OpenServer 5650516507 UnixWare 1x OpenBSD Z 9 Oo 5 x Open ener ou 20 anis lito 11i v3 10 OpenSolaris and derivatives Solaris 11 DIFFERENT LINUX DISTRIBUTIONS Different distributions of Linux exist because different people all have different opinions on what is most important Each distribution represents the diverse choice of a group of individuals As you can see from the previous Linux Distribution Timeline each distro originates from somewhere Many distributions have a colourful and interesting history most of which can be discovered from a little reading on the homepage of the distro in question Most modern day distros spring from core distributions such as Redhat and Debian however some distros merge over time or diverge where mandates and opinions have differed Below are the major distributions that you are likely to run across All have their positive and negative points and all have a different focus Debian A distribution based on Stability Debian pride themselves on testing each and every package in the OS wi

Download Pdf Manuals

image

Related Search

Related Contents

  TiPABX - BTicino  IPG HW Consumer Officejet AIO Datasheet      GU 211 陀螺儀使用說明書 - Flying  Benz C - Class RES (W204) Installation process  Reginox minister 10  ASUS T100TAF User's Manual  HP ProBook 430 G1  

Copyright © All rights reserved.
Failed to retrieve file