340 likes | 625 Views
Linux. A UMass Amherst M5 workshop Sean Klaiber. General information. Why Use Linux?. Save Money Initial purchase and maintenance Resume Linux is used by MANY organizations More choices Tons of Linux operating systems. What is Linux?. Contains the Linux kernel
E N D
November 2011 Linux A UMass Amherst M5 workshop Sean Klaiber
November 2011 General information
November 2011 Why Use Linux? • Save Money • Initial purchase and maintenance • Resume • Linux is used by MANY organizations • More choices • Tons of Linux operating systems
November 2011 What is Linux? • Contains the Linux kernel • The kernel is the low-level software that manages hardware, multi-tasks programs, etc. • Linux Operating System • Includes the kernel • Also various utilities to get things done (program to copy files, etc) • Linux Distributions • Software companies will sell extra software • E.g. the desktop environment, games, etc. • Ubuntu is one of many Linux distributions
November 2011 Licensing The GNU General Public License Linux is under This means that Linux can be: • Freely copied, changed, and distributed • No distribution restrictions can exist • The source code must be made available to the public
November 2011 How Can It Be Free? • Linux developers make money by: • Custom applications for large companies • Tech support • Other jobs that don’t involve Linux Linux (and the Open Source movement as a whole) is an example of how the highest quality results come from those who do work of their own free will
November 2011 Ubuntu • Just one of many distributions or “distros” of Linux • Oneiric Ocelot is version 11.10 • Released October 2011 • Developed by Canonical Ltd. • About 500 paid workers and thousands of volunteers • Features: • Unity Desktop Environment • LibreOffice suite • Ubuntu Software Center
November 2011 LibreOffice • Fork of OpenOffice • Development began January 2011 • Oracle purchased Sun Microsystems in Jan 2010 • Sun owned OpenOffice and developers didn’t trust that Oracle would continue development • Discontinued development on Sun’s OpenSolaris operating system
November 2011 Package Management • Maintains a database of software dependencies & version info • Prevents software redundancies • Automatically organizes software • Ian Murdoch has called it “the single biggest advancement Linux has brought to the industry” • Ubuntu uses the “Ubuntu Software Center” • Can browse, download, and remove software
November 2011 Common Problems with Linux • Cannot develop or pre-install proprietary drivers • Doesn’t always work fluidly with all hardware • E.g. Mac touchpads • Cannot run many proprietary software packages • Larger learning curve
November 2011 Questions so far?
November 2011 Boot time
November 2011 Boot Time • Hold ‘c’ while turning on a Mac to boot from the disk drive • Will probably need to install Wireless Card drivers • Top right hand corner • There should be a pop-up announcement • Turn on two-finger scrolling (Macs) • System Preferences • Very top right
November 2011 The Command line
November 2011 Why Use The Command Line? A relatively simple string of text provides direct and unambiguous access to complicated tools
November 2011 POSIX Portable Operating System Interface for UniX • As set of standards that Unix-y (including Linux) operating systems follow to provide portability • Most basic command line tools are POSIX compliant • Means that code written with Ubuntu can be easily run with Mac OSX or Debian or Gentoo or Damn Small Linux… … but not Windows
November 2011 OPEN THE TERMINAL Useful Commands cd => change directory ls => list directory contents cp=> copy files/directories cat => concatenate and print files echo => print text mkdir => make directories pwd => prints working directory man => open manual pages less => read file with scrolling find => search for files date => print / modify date
November 2011 Task #1 Navigate, Create, Destroy
November 2011 Navigation / => root directory ~ => home directory (also ‘/home/<user>/’) .. => directory one level up . => current directory • ‘cd’ allows movement between directories • Syntax: ‘cd PATH_NAME’ • PATH_NAME can be any of the symbols above, a directory name, or some combination for complex movement • ‘pwd’ will print the current directory in case you get lost
November 2011 Task #1: Navigate, Create, Destroy • Using the ‘cd’ command, navigate to the Desktop • Hints: The ‘ls’ command will help you find the Desktop • Create a directory in the Desktop using ‘mkdir NAME’ • NAME can be anything you desire • Navigate into this new directory • Create a file and fill it with junk • Use command ‘echo JUNK > FILE_NAME’ • Read the contents with ‘cat FILE_NAME’ • Read the contents with ‘less FILE_NAME’ • Exit ‘less’ by hitting ‘q’ • Remove the file with ‘rm FILE_NAME’
November 2011 Standard Files • Standard Outputis printed to the computer screen • ‘>’ will overwrite a file with a functions standard output • ‘>>’ will append the standard output to the end of a file • Standard Input is by default what we type on the keyboard • Use ‘<‘ to take input from a file • Standard Error is an alternative type of output for errors • Use ‘2>’ to overwrite a file with standard error
November 2011 Try… $ cd ~ $ ls Desk > FILE_NAME $ cat FILE_NAME $ ls Desk 2> FILE_NAME $ cat FILE_NAME Note that the standard error is not only being written to the FILE_NAME but is being redirected from the terminal to FILE_NAME
November 2011 Input Arguments • Try deleting the directory with the ‘rm’ command. Tricky? Command line tools often use input arguments to extend their functionality • Delete the directory with ‘rm –r DIRECTORY_NAME’ • ‘-r’ stands for ‘recursive’ and will delete any file in the directory
November 2011 Save Time • Hit the button at any point to recall the last command • ‘tab’ will fill in the remaining characters for file and directory names if there is only one possible option Use and tab often
November 2011 TASK #2 Process Handling
November 2011 What’s a Process? • A process is a program in action • Programs in executable form reside on disk, when run, they are moved into memory and become a process • Linux assigns each process a Process Identification or PID
November 2011 Task #2: Process Handling $ gbrainy ‘ctrl-c’ to kill $ gbrainy & $ ps $ baobab & $ps $ kill <PID> $ history (do in new terminal) $ ps $ ps aux | grepgbrainy $ top $ tty
November 2011 Nano Text Editor Nano is one of the simplest command line text editors • To create a file, save it, and exit nano: $ nano FILE BWONGG wubwubwubwub<- enter text ctrl-o <- command to save ctrl-x <- command to exit nano
November 2011 Piping • Symbol is the vertical line, ‘|’ • Found at ‘shift+backslash’ • Takes standard output left of pipe and uses it as standard input to the function on the right of the pipe
November 2011 Piping Hot Example • Create a file with a whole bunch of random words OR random text • Make it so each SET of words or numbers have their own line • While in that directory: $ sort FILE - if using numbers, ‘sort –g’ $ sort FILE | grep ITEM $ sort FILE | grep ITEM | uniq $ sort FILE | grep ITEM | uniq -c
November 2011 Task #3 Bach and Forth Between Audio Formats
November 2011 APT Package Manager • The Advanced Packaging Tool is what Ubuntu Software Center is built on • ‘apt-get install PACKAGE’ will install and organize software • ‘apt-cache list PACKAGE’ will search for PACKAGE in the local database • ‘apt-get update’ update the local package database
November 2011 FFMpeg FFMpeg is a multimedia transcoder • Command line tools to convert sample rates, bit rates, file types, cut, copy, stream, and filter almost any audio, video, or image file • We’ll convert a lossless .flac file to an .mp3 for iTunes $ sudo apt-get install ffmpeg $ cd DIRECTORY_OF_FLAC_FILE $ ffmpeg –iFILE.flac NEW_FILE.mp3 $ man ffmpeg
November 2011 Wasn’t that easy?