Lab 10.3.1: Creating Directories in Linux Estimated Time: 15 minutes Objective In this lab, the student will learn how to create files and directories with the Linux operating system..
Trang 1Lab 10.3.1: Creating Directories in Linux
Estimated Time: 15 minutes
Objective
In this lab, the student will learn how to create files and directories with the Linux
operating system
Equipment
The following equipment is required for this exercise:
• A computer system with Linux Red Hat 7.2 operating system installed
Scenario
The IT department in a small company has purchased some new computer systems They want some new directories and files created on the server for the people that are going to be receiving these new computers
Procedures
In the first step of this lab, the student will create a directory or folder In the second step
of the lab, the student will create a file and save it inside the directory
Step 1: Login
Login using a student account for this lab
For example, at the terminal window type:
studentA1
Then, type the password for student A1
Step 2: The mkdir Command
The mkdir command is used to create directories and subdirectories Run the following command:
man mkdir
What does the –p switch do when it is run in conjunction with the mkdir command?
Trang 2
Step 3: Creating Directories
1 The following command sequence will not work unless the user is in the home
directory Type:
cd
Verify that the user is in the home directory by using the pwd command Next, create the directory structure by typing in the following command:
mkdir –p chemistry/experiments/week3
Example
Verify that the directories were created correctly by typing:
ls –R
Be sure to use a capital “R” with the ls command Describe the results
Example: The results should look similar to this screen
2 Next, create another directory in the chemistry directory, type:
cd chemistry
This will change the current working directory to the chemistry directory From the
chemistry directory, type:
mkdir laboratory
Trang 3Verify that the laboratory directory was created by typing:
ls
Is the subdirectory called “laboratory” there? Y/N
_
Are there now two directories in the chemistry directory? Y/N
_
3 In the space below draw a picture of the home directory Create a graphical
representation of the home directory including all of the new directories that were created in the steps in this lab
Reflection
If the user did not use the –p switch with the mkdir command, how would the directory structure have been created?