Open main menu

CDOT Wiki β

Changes

Tutorial7: Links / Process Management

3,642 bytes added, 14:07, 31 January 2020
no edit summary
===Main Objectives of this Practice Tutorial===
:* xUnderstand the purpose and why links are used in Unix / Linux
:* xDefine the term '''inode''' number as it relates to a file on Unix / Linux
:* xDefine the terms: '''Hard''' Link and '''Symbolic''' Link
:* xIssue the '''ln''' command to create hard and symbolic links :* Define and understand the purpose of a '''process''' in Unix / Linux :* '''Run''' and '''terminate''' processes in the foreground and background :* '''Display''' and '''manipulate''' background and foreground processes<br>
===Tutorial Reference Material===
| style="padding-left:15px;" |Links
* Hard Links
* Symbolic Links<br><br>
Managing Processes
* Process Information
* Manipulating Processes
* Running commands / programs in background with &
 
| style="padding-left:15px;"|Linux Commands
* [http://man7.org/linux/man-pages/man1/kill.1.html kill]
|colspan="1" style="padding-left:15px;" width="30%"|Brauer Instructional Videos:<ul><li>x[https://www.youtube.com/watch?v=tZ94-qH9unM&list=PLU1b1f-2Oe90TuYfifnWulINjMv_Wr16N&index=9 Inodes and Links]<br/li><brli>[https://www.youtube.com/watch?v=q93POTgH-aQ&list=PLU1b1f-2Oe90TuYfifnWulINjMv_Wr16N&index=7 Processes and Jobs]</li></ul>
|}
===Linking Files===
 
''Links are powerful and add flexibility to Linux filesystems because everything is a file.<br><br>There are two types of Linux filesystem links: hard and soft. The difference between the two types of links is significant, but both types are used to solve similar problems. They both provide multiple directory entries (or references) to a single file, but they do it quite differently.'' <br><br>Reference: https://opensource.com/article/17/6/linking-linux-filesystem
 
 
'''inode (index) Number of a File:'''
 
<table align="right"><tr valign="top"><td>[[Image:inode-number-1.png|thumb|right|300px|Each inode stores the attributes and disk block locations of the object's data.<br>(Image licensed under [https://creativecommons.org/licenses/by-sa/3.0/ cc])]]</td><td>[[Image:inode-number-2.png|thumb|right|400px|The '''inode number''' is like a '''finger-print''', and usually is '''unique''' for each file on the Unix / Linux file system.]]</td></tr></table>
''The inode (index node) is a data structure in a Unix-style file system that describes a file-system object such as a file or a directory. Each inode stores the attributes and disk block locations of the object's data. File-system object attributes may include metadata (times of last change, access, modification), as well as owner and permission data.''
 
Reference: https://en.wikipedia.org/wiki/Inode
The '''inode number''' is like a '''finger-print'''Links are powerful , and add flexibility to usually is '''unique''' for each file on the Unix / Linux filesystems because everything is a filesystem.<br>Referring to the diagram on the far right, issuing the '''ls''' command with the '''-i''' option<br>There are two types of Linux filesystem links: hard and soft. The difference between displays the two types of links is significant, but both types are used to solve similar problems. They both provide multiple directory entries (or references) to a single inode number for each file, but they do it quite differently.'' You can see that <u>each<br/u>file<br>Reference: https://opensource(whether it is a directory or regular file) has its own unique inode number.com/article/17/6/linking-linux-filesystem 
'''Hard Links:'''
<table align="right"><tr valign="top"><td>[[Image:hard-link-1.png|thumb|right|300px|(Image licensed under [https://creativecommons.org/licenses/by-sa/3.0/ cc])<br>Image manipulated by author]]]</td><td>[[Image:inode-number-3.png|thumb|right|400px|(Image licensed under [https://creativecommons.org/licenses/by-sa/3.0/ cc])]]</td></tr></table>
Hard link is a reference to the physical data on a file system
More than one hard link can be associated with the same physical data
'''Symbolic Links:'''
<table align="right"><tr valign="top"><td>[[Image:symbolic-link-1.png|thumb|right|300px|(Image licensed under [https://creativecommons.org/licenses/by-sa/3.0/ cc])]]</td><td>[[Image:inode-number-4.png|thumb|right|400px|(Image licensed under [https://creativecommons.org/licenses/by-sa/3.0/ cc])]]</td></tr></table>
A Symbolic Link is an indirect pointer to a file – a pointer to the hard link to the file
You can create a symbolic link to a directory
Also known as soft links or symlinks
 
 
 
===Managing Processes===
xAll programs that are executing on a UNIX system are referred to as processesEach process has an ownerEach process has a unique ID (PID) Processes in UNIX can run in:ForegroundBackground [[Image:process-diagram-1.png|thumb|right|300px|(Image licensed under [https://creativecommons.org/licenses/by-sa/3.0/ cc])]]]UNIX processes are hierarchicalThis structure has a root, parents, and childrenCreation of a new process is called forking or spawningParent can fork a child and children can fork their own childrenProcesses keep their PID for their entire lifeUsually a parent sleeps when a child is executing– The exception is when the child process is executing in the background  ps (process status) command displays snapshot information about processesBy default, the ps command displays information only about the current terminal (ps -U username shows all)The top command provides a continuous update including resource usage
=INVESTIGATION 1: LINKING FILES=
# Create a '''table''' listing each Linux command, useful options and command purpose for the following Linux commands: '''ln''' , '''ps''' , '''top''' , '''fg''' , '''bg''' , '''jobs''' , '''kill'''
[[Tutorial8: Links / Process Management]]
[[Category:ULI101]]
13,420
edits