Difference between revisions of "Tutorial7: Links / Process Management"

From CDOT Wiki
Jump to: navigation, search
(Linking Files)
(Linking Files)
Line 57: Line 57:
 
===Linking Files===
 
===Linking Files===
  
[[Image:link-purpose.png|thumb|right|100px|Links are a powerful feature in the Unix / Linux operating system.]]
+
[[Image:link-purpose.png|thumb|right|100px|]]
 
''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
 
''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
  

Revision as of 14:50, 30 January 2020

LINKING FILES / MANAGING PROCESSES


Main Objectives of this Practice Tutorial

  • Understand the purpose and why links are used in Unix / Linux
  • Define the terms: Hard Link and Symbolic Link
  • Issue the ln command to create hard and symbolic links
  • 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


Tutorial Reference Material

Course Notes
Concepts / Commands
YouTube Videos
Course Notes:


Links
  • Hard Links
  • Symbolic Links

Managing Processes

  • Process Information
  • Manipulating Processes
  • Running commands / programs in background with &
Linux Commands Brauer Instructional Videos:

KEY CONCEPTS

Linking Files

Link-purpose.png

Links are powerful and add flexibility to Linux filesystems because everything is a file.

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.


Reference: https://opensource.com/article/17/6/linking-linux-filesystem


Hard Links:

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 Hard links can only refer to data that exists on the same file system Hard links cannot be created to a directory When a file has more than one link, you can remove any one link and still be able to access the file through the remaining links


Assume you used "vi" to create a new file, you create the first hard link (vi myfile) To Create the 2nd, 3rd , etc. hard links, use the command: ln myfile link-name


Create a new file called “myfile” Run the command “ls -il” to display the i- node number and link counter



Symbolic Links:

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 A symbolic link can point to a file on a different file system A symbolic link can point to a nonexistent file (referred to as a "broken link")


Also known as soft links or symlinks

Managing Processes

x

INVESTIGATION 1: LINKING FILES


In this section, you will learn how to ...



Perform the Following Steps:

  1. x

In the next investigation, you will ...

INVESTIGATION 2: MANAGING PROCESSES

In this section, you will learn how to ...


Perform the Following Steps:

  1. x

In the next investigation, you will ...


LINUX PRACTICE QUESTIONS

The purpose of this section is to obtain extra practice to help with quizzes, your midterm, and your final exam.

Here is a link to the MS Word Document of ALL of the questions displayed below but with extra room to answer on the document to simulate a quiz:

https://ict.senecacollege.ca/~murray.saul/uli101/uli101_week8_practice.docx

Your instructor may take-up these questions during class. It is up to the student to attend classes in order to obtain the answers to the following questions. Your instructor will NOT provide these answers in any other form (eg. e-mail, etc).


Review Questions:

  1. Write a single Linux command to create a hard link called ~/backup/myfile.txt.lnk to the existing file called ~/myfile.txt
    Write a single Linux command to display detailed information for those files above displaying their i-node numbers.
    In this case, will the inode numbers for those files above be the same or different?

  2. Write a single Linux command to create a symbolic link called ~/shortcuts/murray.saul.lnk to the existing directory called ~murray.saul
    Write a single Linux command to display detailed information for those files above displaying their i-node numbers.
    In this case, will the inode numbers for those files above be the same or different?

    What data is contained in the file called ~/shortcuts/murray.saul.lnk?
    What would be the size of the file called ~/shortcuts/murray.saul.lnk?

  3. Write a single Linux command to run the program called ~/clean.sh in the background.
    What command would you issue to place the previously issued program in the foreground?
    What command would you issue to confirm that this program is running in the background?
    What key-combination would you issue to send that program again into the background?

  4. Write a single Linux command to display running processes in “real-time”.
  5. Write a single Linux command to terminal a process that has the following PID: 22384
  6. Use the following diagram to answer the accompanying questions.
    Each of the following questions will use the diagram below and are treated as independent situations.

    [1] Stopped vim a
    [2]- Stopped vim b
    [3]+ Stopped vim c


    Write a single Linux command to bring the second-recently process placed in the background into the foreground.
    Write a single Linux command to terminate the job #3.

  7. Create a table listing each Linux command, useful options and command purpose for the following Linux commands: ln , ps , top , fg , bg , jobs , kill