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 decompress)
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 directory 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 file named “output.txt”.
4) Take a screenshot after running ‘ls’ on the parent directory of the file you found from (2).
5) Take a screenshot of the command and its result from (3).
6) Move or copy “output.txt” into the directory created in (1).
7) From /home/reptilian, create a tar file named ex1.tar of the directory from (1) (including contents).
8) Use gzip to compress ex1.tar (yielding ex1.tar.gz).
9) Create “ex1.txt” with man formatting, describing steps 1-8, using a text editor (e.g. nano). (Check out
the links below)
10) From your local command line, use sftp to transfer the files created in (8) and (9) back to your local host.
11) Submit ex1.tar.gz, ex1.txt, and your three screenshots on Canvas.
https://liw.fi/manpages/
https://www.linux.com/news/what-you-need-know-write-man-pages/
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.
Man File
You will write a man file for this exercise. After you write it, run this command to confirm the file is viewable
using the man utility:
$ man ./example.man
On Canvas, see Files > Exercises > Ex1 > man_page.txt for an example of how your man file should be formatted
and submitted.
Once you are satisfied with the man file content, copy the text to a text file for submission by running the cat
command and redirecting standard output:
$ cat example.man > example.txt
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 [email protected]
Once connected, you can issue the “help” command from within sftp for more information.
Submissions
You will submit the following five items at the end of this exercise on Canvas:
⚫ One screenshot of the commands from steps 7-11 in “File Packaging”
⚫ Two screenshots from steps 4 and 5 in “Terminal Navigation”
⚫ Compressed tar file of the created directory and files
⚫ Manual page in “man” format (with markup)
Replace with VM IP address
Command Line Cheat Sheet
Shell Specific
cd DIRECTORY changes to specified directory
Examples (from /home/)
cd reptilian changes to /home/reptilian
cd .. changes to parent directory (/)
cd ~ changes to user’s home directory (/home/reptilian/)
There is no man page for cd because it is built into the command shell.
General Commands
If you are confused about how a command works, you can view the manual page with the man command:
man COMMAND display the manual for the specified command
Example
man man displays the manual for the man command
The following commands have man pages that will provide more information and correct syntax:
ls Lists all of the files located in the current directory.
clear Clears the terminal. Use this if your terminal becomes cluttered.
mv Move a file or folder from one location to another. Can also be used to rename files
cp Copy a file or folder to a different location.
mkdir Creates directory.
rmdir Removes directory.
rm Removes file(s).
locate Find a file within your OS.
tar Zip or unzip files via command line.
grep Searches files in plain-text for a matching expression.
gzip Compress a file using the gzip compression routine
find Locates files.
pwd Prints the absolute location of the current directory.
nano Brings up text editor for file creation or file editing.
Command, COP4600, Ex1:, line, solved
[SOLVED] Cop4600 ex1: the command line
$25
File Name: Cop4600_ex1__the_command_line.zip
File Size: 273.18 KB
Only logged in customers who have purchased this product may leave a review.

![[SOLVED] Cop4600 ex1: the command line](https://assignmentchef.com/wp-content/uploads/2022/08/downloadzip.jpg)

![[Solved] COP4600 Project 2-POSIX Standards & Bindings](https://assignmentchef.com/wp-content/uploads/2022/08/downloadzip-1200x1200.jpg)
Reviews
There are no reviews yet.