Linux HW 2
|
<[Spring 2018]8 |
IFT 250: Shell & Script Programming with Unix |
|
Lab Activity 2A: The File System |
Learnings
· How to implement a simple file structure
· The difference between relative and absolute pathname
· Basic commands to manipulate files and directories
Part I: Growing your knowledge
Using the UNIX commands you have learned so far, create the following directory tree, shown in blue. Once the directory tree has been created, you will populate the directories with the appropriate files, shown in black. Once you are done, change your working directory to the IFT250 directory and run the find command to display the files you just created. Capture and attach a screenshot of the output and attach to the lab document.
Screenshot is the output of the tree command showing the required directory structure
Part II: Absolute Power and Relative Force
Use the commands you've learned to create the following files with the appropriate contents provided below.
~/IFT250/Unit2/Labs/this.txt
This is a file for learning relative paths, absolute paths, and directory structure
this.txt belongs in the ~/IFT250/Unit2/Labs directory
This file is in a directory which is a subdirectory of ~/IFT250/Unit2
The directory name is Labs, and the full pathname is ~/IFT250/Unit2/Labs
~/IFT250/Unit2/Labs/this.txt
This is a file for learning relative paths, absolute paths, and directory structure
this.txt belongs in the ~/IFT250/Unit2/Labs directory
This file is in a directory which is a subdirectory of ~/IFT250/Unit2
The directory name is Labs, and the full pathname is ~/IFT250/Unit2/Labs
~/IFT250/Unit2/Homework/this.txt
This is a file for learning relative paths, absolute paths, and directory structure
this.txt belongs in the ~/IFT250/Unit2/Homework directory
This file is in a directory which is a subdirectory of ~/IFT250/Unit2
The directory name is Homework, and the full pathname is ~/IFT250/Unit2/Homework
~/IFT250/Unit2/Lectures/this.txt
This is a file for learning relative paths, absolute paths, and directory structure
this.txt belongs in the ~/IFT250/Unit2/Lectures directory
This file is in a directory which is a subdirectory of ~/IFT250/Unit2
The directory name is Lectures, and the full pathname is ~/IFT250/Unit2/Lectures
~/IFT250/Unit2/this.txt
This is a file for learning relative paths, absolute paths, and directory structure
this.txt belongs in the ~/IFT250/Unit2 directory
This file is in a directory which is a subdirectory of ~/IFT250
The directory name is Unit2, and the full pathname is ~/IFT250/Unit2
~/IFT250/this.txt
This is a file for learning relative paths, absolute paths, and directory structure
this.txt belongs in the ~/IFT250 directory
This file is in a directory which is a subdirectory of your home directory
The directory name is Labs, and the full pathname is ~/IFT250/
~/IFT250/Unit1/Labs/this.txt
This is a file for learning relative paths, absolute paths, and directory structure
this.txt belongs in the ~/IFT250/Unit1/Labs directory
This file is in a directory which is a subdirectory of ~/IFT250
The directory name is Labs, and the full pathname is ~/IFT250/Unit1/Labs
After you’ve created the above files run the following commands and answer the questions below.
The semi-colon (;) is used to execute more than one command at a time.
1. cd ~/IFT250/Unit2/Labs; pwd
a. What is the output?
2. cat ../Homework/this.txt
a. What is the output?
b. What is the full path name of the file accessed?
3. cd ~/IFT250/Unit2/Lectures; pwd; cat ./this.txt
a. What is the output?
4. cat ../../this.txt
a. What is the output?
b. What is the full path name of the file accessed?
5. pwd; cat ~/IFT250/this.txt; cat ~/IFT250/Unit2/Labs/this.txt
a. What is the output?
6. cd ~/IFT250/Unit1/Labs; pwd
a. What is the output?
7. cat ../../this.txt
a. What is the output?
b. Provide the full pathname of the file displayed or sought
8. cat ././this.txt
a. What is the output?
b. What is the full path name of the file accessed?
Page | 5