Difference between revisions of "Tutorial 2 - Unix / Linux File Management"

From CDOT Wiki
Jump to: navigation, search
Line 52: Line 52:
  
 
|}
 
|}
 +
 +
= KEY CONCEPTS=
 +
 +
===Unix / Linux Directories===
 +
 +
[[Image:directory-structure-1.png|thumb|right|350px|In Unix / Linux (as opposed to MS Windows), there are no drive letters (such as '''C:''', or '''D:''').<br><br> All files and directories appear under a single ancestor directory called "the '''root''' directory".]]
 +
To better '''organize''' files (eg. text, images, documents, spreadsheets, programs) within your Matrix account, they should be stored in '''directories'''. To further organize <u>many</u> files, directories<br> may contain '''sub-directories'''.
 +
 +
The Unix/Linux file system is '''hierarchical''', like other operating systems such as '''Windows''', '''Mac OSX''', etc.
 +
In Unix / Linux (as opposed to MS Windows), there are no drive letters (such as '''C:''', or '''D:''').<br>All files and directories appear under a single ancestor directory called the "'''root directory'''".
 +
 +
Learning how to issue Linux commands for '''navigating''' and '''manipulating''' directory and files within the the Linux filesystem are '''essential skills''' for Linux users and Linux system administrators (i.e. ''sysadmins'').
 +
 +
In the Linux (Unix) OS, the "'''root directory'''" / is the  starting directory, and other "''child directories''",  "'''grandchild directories'''", etc. can be created as required. The hierarchical structure resembles an "''upside-down tree''". There is actually a command called '''tree'''  that displays a "'''directory tree diagram'''"!
 +
<br><br>
 +
 +
=== Directory Pathnames ===
 +
[[Image:path-name.png|thumb|right|180px|A pathname points to a file system location by '''following the directory tree hierarchy'''.]]
 +
<i>A '''pathname''' is used to specify a '''route to a file''' within the file system.<br>
 +
<br>
 +
A pathname '''points''' to a file system location by '''following the directory tree hierarchy''' expressed in a string of characters in which path components, separated by a delimiting character, represent each directory. The '''delimiting character''' is most commonly the slash ("'''/'''").</i> Reference: https://en.wikipedia.org/wiki/Path_(computing)
 +
 +
The following table displays and defines '''commonly used directories'''<br>(listed by directory pathname) for for ALL Unix / Linux Filesystems:<br>
 +
 +
<br><br>
 +
 +
[[Image:directory-structure-2.png|thumb|right|500px|'''Common directory pathnames'''<br>for for ALL Unix / Linux Filesystems.]]<table cellpadding="5"><tr><th style="border-bottom: 1px solid black;">Directory Pathname</th><th style="border-bottom: 1px solid black;">Purpose</th></tr><tr><td>'''/'''</td><td>Root directory (ancestor to all directories)</td></tr><tr><td>'''/home'''</td><td>Used to store users’ home directories
 +
</td></tr><tr><td>'''/home/username'''</td><td>A '''<u>specific</u>''' User's Home Directory</td></tr><tr><td>'''/bin'''</td><td>Common system binaries (commands) </td></tr><tr><td>'''/usr/bin'''</td><td>Common utilities (commands) for users. </td></tr><tr><td>'''/usr/sbin'''</td><td>Common utilities for system administration  </td></tr><tr><td>'''/etc'''</td><td>System administration files (eg. passwd)</td></tr><tr><td>'''/var'''</td><td>Dynamic files (log and mail files)</td></tr><tr><td>'''/tmp , /var/tmp'''</td><td>Temporary files for programs</td></tr><tr><td>'''/dev'''</td><td>Device driver files (terminals, printers, etc.)
 +
</td></tr></table><br>
 +
 +
 +
When you log into your Matrix account, you are automatically directed to your '''home''' directory.<br>This directory is where the user can store files, and create subdirectories to organize their files.
  
 
= INVESTIGATION 1: MANAGING DIRECTORIES =
 
= INVESTIGATION 1: MANAGING DIRECTORIES =

Revision as of 17:59, 30 August 2021

UNIX / LINUX FILE MANAGEMENT CONCEPTS


Main Objectives of this Practice Tutorial

  • Understand the purpose of directories and directory pathnames.
  • Use common Unix / Linux commands to perform directory management tasks.
  • Use Text Editors to create and modify text files
  • Use Common Unix / Linux commands to manage and manipulate text files.



Tutorial Reference Material

Course Notes
Linux Command/Shortcut Reference
Slides:Tutorials:


File Management Text Editors /
File Content

KEY CONCEPTS

Unix / Linux Directories

In Unix / Linux (as opposed to MS Windows), there are no drive letters (such as C:, or D:).

All files and directories appear under a single ancestor directory called "the root directory".

To better organize files (eg. text, images, documents, spreadsheets, programs) within your Matrix account, they should be stored in directories. To further organize many files, directories
may contain sub-directories.

The Unix/Linux file system is hierarchical, like other operating systems such as Windows, Mac OSX, etc. In Unix / Linux (as opposed to MS Windows), there are no drive letters (such as C:, or D:).
All files and directories appear under a single ancestor directory called the "root directory".

Learning how to issue Linux commands for navigating and manipulating directory and files within the the Linux filesystem are essential skills for Linux users and Linux system administrators (i.e. sysadmins).

In the Linux (Unix) OS, the "root directory" / is the starting directory, and other "child directories", "grandchild directories", etc. can be created as required. The hierarchical structure resembles an "upside-down tree". There is actually a command called tree that displays a "directory tree diagram"!

Directory Pathnames

A pathname points to a file system location by following the directory tree hierarchy.

A pathname is used to specify a route to a file within the file system.

A pathname points to a file system location by following the directory tree hierarchy expressed in a string of characters in which path components, separated by a delimiting character, represent each directory. The delimiting character is most commonly the slash ("/").
Reference: https://en.wikipedia.org/wiki/Path_(computing)

The following table displays and defines commonly used directories
(listed by directory pathname) for for ALL Unix / Linux Filesystems:



Common directory pathnames
for for ALL Unix / Linux Filesystems.
Directory PathnamePurpose
/Root directory (ancestor to all directories)
/homeUsed to store users’ home directories
/home/usernameA specific User's Home Directory
/binCommon system binaries (commands)
/usr/binCommon utilities (commands) for users.
/usr/sbinCommon utilities for system administration
/etcSystem administration files (eg. passwd)
/varDynamic files (log and mail files)
/tmp , /var/tmpTemporary files for programs
/devDevice driver files (terminals, printers, etc.)


When you log into your Matrix account, you are automatically directed to your home directory.
This directory is where the user can store files, and create subdirectories to organize their files.

INVESTIGATION 1: MANAGING DIRECTORIES

INVESTIGATION 2: MANAGING TEXT FILES

LINUX PRACTICE QUESTIONS