homework & practical let’s go through it does anyone not have access to the wiki? questions?

26
Homework & Practical • Let’s go through it • Does anyone not have access to the wiki? • Questions?

Upload: rolf-sharp

Post on 13-Dec-2015

223 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Homework & Practical Let’s go through it Does anyone not have access to the wiki? Questions?

Homework & Practical

• Let’s go through it• Does anyone not have access to the wiki?• Questions?

Page 2: Homework & Practical Let’s go through it Does anyone not have access to the wiki? Questions?

Corporate Environment

• We only get 2 years with you (pending name change and bachelor’s degrees)

• I have about 17 more classes to help you become a better IT professional

• So• If you don’t have everything current, I will bug

you for it as if I was your boss

Page 3: Homework & Practical Let’s go through it Does anyone not have access to the wiki? Questions?

Corporate Environment• This means, when class starts, if I am missing

something from you, I will ask you to work on the missing assignment before the practical

• This course builds on everything before it. If you fall behind, you won’t understand what we’re doing

• I will ask you about it in class• I will email you• I will bother you and bother you and bother you• So please do your work

Page 4: Homework & Practical Let’s go through it Does anyone not have access to the wiki? Questions?

Today

• Paths– Absolute– Relative

• The Shell– Look and feel

Page 5: Homework & Practical Let’s go through it Does anyone not have access to the wiki? Questions?

Paths• So far we have been dealing with things in our

home folder• ls • cp teams.txt scratch.txt• These things are all using the relative path• The relative path is how to get to something on a

system (file, command, etc…) from where you are right now

• Those files were in the student user’s home dir and as we were there too we didn’t have to provide any more info

Page 6: Homework & Practical Let’s go through it Does anyone not have access to the wiki? Questions?

So Relative Path

• Because we are automatically taken to tom’s home directory (or /home/tom), we are in the same directory as desktop

• So our path is the name of the file• This is akin to your desktop in Windows• People clutter their desktops with files– You can directly access them by clicking on them– It’s messy and people will judge you when they

see it

Page 7: Homework & Practical Let’s go through it Does anyone not have access to the wiki? Questions?

Remember Tom?

• If ‘tom’ was our username:

Page 8: Homework & Practical Let’s go through it Does anyone not have access to the wiki? Questions?

Absolute Path

• When reading guides you will usually encounter absolute paths

• These always start with a /• /home/tom• /home/tom/documents• /home/student• /home/student/teams.txt• /etc/httpd/conf/httpd.conf

Page 9: Homework & Practical Let’s go through it Does anyone not have access to the wiki? Questions?

Absolute Paths• Always start with a /• These lead down the “tree” to the specific

location of a resource (file/command/whatever)

• So /home/student/teams.txt means start at / (the highest or top-level directory)

• Go into the home folder• Go into the student folder• Access the teams.txt file

Page 10: Homework & Practical Let’s go through it Does anyone not have access to the wiki? Questions?

Relative Paths

• Relative paths are more confusing• I will use convoluted examples• Usually, they’re only used in very simple

situations– Going/accessing one/two levels (up or down)

• Two notations– . means “right here”– .. Means “up one level”

Page 11: Homework & Practical Let’s go through it Does anyone not have access to the wiki? Questions?

Relative Complexity

• If you cannot access them directly in your home folder, they’re in another folder/directory

• In the command line, to access something that’s not in your immediate directory, you have to tell the shell where to look

• For example: /sbin is not in our $PATH• So if we want to use the ip command, we have

to tell the shell where to go../../sbin/ip

Page 12: Homework & Practical Let’s go through it Does anyone not have access to the wiki? Questions?

..

• We can use .. to access one directory level above ours– And we can chain them together (as the last slide

showed)• Most used with the cd command to ‘change

directory’• cd ..• Would take us from /home/tom to /home

Page 13: Homework & Practical Let’s go through it Does anyone not have access to the wiki? Questions?

Side by Side• Absolute path vs relative path• [student@it136centos58vm ~]$ cat /etc/profile• Which way is used above?

• [student@it136centos58vm ~]$ cat ../../etc/profile• Which way is used above?

• [student@it136centos58vm ~]$ cd /etc• [student@it136centos58vm etc]$ cat profile• Which way is used above?

Page 14: Homework & Practical Let’s go through it Does anyone not have access to the wiki? Questions?

Mapped Out (Absolute)• Absolute path• [student@it136centos58vm ~]$ cat /etc/profile• The shell sees the leading / in /etc/profile and

immediately starts at the top, then moves down

Page 15: Homework & Practical Let’s go through it Does anyone not have access to the wiki? Questions?

Mapped Out (Relative)• Relative path – cat ../../etc/profile• [student@it136centos58vm ~]$ cat ../../etc/profile• The shell starts in /home/student, moves up to

/home, moves up to /, then moves down to /etc, and then to the /etc/profile

Page 16: Homework & Practical Let’s go through it Does anyone not have access to the wiki? Questions?

Full Linux Directory Structure

Page 17: Homework & Practical Let’s go through it Does anyone not have access to the wiki? Questions?

Another Look The relative path has to reflect our new position

Assuming we want to access the ‘text’ file Where We Are Relative Path /home/tom/documents text /home/tom documents/text /home tom/documents/text

Does ‘Where We Are’ look familiar? It’s the Absolute path Why?

Page 18: Homework & Practical Let’s go through it Does anyone not have access to the wiki? Questions?

One Last Time

Absolute Path /home/student /var/log/messages /etc/profile / /dev/sda1

Relative Path ../../bin log/messages file ../usr/../var/log ~

Page 19: Homework & Practical Let’s go through it Does anyone not have access to the wiki? Questions?

The Shell

• The shell is what we type in, and get response from• We’re working with the ‘Bash’ shell– BASH – Bourne Again Shell (/bin/bash)– SH – Bourne Shell (/bin/sh)– ZSH – Z Shell (/bin/zsh)– CSH – C Shell (/bin/csh)– And more…

• Each one does things just a little differently• Bash is the current standard but ZSH is “supposed”

to extend it

Page 20: Homework & Practical Let’s go through it Does anyone not have access to the wiki? Questions?

Look and Feel

• [student@it136centos58vm ~]$ lx• bash: lx: command not found• [student@it136centos58vm ~]$ ls /notThere• ls: /notThere: No such file or directory• [student@it136centos58vm ~]$ ls –e /home• ls: invalid option – e• Try ‘ls --help’ for more information• Bash tries to be intelligent and tell us where the

error is

Page 21: Homework & Practical Let’s go through it Does anyone not have access to the wiki? Questions?

Bash Auto-Complete• [student@it136centos58vm ~]$ ca<tab><tab>• cadaver captoinfo cat• call card catchsegv• callercase• [student@it136centos58vm ~]$ cat tea<tab><tab>• [student@it136centos58vm ~]$ cat teams<tab><tab>• teams2.txt teams.txt• [student@it136centos58vm ~]$ cat teams• Through the ‘command’ and ‘argument’ sections of our

model, the Bash shell will show us what we can use

Page 22: Homework & Practical Let’s go through it Does anyone not have access to the wiki? Questions?

Colors

• [student@it136centos58vm ~]$ ls• folder script.sh teams2.txt

teams.txt• So we see– Folders/directories as blue– Scripts (collections of commands in a file to be run

together) as green– Files as black

Page 23: Homework & Practical Let’s go through it Does anyone not have access to the wiki? Questions?

History

• [student@it136centos58vm ~]$ <up>• [student@it136centos58vm ~]$ ls• ls was the last command we ran• We can keep pressing up to go through all the

commands we have run since the last time we cleared the history

• This is very useful for fixing errors

Page 24: Homework & Practical Let’s go through it Does anyone not have access to the wiki? Questions?

Fix It

• [student@it136centos58vm ~]$ cat /etc/passswd

• cat: /etc/passswd: No such file or directory• [student@it136centos58vm ~]$ <up>• [student@it136centos58vm ~]$ cat

/etc/passswd <arrow left twice, backspace once>

• [student@it136centos58vm ~]$ cat /etc/passwd

Page 25: Homework & Practical Let’s go through it Does anyone not have access to the wiki? Questions?

Getting Unstuck

• Shell unresponsive?• Try:– Pressing enter a few times– Pressing the q key– Pressing ctrl+z or ctrl+c– Pressing the escape key

• If you enter a command and you see > the shell is waiting for additional flags/args

Page 26: Homework & Practical Let’s go through it Does anyone not have access to the wiki? Questions?

Own Study

• Questions?

• Paths – Sobell Ch 4 – The Filesystem (81-89)• Shell – Sobell Ch 5 – The Shell (125-133)