Assume you are at your home directory: Write the commands:
Create a directory DR1
Change to DR1
Create DR2 in DR1
Change to DR2
Also answer the following: What will each command do :
5. enter cd .
6. enter cd ..
7. enter cd
1) Create a directory DR1
mkdir DR1
2) Change to DR1
cd DR1/
3) Create DR2 in DR1 (assuming we are in DR1)
mkdir DR2
Or we can use option -p to ensure that parent directory exists, such as
mkdir -p DR1/DR2
4) Change to DR2
cd DR2/
5) cd .
. Represents current directory, so this will have no effect, we will remain in the present directory
6) cd ..
.. represents a directory which is one level up the current directory. So, suppose if you are in DR2 currently, this will take you back to DR1
7) cd -
This again means, go back one directory similar to above command cd ..
Get Answers For Free
Most questions answered within 1 hours.