Homework #1#
For this assignment, create a single text file in nano called
homework1.txt and provide the sequence of commands needed for
each problem.
Important
All work must be your own.
You may not use generative AI / large-language models for any part of this assignment.
Starting in your home directory:
Create the directory structure:
~/homework/1/files/
Now move into the
files/sub-directory you created, and create a file calledproblem.txtusing thetouchcommand.
For this problem we will use the same directory-structure/files from the shell lessons (see Some Sample Data to remember how to get this).
Change to the directory:
~/shell-lesson-data/exercise-data/alkanes
Now make a subdirectory under that called
tests/and change directory intotests/.From within
tests/copy the filescubane.pdb,ethane.pdb, andoctane.pdbfrom the directory above into your current directory. You should use a single command for it.
Let’s consider two ways to do the same task—moving a file to a new location. We want to move a file
~/answer.txtto~/homeworks/answer.txtMethod 1: copy + delete
In your home directory, create a file called
answer.txtusingtouchCreate a directory called
homeworks/Copy the file
answer.txtintohomeworks/Delete the version of
answer.txtin your home-directory (only the versionhomeworks/answer.txt) should remain.
Method 2: moving
Back in your home directory, create a file named
answer2.txt(again usingtouch).Move this file, using a single command, into the
homeworks/directory you created previously.
Using
man ls, find the option/flag that sorts files by size (largest file first). In addition to this new option, also use the-loption to get a long listing.Give the
lscommand that will do this sorting + long listingIn
~/shell-lesson-data/exercise-data/alkanes/, show the (long-listing) output when you sort by size