Itec | ITEC | Towson University - Towson, MD
3. Working with files, directories and sub directories in Linux command line
· Start another Linux command line session - you will be placed in your home (~) directory · Determine the actual path of your home (~) directory a. What is the actual path of your home (~) directory? Answer: ________________________ b. What command did you use to find your home directory? Answer: ________________________ c. Show the contents of your home directory? (include permissions, file / directory names, size, date and time stamps) Answer: ________________________ Hint: use long option [Paste a screen shot showing the contents of your home directory…] [2 pts] d. What command did you use to show the contents of your home directory? Answer: ________________________ · Use a text editor (in Applications / Accessories) to create a text file containing your name on line 1 and your course.section on line 2 · Name the file mytextfile.txt and be sure to put it in your home (~) directory · Be sure to close the file you just created (and exit from the editor) e. Show the contents of your home (~) directory now? (include the same detail as above) [Paste a screen shot showing the new contents of your home directory…] [2 pts] · Note that the d in the first character of each directory listing line indicates that the entry is a directory If there is no d, then the entry is a file (such as mytextfile.txt) f. What size (in bytes) is your mytextfile.txt? Answer: ________________________ g. What is the date/time stamp of your mytextfile.txt? Answer: ________________________ · Use wildcards to be more selective when working with files
- - represents zero or more characters
? - represents a single character [ ] - represents a range of characters For example : ls –l *.txt lists all file with an extension of txt ls –l MyFile?.txt lists all .txt files beginning with MyFile regardless of the 7th character in file name …MyFile1.txt, MyFile2.txt, MyFileA.txt, etc. h. Show the listing of all items in your home (~) directory that begin with Do Note use –d option of ls command to show directory listing rather than directory contents [Paste a screen shot showing the results…] [2 pts] i. What command did you use to show the listing above? Answer: ________________________ j. Show the listing of all items in your home (~) directory in which the second letter of the name contains an i (lower case i) [Paste a screen shot showing the results…] [2 pts] k. What command did you use to show the listing above? Answer: ________________________ l. What command did you use to update the date/time stamp? Answer: ________________________ [Paste a screen shot showing the results…] [2 pts]