Starting from:

$25

COP4600 - Ex1 - The Command Line- Solved

 The Command Line
 

Overview
You will learn about Linux terminal commands that will greatly help you in this class. If you are an experienced user in terminal commands or command line navigation, this exercise will just serve as a refresher. You will take a screenshot of some commands that you use, and you will also submit a tar file to Canvas for this assignment.

File Packaging
There are many times that you will find yourself needing to package or compress (or unpackage and uncompress) files while working on projects. TAR (originally Tape Archive - packs / creates an archive) and Gzip (GNU zip) are two commonly used tools in Unix based operating systems. To familiarize yourself with these commands and how they work, complete the following and take a screenshot:

 

1)      Create a file (e.g., “somefile.txt”) using a text editor (e.g. nano)

2)      Use gzip to compress the file, yielding a gzipped file (“somefile.txt.gz”)

3)      Use gunzip to decompress the file, yielding the original file (“somefile.txt”)

4)      Create a second file (“other.txt”)

5)      Create an archive from both files (“somefile.txt” & “other.txt”), yielding “myfiles.tar” (tar -cvf)

6)      Extract the files from the archive (tar -xvf)

7)      Create a new file (“somefile2.txt”)

8)      Create an archive file from all three text files piped through gzip to create a “.tar.gz” (tar -zcvf)

9)      Type “ls” to view the current directory and your “.tar.gz”

10)  Unzip and Extract the “.tar.gz” (tar -xzvf)  

11)  Type “ls” to view the current directory and your extracted file.

12)  Take a screenshot of the commands run in steps 7) through 11).

 

Once finished you should have extracted readable content from the “.tar.gz”. You will use these tools to package and compress files that you will submit for projects, so make sure you understand how they work!

Terminal Navigation
The navigation exercise can be completed by following these steps, including taking two screenshots (see step 4):

 

1)      Create a folder with the name format last_first (e.g., “sanchez_richard”) in /home/reptilian.

2)      Issue a command to find files that contain the phrase “android_dev” from the kernel source directory.

3)      Reissue the command from (2); this time, pipe the output of the command to a text file named “ex1.txt”. 4) Take a screenshot of the command in 3) and another with a listing of the directory of the first file from 2). 5) Move or copy “ex1.txt” into the directory created in (1).

6)      From /home/reptilian, create a tar file named ex1.tar of the directory from (1) (including contents).

7)      Use gzip to compress ex1.tar (yielding ex1.tar.gz).

8)      Create “ex1.7”, describing steps 1-7, using a text editor (e.g. nano). (See https://liw.fi/manpages/) 9) From your local command line, use sftp to transfer the files created in (7) and (8) back to your local host.

10) Submit ex1.tar.gz, ex1.7, and your three screenshots on Canvas.

Package Installation
Sometimes you’ll need to install new packages from within a Linux system. On Debian-derived distributions, you can use the apt command for this. Here an example to install the man utility:

 

$ sudo apt install man 

 

Once installed, you can use man to view manual pages.

File Transfer
You will need to use the local Unix shell (on Windows, via WSL or MSYS) to execute the sftp command in order to transfer files from the virtual machine to the local host:

 

 $ sftp reptilian@192.168.1.130        Replace with VM IP address

 

Once connected, you can issue the “help” command from within sftp for more information.

More products