Objective category: cli & git



iObjectives: Command line interface (CLI) skills

Command line exercise

This tutorial is assuming you are using a BASH shell on some operating system: Linux and OSX users are ready to roll out of the box. Windows users should download the GIT BASH program that comes along with download git (see the second set of objectives for this).

  1. Download this compressed archive of hierarchical file data (right click > save link as...) called file_tree_cit115.zip. Download it to a known location. (This file tree was created by Lauren H. as a composition of other students' trees at West Hills as her final project in CIT-115 in the Fall of 2018.)
  2. For users of Windows, you may want to extract the compressed files to a known location using Windows explorer instead of trying to do the decompression on the command line. If you are on BASH and have access to unzip, you can use that to decompress the archive. You can also use any number of
  3. Make sure you've pulled up the BASH tutorial which provides a very nicely sequenced set of steps for navigating the command line interface. Please pause and read Tutorial 1: on listing files, making directories, and navigating the tree.
  4. With your shell open in your chosen operating system, navigate into the root directory of filetree. Using ls -l discover and record as

    Question A: how many "normal"/non-hidden files and/or diredctories are inside the root directorycalled filetree? Then, include hidden files/directories by running ls -al. How many are hidden?

    Question B:What was the most recent file change recorded on the directory called tv?
  5. Navigate into the bored directory: how many files and/or directories are in this directory? Using your directory navigation skills, compare the contents of the four subdirectories of bored

    Question C: which contains the most directories/files?

    Question D:In which sub-branch of the tree do you reach a file "leaf" the soonest?
  6. Position yourself in filetree/bored/Books. We want to navigate into filetree/food/smokedfoods from your current location in ONE single cd command. This will require using the .. hidden file which refers to the parent directory of your current location.

    Question E:Write the full cd command on your response sheet and make sure it works!
  7. With your shell cursor currently in filetree/food/smokedfoods/, discover the single file in this directory. Question F:Record its name and size (include units, please)
  8. Navigate from filetree/food/smokedfoods back to the root of the tree in a single command to cd (you'll be using the hidden .. file a bunch!)

    Question G:Record your cd command
  9. Navigate into filetree/vehicles/ and create a new directory of your choosing that starts the branch of your own car-related subtree. Use the touch program/command to create at least three new directories and four new files corresponding to vehicle names/brands that are of interest to you and place them in the correct places within this branch.

    Question H:Document your process on your response sheet.
  10. Navigate into filetree/vehicles/Jeeps/Luxury/ and explore working with directories that contain spaces.

    Question I:What exactly do you type to navigate into a directory with spaces?
  11. Since file name and directory names with spaces are rubbish and should never, ever find their way onto any computer, use commands detailed in the second tutorial to rename each file and directory that contains a space with ones that do not.

    Question J:Record an example command to rename a directory with spaces and one to rename a file without spaces.
  12. Navigate back to filetree/vehicles/ and create a cd commannd to get yourself back to the root and then back up into filetree/food/Desserts/. Remove the configuration file called desktop.ini since it's not useful for human viewing.

    Question K:Write your command used for removing this file.
  13. Navigate into filetree/food/Desserts/Candy/Chocolates/ and make a copy of the file snickers.jpg and call it anothersnickers.jpg. Verify that you have copied this file to the same directory.
  14. Now copy the file snickers.jpg into the following location: filetree/vehicles/.

    Question L:Record the exact command you issued to create this copy. Navigate to your destination directory of filetree/vehicles/ to verify that your copy operation was successful.
  15. Back in food land, display the contents of the file Fudge.url located in filetree/food/Desserts/Candy/Chocolates/.

    Question M:Record the contents of the SECOND line of this file on your response sheet.

    Question N:Using wc how many characters are in this url file?

arrow_upward up

Objective group SETUP: Creating your initial repository

Objective group Objective ID Objective text
GIT.SETUP: Setting up your github GIT.SETUP.1 Create a repository with an online github server host such as github.com or gitlab
GIT.SETUP.2 Clone a hosted respository to more than one local machine and access the files
GIT.SETUP.3 Add files to a local repository, commit those files, and push the commit to a remote


Workflow for creating a github account

arrow_upward up

Page created in 2019 by Eric Xander Darsow. Original content can be freely reproduced without any permission or attribution according to the site's content use agreement. Any content accessed by links to external sites or content with specific rights notices is governed by its respective use agreements.