Presentation is loading. Please wait.

Presentation is loading. Please wait.

Review Please hand in any homework and practicals Vim Scripting Inter-device communication.

Similar presentations


Presentation on theme: "Review Please hand in any homework and practicals Vim Scripting Inter-device communication."— Presentation transcript:

1 Review Please hand in any homework and practicals Vim Scripting Inter-device communication

2 Today Folders review Paths review Services Processes BE SAFE TOMORROW May Day, May 1 st Check your schedules, no class after 5pm

3 Directory Structure Linux is a ‘tree’ or ‘hierarchical’ directory structure (so is Windows) http://www.linux4windows.com/Articles/linux_directory_stru cture.png

4 Paths Again The relative path has to reflect our new position Where We AreRelative Path /home/tom/documentstext /home/tom (~)documents/text /hometom/documents/text Does ‘Where We Are’ look familiar? It’s the Absolute path Why?

5 Full Linux Directory Structure

6 Directories This is why paths are important (abs vs relative) You need to know where you are and where you need to go to /bin, /sbin, /usr/bin, /usr/sbin All contain commands (programs/executables) /dev Short for ‘devices’ – hard drives, usb, cd/dvd, etc… /etc Config files for the system – we’ve already seen sudo & passwd files, also has web browser, groups, logging, program config files, etc…

7 Directories, pt 2 /home Holds user files (akin to the folder that holds ‘My Documents,’ ‘My Music,’ ‘My Pictures,’ etc… in Windows) /tmp Temp directory, used to store temporary files Always the first directory to get deleted – don’t store files here and expect them to stay /var Directory that holds ‘variable’ files that change during the normal running of a system Log files in /var/log/messages (logs get added, etc…); email (/var/spool/mail); webserver/ftp

8 Misc Directories Those are the directories you should get to know first Others are for more advanced topics/functions: /boot – holds the ‘live’ kernel /lib – library files for kernel, updates, programming, etc… /root – root user’s home dir /opt – folder for 3 rd party applications /usr – files shared between users And more

9 Paths And Access Useful administration tasks Checking /tmp Viewing configuration files/settings Creating and running scripts Moving around Looking through processes

10 Scenario 1 We want to look for failures on a device Login Check log (permissions locked) Escalate privileges Check log again

11 For Those Viewing Later Login: student Password: [student@it136centos65vm ~]# cat /var/log/messages Error: permission denied [student@it136centos65vm ~]# su ndillon Password: [ndillon@it136centos65vm ~]# sudo cat /var/log/messages | grep error Password:

12 Scenario 2 Setting/changing a static IP Google Log in Escalate Vi …and the new thing for today… Restart the ‘service’

13 For Those Viewing Later Google ‘linux set static ip’ /etc/sysconfig/network-scripts/ifcfg-eth0 Login: student Password: [student@it136centos65vm ~]# su ndillon Password: [ndillon@it136centos65vm ~]# cp /etc/sysconfig/network- scripts/ifcfg-eth0 backups/ [ndillon@it136centos65vm ~]# sudo vi /etc/sysconfig/network- scripts/ifcfg-eth0 Inside vi, set IPADDR, BOOTPROTO, MASK, GATEWAY, and save and quit [ndillon@it136centos65vm ~]# sudo /etc/init.d network restart [ndillon@it136centos65mv ~]# ip eth0

14 Summary 1) Know what you’re doing Modifying a config file? Checking system resources? 2) Know what resources you’re working with And where they are IP address? Files? /tmp? HDD (SAS/SATA or IDE)? 3) Have a good tutorial Different tutorials will explain it different ways Figure out which ways work best for you (graphical, text, video, etc…)

15 Questions on Paths? When you log into a system you’ll be in /home/ From there you can access things through the relative path or through the absolute path

16 Processes and Users A process is an action or job for the computer to do Either persistent (goes on for a while – ‘run a shell’), or immediate (‘list the files in this directory’ = ls) When the first is run, the shell is started, and stays there until we force it to exit In the second, the ls is run and it’s done The ps command shows the processes running on the system at that exact moment

17 Most PS instances ps –ef flags help show: UID = user who started the job/process PID = process id (this is used with other commands to specify a process to manipulate) TTY – tons o'fun here – this is the ‘space’ in the system allotted to the specific user Time – the time the command was entered Command – the command (with options) that is currently running LOT of info (will scroll off the screen)

18 Output of ps From liquidweb.com

19 We can see what's running And we can see it live! The top command shows the 'top' running processes Lots more useful info And live, not just snapshot like ps But also not to stdio (use q to quit) This means its not useful in scripts

20 Top Snapshot (from: wikipedia article for top)

21 Top Output Type in top Changes live, use the ‘q’ button to quit Shows system information at the top – procs, memory, utilization, and more Then shows live snapshot of system PID = process ID, each process gets a number, numbers reset each boot, and increment (first process gets 1, second gets 2, third gets 3, etc) Username = shows the user that started, and is running the command/utility Nice = priority Command = what was run to kick this off

22 Processes Review What is a limitation of the ‘top’ command? What does ‘top’ show that ‘ps’ does not? When is ‘ps’ more useful?

23 Service A service is a full application So far we’ve done things that have used single processes One running instance of the bash shell One running instance of ps Services are commonly used applications that usually encompass more than one process Networking: IP address, ports, communication streams, etc…

24 Manipulating Services Services are controlled through the service command [ndillon@it136centos65vm ~]# sudo service ssh start If the SSH service is not running, it will start it If it is running, nothing will happen [ndillon@it136centos65vm ~]# sudo service network stop Will stop all network services (no internet connection of any kind) [ndillon@it136centos65vm ~]# sudo service apache restart Will stop and then start the Apache web server If Apache is off, it will just start it again

25 Question on Services Questions?

26 Own Study Folders review Sobell Ch 4 – The Filesystem (81-89) Paths review Sobell Ch 4 – The Filesystem (81-89) Processes Sobell Ch 8 – The Bourne Again Shell (323)


Download ppt "Review Please hand in any homework and practicals Vim Scripting Inter-device communication."

Similar presentations


Ads by Google