Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

ANSWER QUESTION 2: Based on the Fig 1 picture above, if you were to run the same command above (ls -al) on the /usr/ directory,

ANSWER QUESTION 2: Based on the Fig 1 picture above, if you were to run the same command above (ls -al) on the "/usr/" directory, what are two folders you would expect in the output?
Answer Choices
a. /usr/ and /etc/
b. root and document
c. share and lib
d. sbin and hostname
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Question 1(Q1) : Based on the Fig 1 picture above, if pwd informs you that your current working directory is "/var/", then what is the absolute path? Commands: pwd (print working directory): Outputs the directory that the terminal is currently in. Task 2: Listing folders and files contained within a directory. In your terminal, type "Is" and look at the output. "Is" is short for "list;" this command will list all the content of the current working directory. $ is Most commands in the Linux Terminal have specifications that can be appended to the command called flags. Let's have a look at two very useful flags for the is command. \$is -a $ is - 1 As you can see, by running these two commands, you output differs from running Is alone. The first, -a, will list all files which are hidden. Files can be hidden in the Linux file system if the first character in its name is contains a period. You will also notice both "." and ".." is listed in your output - this will be explained in more detail later. For now, just understand that these are directories hidden in your home directory. Your output for 1 (letter I) is quite different. This flag allows you to list much more information about the content, such as owner and permissions. For the purposes of this lesson, simply notice that the far left of the output includes a " d ", which will designate a directory. Everything else is a file, not a directory. Lastly to note, you can execute a combination of the above two flags into one command! \$is-la OR \$is 1a OR $ is -al Question 2 (Q2): Based on the Fig 1 picture above, if you were to run the same command above (ls al) on the "/usr/" directory, what are two folders you would expect in the output? Commands: Is: Lists all content located in the current working directory. Task 3: How to create and change directories. Now that you are familiar with printing your current working directory and listing its content, let's have a look at how to create directories, as well as how to change your working directory. 2020 Virginia Cyber Range. Created by Liam Epperly. (Edited by Dr. HJ Coffman) 3 CYSE 101 pg. 4 In your terminal, type the following commands: Scd /home/student/ $ mkdir cyber $ cd cyber $ pwd You will notice that your output "/home/student/cyber" is an absolute path to the newly created directory. The above exercise can be done another way - instead of "cd cyber" you could have specified "cd /home/student/cyber" and it would all have worked the same. The former utilizes the relative path and the latter uses the absolute path. It is important you understand how absolute paths works, but as a rule of thumb relative paths exist for convenience. LINUX TRICK: When typing a command or specifying a path, you can perform autocompletionl If you type the first few characters of a directory or file, you can auto complete it with by pressing TAB. This assumes there is no ambiguity between two files - let's look at an example. Suppose you execute the command Is and it lists the two files you see below. $ is documents_one documents_two Suppose you execute the command Is and it lists the two files you see below. $ is documents_one documents_two Then you type the following: $cddoc Now from here, if you press TAB, what do you predict the terminal will do? $ cd documents There exists an ambiguity between these two files since they are named similarly. Linux cannot identify which file you wish to access; therefore, you must provide more to complete the command. Note: /home/student/ is the home directory of the student user. If you run "cd" with no specification, the directory will change, by default, to this home directory. Question 3(Q) : In the "/etc/" directory, run the "Is" command. If you were a hacker, do you see any files that might be of interest to you? If so, name two of these files. Commands: cd (change directory): Changes the current working directory to a specified directory. mkdir (make directory): Creates a directory, using either the relative or absolute path. Task 1: Understanding what a directory is. In your terminal, type "pwd" and press the Enter key (Return if you are using a Mac). "pwd" is short for "print (present) working directory." This command displays information about the current working directory. $ pwd /home/student So, what does this mean? I hope that you have seen this beforel This directory is just like your usual folders and files. "student" is a file that is located inside of the "home" file, and "home" inside the file "I," which is a special file known as the root directory. The root directory is the highest file in the Linux filesystem and contains everything else. Please see the illustration below (Fig 1). Since all other directories or files are descended from root, the absolute path of any file is traversed through root. For example, if you have a file in /home/user/documents, you can guess that the directory structure goes from root->home->user->documents. Note: If you run the pwd command, it will provide you with what is called the absolute path. The absolute path is the full name of that given directory. This directory will be the full path from the root directory to that folder or file. Alternatively, a directory can be represented as a relative directory. A relative directory is the path relative to the current working directory. If you are in the "/var/" directory in the picture above, the "/log/" directory has both a relative and absolute nath

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

What is the main purpose of the balance sheet?

Answered: 1 week ago