Lab01: Part I Introduction to Linux Professional Training Academy Linux Series
What is Linux? Linux is an operating system. Specifically, Linux is the kernel or the core of the system Originally developed by Linus Torvalds at the University of Helsinki, Finland Today, the Linux kernel is more commonly deployed with a set of tools Various distributions of Linux exist which package different sets of tools and environments for the various types of users. For example: Red Hat: for system administrators Ubuntu, Fedora: for desktop users Others include: SuSE, Debian, Knoppix, Slackware, Mandriva, Gentoo, etc.
Linux History Source: http://en.wikipedia.org/wiki/linux
Linux History By the early 1990s, PCs became powerful enough to start running UNIX Linus started to develop a freely available academic version of UNIX for PC machines (UNIX was developed at AT&T's Bell Laboratories in the early 1970s) Minix (by Andrew Tanenbaum at the Vrije Universiteit, Amsterdam) existed at the time and was a smaller academic version of UNIX for teaching, but new features were not allowed to be added Consequently, Linus started his own project
Linux Popularity In late 1991, first version of Linux was released Two years after beginning, Linus had 12000 users Today, Linux is well known for its stability and reliability Linux powers the majority of web servers in the world (Apache) The Linux counter project roughly estimates that there are 29 million Linux users (Source: http://counter.li.org/estimates.php)
Some Common Terms X-Windows: (X11 or X) a toolkit and protocol for developing desktop window environments (modern desktops are built using X) KDE: a free desktop environment, originally developed by Matthias Ettrich in 1996 Gnome: another free desktop environment, originally developed by Miguel de Icaza and Federico Mena in 1997 in response to KDE Directory: is another term for a folder
Some Common Terms Login account: Every Linux user has their own login name and password. When you login, all your files will be stored in your personal home directory Shell: also called the terminal, the command line, the console, or the prompt. This is the program where you type in your commands. It looks like DOS Bash: is a type of shell and stands for the Bourne Again Shell Binary: an executable program. Similar to an.exe file on Windows
Some Common Terms GUI: is the Graphical User Interface, which is your Desktop with all its windows and icons Kernel: is the main part of the operating system. It looks after the hardware, memory, and sharing of resources, etc. Root: is the most powerful user on the system, and is similar to the Windows administrator. Linux users do not user their root account all the time, only when installing new software, hardware, or configuring Script: a series of shell commands stored in a file which can be run like a program in order to automate a task Widget: a component belonging to the graphical environment, e.g. a scrollbar, button, etc.
Linux Philosophy Linux exists due to an open and accepting philosophy for learning and exploring This philosophy encompasses new users as well as experienced users Every user and developer is welcome The more users the better, so your problems and experiences are valued Make use of the helpful online forums, mailing lists, irc channels Chances are that somebody else had a similar problem to you and it is already documented A great resource is The Linux Documentation Project at http://www.tldp.org
Lab01: Part II Transferable Skills & Common Tasks Professional Training Academy Linux Series
Demonstration: Logging In/Out You should always log in with your normal login account and not the root account e.g. ict Each account on a Linux computer has its own home directory The root account is equivalent to the administrator account on windows. This is a privileged account which can install hardware and software for all other accounts Using the root account when not installing hardware/software can cause security risks as this account has privileges over all other accounts Always remember to shutdown your Linux computer correctly. Turning off the power directly can damage your filesystem
Demonstration: Web Browsers Firefox is one of the most popular browsers on all platforms (Mozilla) The Konqueror web browser is also available on the KDE desktop Other browsers include: Opera, Chromium On the command line, you can also use lynx, which is a text based web browser
Demonstration: Email Thunderbird is an email client which you can download with Firefox (Mozilla) Kmail is also available for the KDE desktop Other popular email clients include: Evolution If you are looking for text based email clients on the command line, try: pine or mutt
Demonstration: Microsoft Office Documents To create, open, and edit Microsoft Office documents you can use LibreOffice LibreOffice supports Word, Excel, PowerPoint, and access files When creating documents in Linux which you wish to open in Windows, make sure that you save as.doc,.ppt. etc.
Demonstration: File Manager The equivalent of My Computer on Windows is: Nautilus for the Gnome desktop Konqueror for the KDE desktop You can access your file manager on Gnome from the Applications menu as follows: Applications->System->File Browser
Demonstration: Opening Common Files.doc,.ppt Microsoft Office files libreoffice filemane.doc.pdf Adobe Acrobat files okular filename.pdf
Demonstration: Opening Files from USB, CD, and DVD Plug and play is now default in most Linux distributions When you insert a USB key, CD, or DVD, you can read, copy, and write files to/from these devices by accessing the following location in your filesystem: /media/* e.g. /media/cdrom, /media/dvd If your Linux does not automatically mount the device to /media/ you can use the mount command, e.g. mount /dev/sda1 /media/usbkey
Demonstration: Searching for Files To search for file names on the command line, use: find./ -name filename print To search for words within files use: grep search pattern filename
Demonstration: Printing Files If using OpenOffice and your printer setting are installing you can use: File->Print On the command use, you can use the lpr (line printer) command, for example: lpr P printername filename.pdf
Demonstration: File Sharing To share a drive or folder in Linux in the same manner as Windows, you can use the samba program For example, to map a network drive: smbmount /network/drive /local/mountpoint o username=remoteusername A graphical program called LinNeighborhood exists for reading and writing to network drives; this is not installed on the lab machines, however
Demonstration: Desktop Power Virtual Desktops allow you to open multiple windows and start a new desktop for a different task without closing down windows Creating an icon for an application on the desktop requires that you know the location of the command you wish to run
Demonstration: Graphics Graphics Package: The Gimp Diagram Package: xfig, inkscape e.g. create postscript/pdf graphics Inkscape allows you to create svg (scalable vector graphics)
Demonstration: Running Programs Java Programs: javac filename (compile) java filename (run) Perl Programs: perl filename.pl (run) C Programs gcc filename o filename.c (compile)./filename.c (run)
Demonstration: IDEs Eclipse and Netbeans are among the most popular www.eclipse.org www.netbeans.org
Exercises 1) Log onto your Linux system with the course username and password; how far do you get? :-) 2) Use Firefox to find one pdf file in google and save it to your home directory 3) Use OpenOffice to create a word document and save it in your home directory. Spend some time examining the other types of documents which you can create with OpenOffice, e.g. Impress will create PowerPoint presentations 4) From your desktop, use your system file manager to create a directory called project1 with a file called report.txt inside it. Edit report.txt and add a couple of lines of text. Copy report.txt to your home directory 5) Using the pdf that you downloaded in ex. 2, use the pdf reader (okular) to open it.
Exercises 6) On the command line, use the grep command to search your report.txt for the word the or any other word which is in your file 1) On the command line, use the find command from your home directory to find the location of the report.txt file 2) Use your virtual desktops to open a web browser on desktop 1 and openoffice on desktop 2 3) Use the gimp to create a.jpg graphic 4) Use xfig to create graphic; export it as a.pdf file
Lab01: Part III Shell Commands Professional Training Academy Linux Series
Why Use the Shell? The command prompt on Windows is also called the shell, the terminal, or the console on Linux It is also worth noting that you can use Linux without using the shell However, all tasks can be completed using the shell Q. Why should you use consider using the command prompt? A. You can perform your tasks quicker, access more powerful programs with more options, and have an ability to automate your tasks
Some Notes Everything in Linux is treated as a file by the operating system, e.g. processes, executables, text files, etc. If you are logged in as a normal user, you should see a dollar sign in your shell $ or a right arrow > If you are logging in as the super user or the root user, you should see a hash sign in your shell # On Windows you may have been used to using the term folder, on Linux folders are more commonly called directories
Some Notes To make your life easier in the shell, you should avoid creating files and directories with spaces in them Instead Linux users usually use a dash, underscore, or capitalise first letters of words. For example: project_results, project-results, projectresults Finally, always keep your files and directories organised. In particular, give your files meaningful names
Commands: Navigation pwd: print working directory To find out where you are in the filesystem, type: pwd ls: list files e.g. to list the files in a directory type: ls To list extra information about files (long listing), type: ls -l
Commands: Navigation cd: change directory e.g. to change into the projects directory, type: cd projects If you ever get lost in the filesystem, you can type cd on its own: cd To go back a level you can use: cd..
Commands: Navigation Note: The location of the current directory is represented by a single dot. Note: The location of the previous directory is represented by 2 dots.. Note: The location of your home directory is represented by a tilde sign ~ and this allows you to use the shortcut cd ~/myprojects instead of cd /home/ict/myprojects
Commands: Viewing cat concatenate file contents all at once e.g. to output the contents of poetry.txt type: cat poetry.txt more view file contents by screen less view file contents by screen For example, if your poetry file is very large, you can use more or less to output the contents one screen-full at a time They are more or less the same! Except that less allows you to go backwards
Commands: Creation touch: create an empty file e.g. to create an empty file named project_results, type: touch project_results mkdir: make a directory e.g. to create an empty directory named course_work, type: mkdir course_work
Commands: Editing vi text editor basics: The vi editor is available on all Linux and Unix systems. For this reason it is worth learning You must choose a mode to enter, for example, insert mode to insert new text To exit a mode use the Esc key, e.g. Press i to enter insert mode Usage: vi filename Search forward: /searchword Search backward:?searchword Undo: u Save and exit: :wq Exit without saving: :q
Commands: Editing emacs text editor basics: While emacs is available on the majority of Linux and Unix machines, it is not guaranteed like vi Usage: emacs filename Save: Ctrl-x Ctrl-s Search forward: Ctrl-s Search backward: Ctrl-r Undo: Ctrl-shift-underscore Help: Ctrl-h Exit: Ctrl-x Ctrl-c
Commands: Editing gedit text editor gedit is an editor available on the Gnome desktop similar to WordPad on Windows The equivalent of gedit on the KDE desktop is kwrite Both these editors support syntax highlighting and other useful intuitive features
Command Line Exercises 1) Using the command line, list the contents of your home directory 2) Check that you are in your home directory using a command 3) Create a directory called projects and change into it 4) Use emacs to create a file called poetry.txt inside the projects directory and save a few lines from a poem 5) Exit emacs and check the contents of poetry.txt in the terminal 6) To finish, return to your home directory using the least amount of keystrokes possible