Starting from:

$30

CSC 482 Command Line Basics Solved


CSC 482
Command Line Basics

 

The Command Line is a powerful tool that makes the automation of tasks more efficient. In addition, it will be used in this course, so understanding the basics is important.  

In this lab, we learned basic Linux command line skills including how to move between directories, how to modify files and their contents, how to search for files and directories using wildcard characters, and how to archive and unarchive folders.  I was able to test these commands within the virtual Linux environment which allowed me a better understanding of their functionality.

 

Task 1: Learn Enough Command Line, Chapter 1 
Exercise 1 (1.7.1):  Write a command to print the string Use "man echo", including the quotes;

i.e., take care not to print out Use man echo instead. Hint: Use double quotes in the inner string, and wrap the whole thing in single quotes. 

Answer 1:  echo ‘Use “man echo”’ 

 

Task 2: Learn Enough Command Line, Chapter 2
Exercise 2 (2.4.1): Type the sequence of commands needed to create an empty file called foo, rename it to bar, and copy it to baz. 

Answer to #2:              touch foo 

                                       mv foo bar                 cp bar baz 

 

Exercise 3 (2.4.1): What is the command to list only the files starting with the letter “b”? Hint: Use a wildcard.

Answer to #3:             ls b*

Exercise 4 (2.4.1): Remove both bar and baz using a single call to rm. Hint: If those are the only two files in the current directory that start with the letter “b”, you can use the wildcard pattern from the previous exercise. 

Answer to #4:              rm bar baz           or             rm b*  

          

Task 3: Archiving Files
In this task, we are given an overview of the archive formats tar and zip.  In the first part of the task, we run into an issue while compressing the temporary directory where the two files in that directory are not included in the compressed zip file.  To fix this, an option must be added to the zip command.  After looking through the documentation, it was determined that the –r option (recursively travel through all directories) needed to be used because now all files included in the temporary directory will be included with the zip file.  The command used for this was         zip –r temp.zip temp

Later in this task, it asks us to use the curl command to download a lab file from a given URL. Once the file had been downloaded, we discovered it was a zip file which needed to be unpacked.  The command I used to do this was     unzip ~/csc482-lab0-file.zip 

 

Task 4: Finding the Secret Word
The last task of this lab had us searching through an unpacked zip file searching for a secret word contained within the extracted files.  This task involved using many of the commands learned in Task 3, seeing that the main zip file contained other archives that needed to be unpacked.  In order to find the word, I first did a search of the top directory that included all its subdirectories and files included in them.  After viewing this information, I pinpointed subdirectory ‘tx5’ as having a few interesting files with in it.  Upon navigating to this subdirectory, I noticed it had 3 .xz files in it.  I used the xz command with the –d decompression option, then I was able to view the files using less.  These files contained too much data to look through myself, so I entered a grep command that searched the files for the string beginning with “The secret is” as was stated in the lab and found that the secret word was contained within the bwords file.   The secret word that was found along with the commands used to find it are listed below:

The secret word is xyzzy

273   man dir 

274   dir -R 

275   cd c/z/t9/tx5 

276   ls 

277   xz -d bwords.xz 

278   ls 

279   xz -d cracklib-small.xz 

280   xz -d words.xz 

281   ls 

282   ls bwords 

283   ls -l 

284   ls -l bwords 

285   cd bwords 

286   ls 

287   less bwords 

288   less cracklib-small 

289   less words 

290   grep "The secret is" bwords 

 

 

 

More products