Difference between revisions of "Tutorial3: Advanced File Management / Quoting Special Characters"

From CDOT Wiki
Jump to: navigation, search
(Relative-to-home Pathnames)
(Relative-to-home Pathnames)
Line 93: Line 93:
  
 
For example:
 
For example:
~jane = /home/jane
+
'''~jane = /home/jane'''
  
  

Revision as of 10:34, 13 January 2020

ADVANCED UNIX / LINUX FILE MANAGEMENT

Main Objectives of this Practice Tutorial

  • Understand the difference between absolute / relative / relative-to-home pathnames
  • Become productive using various pathname types for Unix/Linux File Management
  • Understand the following Ambiguous Filename expansion (FNE) Symbols: * / ? / [ ] / [! ]
  • Become productive using FNE for Unix/Linux File Management
  • Understanding quotation symbols: Backslash \ , single quotes ' ' , double quotes " "
  • Understand the purpose of quoting special characters for File Management and issuing Linux commands


Tutorial Reference Material

Course Notes
Pathname Type / Filename Expansion / Quoting Reference
YouTube Videos
Course Notes:


Pathname Types

Ambiguous Filename Expansion Symbols

  • Asterisk * , Question ? ,
    Character Class [ ] and [! ]


Quotation Symbols Instructional Videos:
  • Using Pathname Types
  • Filename Expansion
  • Quoting Special Characters

Pathname Types

A pathname is a fully-specified location of a unique filename within the file system.

The concept of a pathname relates to every operating system including Unix, Linux, MS-DOS, MS-Windows, Apple-Macintosh, etc.


It is important to understand file pathnames since you need to save or access a file without ambiguity because there may be several files by that name in various directories. For example: Accessing the cars.txt file - which file to access? It depends on the location of the file

/home/userid/uli101/cars.txt
/public/uli101/samples/cars.txt
/etc/data/cars.txt


Absolute Pathnames

An absolute pathname begins from the root, which is / (forward slash)

This is called absolute because it is specified the same, and locates a specific file, regardless of your current directory

For example: mkdir /home/someuser/uli101 will create the uli101 directory in the home directory of user someuser

Relative Pathnames

A relative pathname begins from your current directory

This is called relative because it is used to locate a specific file relative to your current directory

For example: mkdir uli101 will create the uli101 directory in your current directory!

Relative-to-home Pathnames

You can specify a pathname as relative-to-home by using a tilde and slash at the start, e.g. ~/uli101/notes.html

The tilde ~ is replaced by your home directory (typically /home/username) to make the pathname absolute.

You can immediately place a username after the tilde to represent another user’s home directory.

For example: ~jane = /home/jane




Ambiguous Filename Expansion

x

Quoting Special Characters

x

INVESTIGATION 1: ABSOLUTE / RELATIVE / RELATIVE-TO-HOME PATHNAMES

X


Perform the Following Steps:


  1. X


INVESTIGATION 2: FILENAME EXPANSION

x

Perform the following steps:
  1. X

INVESTIGATION 3: QUOTING SPECIAL CHARACTERS

x


Perform the Following Steps:
  1. X



LINUX PRACTICE QUESTIONS

The purpose of this section is to obtain extra practice to help with your assignment #1, quizzes, your midterm, and your final ezam.

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_week3_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. X
  2. X
  3. X
  4. X
  5. X
  6. X
  7. X
  8. X