Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "Homework & Practical Let’s go through it Does anyone not have access to the wiki? Questions?"— Presentation transcript:

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

2 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

3 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

4 Today Paths – Absolute – Relative The Shell – Look and feel

5 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

6 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

7 Remember Tom? If ‘tom’ was our username:

8 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

9 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

10 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”

11 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

12 .. 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

13 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?

14 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

15 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

16 Full Linux Directory Structure

17 Another Look The relative path has to reflect our new position Assuming we want to access the ‘text’ file Where We AreRelative Path /home/tom/documentstext /home/tomdocuments/text /hometom/documents/text Does ‘Where We Are’ look familiar? It’s the Absolute path Why?

18 One Last Time Absolute Path /home/student /var/log/messages /etc/profile / /dev/sda1 Relative Path../../bin log/messages file../usr/../var/log ~

19 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

20 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

21 Bash Auto-Complete [student@it136centos58vm ~]$ ca cadavercaptoinfocat callcardcatchsegv callercase [student@it136centos58vm ~]$ cat tea [student@it136centos58vm ~]$ cat teams teams2.txtteams.txt [student@it136centos58vm ~]$ cat teams Through the ‘command’ and ‘argument’ sections of our model, the Bash shell will show us what we can use

22 Colors [student@it136centos58vm ~]$ ls folderscript.shteams2.txtteams.txt So we see – Folders/directories as blue – Scripts (collections of commands in a file to be run together) as green – Files as black

23 History [student@it136centos58vm ~]$ [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

24 Fix It [student@it136centos58vm ~]$ cat /etc/passswd cat: /etc/passswd: No such file or directory [student@it136centos58vm ~]$ [student@it136centos58vm ~]$ cat /etc/passswd [student@it136centos58vm ~]$ cat /etc/passwd

25 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

26 Own Study Questions? Paths – Sobell Ch 4 – The Filesystem (81-89) Shell – Sobell Ch 5 – The Shell (125-133)


Download ppt "Homework & Practical Let’s go through it Does anyone not have access to the wiki? Questions?"

Similar presentations


Ads by Google