250 likes | 382 Views
V2012.13. Agenda. Old Business Delete Files New Business Week 8 Topics: Complete Cinnamon & Applet Install Linux Intro (continued). New Business. Complete Cinnamon & Applet Installs Intro to Linux Basic Commands Install Additional Software Practice Exercises. Basic Commands.
E N D
Agenda • Old Business • Delete Files • New Business • Week 8 Topics: • Complete Cinnamon & Applet Install • Linux Intro (continued)
New Business • Complete Cinnamon & Applet Installs • Intro to Linux • Basic Commands • Install Additional Software • Practice Exercises
Basic Commands • Commands take the following form: <Command> <Switches> <Parameters> <Target> • Switches: single letters, preceded by a hyphen, that adjust what the command does • Parameters: things that the command needs to know in order to work • Target: the thing (such as a file) that the command will be applied
Basic Commands • Let’s look at an example: $ ls -l /home/seighman Target Switch Command This command tells the command line to list, in long format, the contents of the directory “/home/seighman”. The command is “ls”; the switch “-l” tells Linux that you want the list in long format; and the target of this command is the directory “/home/seighman”. In this example, there are no parameters, so that part of the command is just skipped
Basic Commands - man • So, how do I know what switch to use? • manpages are your friend $ man ls LS(1) User Commands LS(1) NAME ls - list directory contents SYNOPSIS ls [OPTION]... [FILE]... DESCRIPTION List information about the FILEs (the current directory by default). Sort entries alphabetically if none of -cftuvSUX nor --sort is specified
Basic Commands • pwd • ls • cd • mkdir • rmdir
Basic Commands - pwd • ‘pwd’ $ pwd /home/seighman • The you are here sign can be displayed with the pwdcommand (Print Working Directory)
Basic Commands - cd • ‘cd’ $ cd $pwd /home/seighman • You can change your current directory with the cd command (Change Directory) • Entering ‘cd’ will always return you to your home directory
Basic Commands - cd • Some ‘cd’ examples: $ cd / • Will take you to the ‘root’ directory $ cd - • Will return you to the previous directory location $ cd ~ • Will return you to your home directory $ cd .. • Move one level above your current directory in the directory tree
Absolute and Relative Paths • When you type a path starting with a slash (/), then the root of the file tree is assumed • If you don't start your path with a slash, then the current directory is the assumed starting point $ pwd /home/seighman $ cd home bash: cd: home: No such file or directory $ cd /home $ pwd /home
Repeating and Editing Commands • Use the Up-arrow key to retrieve a command you issued before • You can move up and down using arrow keys to get earlier and later commands • The Left-arrow and Right-arrow keys let you move around inside a single command • Combined with the Backspace key, these let you change parts of the command and turn it into a new one • Each time you press the Enter key, you submit the modified command to the terminal and it runs exactly as if you had typed it from scratch
Basic Commands - ls • Let’s focus on ‘ls’ $ ls –l drwxrwxr-x 5 seighmanseighman 4096 Jan 3 11:27 linux d = directory l = link - = file
Basic Commands $ ls –l drwxrwxr-x5 seighmanseighman 4096 Jan 3 11:27 linux • The nine characters that follow, describe access rights for the owner (user), groupand the world(everyone else who may be able to access the file), in that order, each with three characters • The characters used here are: r = Read access w= Write access x= Permission to execute the program - = No access of this type
Basic Commands – mkdir & rmdir • Create your own directories with mkdir • You have to give at least one parameter to mkdir, the name of the new directory to be created Important Note: Linux is case sensitive, this means that FILE1 is different from file1 and directory1 is different from Directory1
Basic Commands – mkdir $ mkdirtest $ls test • When given the option -p, then mkdir will create parent directories as needed $mkdir -p techcrew/scripts $ls test techcrew $ cd techcrew/ $ls scripts
Basic Commands – rmdir $ rmdir test $ls • When given the option -p, rmdirwill recursively remove directories $rmdir-p techcrew/scripts $ls Warning: becarefulwhendeleting files and directories!
Practice Exercises • Work through the exercises here: http://ahstechcrew.org/docs/BasicCommandsPractice1.pdf
Super User • The “sudo” command introduces the “superuser” or “root user” • The term “root” is the name for the main administrator in a “Unix-like” system, such as Linux • There are many commands that only the root user can run • Depending on the version of Linux you are using, you will either have to log on as the root user or prefix your command with “sudo”. The default Debiandistribution of Linux, for instance, has no root password set. So you will have to use the “sudo” command
Super User • By using “sudo”, you’re saying, “Do the following command as the root user” • When you do this, you will be asked for your password and, if you have the system permissions of a root user (commonly called “being in the admin group”), then the command will be run • If you don’t have root permissions, you will get an error message WARNING: be very careful executing commands as root (sudo), you can easily render your system unuseable!
Installing Software • Installing software on Linux is a broad subject because each version of Linux has its own way of doing things • Most are variations on apt-get (Advanced Packaging Tool), used by Debian, Ubuntu, and related distributions) • yum(Yellowdog Update Manager), used by Fedora and related distributions • The basic syntax is: $ sudo apt-get install <packagename> $ sudo yum install <packagename>
Using apt-get to Manage Software • To install a software package: $ sudo apt-get install <packagename> • To update the local package database: $ sudo apt-get update • To install all available newer versions of packages: $ sudo apt-get upgrade • To remove a package: $ sudo apt-get remove <packagename>
Ubuntu Setup • Install Ubuntu Tweak • Open a ‘terminal’ • Enter the following commands: $ sudoadd-apt-repository ppa:tualatrix/ppa $ sudoapt-get update $ sudoapt-get install ubuntu-tweak • You may need to logout and login again
Basic Commands 2 • file • touch • cp • rm • mv • rename