Linux commands, the answer only about writing commands
1. What is the cd command that will change the current directory (which is “bob”) to the alice directory using a relative pathname (use the simplest possible relative pathname). Be sure to return to the “bob” directory
2. What is the cd command that will change the current directory (which is “bob”) to the etc directory using a relative pathname (use the simplest possible relative pathname). Be sure to return to the “bob” directory.
3. What is the cd command that will change the current directory (which is “bob”) to the lab02 directory underneath the home directory of user bob using a relative pathname (use the simplest possible relative pathname). Be sure to return to the “bob” directory.
4. What is the cd command that will change the current directory (which is “bob”) to the lab02 directory underneath the home directory of user jlucas using a relative pathname (use the simplest possible relative pathname). Be sure to return to the “bob” directory
Before we dive into the answer let us see briefly cd command and relative path.
cd stands for change directory. This command is used to change the current working directory. Syntax is as follows
cd <path>
<path> can be relative path or absolute path
Relative path means specifying a path with respect to the current location. For example "go to the parent directory of current directory, go to a directory which is inside the current same directory" etc. As an example
cd ..
The above command uses a relative path to go to parent directory of the current directory
SOLUTION TO QUESTIONS
1. What is the cd command that will change the current directory (which is “bob”) to the alice directory using a relative pathname (use the simplest possible relative pathname). Be sure to return to the “bob” directory
// change from bob to alice directory
cd ../alice
cd ../bob
We use .. which means parent directory of current directory followed by the directory which we wish to go. We return to bob directory in the second line command
2. What is the cd command that will change the current directory (which is “bob”) to the etc directory using a relative pathname (use the simplest possible relative pathname). Be sure to return to the “bob” directory.
// change from bob to etc directory
cd ../etc
cd ../bob
3. What is the cd command that will change the current directory (which is “bob”) to the lab02 directory underneath the home directory of user bob using a relative pathname (use the simplest possible relative pathname). Be sure to return to the “bob” directory.
// change from bob to etc directory
cd ~/lab02
cd -
The ~ symbol is used to navigate to the home directory
The - symbol is use to take us back to our old "current working directory"
4. What is the cd command that will change the current directory (which is “bob”) to the lab02 directory underneath the home directory of user jlucas using a relative pathname (use the simplest possible relative pathname). Be sure to return to the “bob” directory
cd ~/jlucas/Downloads
cd ~/bob
Get Answers For Free
Most questions answered within 1 hours.