Let's take a deeper look at directories.
Please see the image below.
It's simple, but it's a directory tree. The top is called / (root directory). Remember the concept of paths when commanding directory locations. For example, the path of images when viewed from the neko directory will be written as / neko / date / images. When viewed from the home directory, it is written as / home / neko / date / images.
Think of a path as a route. Route from neko to images ・ Route from home to images. Let's go with the image first.
There are two types of paths that represent the roots of this file or directory.
You don't understand just by explaining it. Demonstrate using the mkdir </ font> and cd </ font> commands.
First, let's create a directory with the mkdir </ font> command. Create neko-beya in neko's home directory.
[neko@localhost ~]$ mkdir neko-beya
[neko@localhost ~]$ ls
neko-beya
Let's move to neko-beya. Use the cd </ font> command. This command is used to move directories. Please specify the absolute path.
[neko@localhost ~]$ cd /home/neko/neko-beya
[neko@localhost neko-beya]$
Has the ~ (tilde) part changed to neko-beya? By the way, ~ represents your home directory. At first after logging in, it is ~.
This is a method of noting the path based on the directory in which the user is working. The directory where the user is working = current directory </ font>. Please remember. It may be explained in books etc. on the premise that you know it. For example, let's say the current directory is home / neko. When specifying neko-beya with an absolute path, it is written as / home / neko / neko-beya. When specifying with a relative path, use neko-beya. If the current directory is home, it will be neko / neko-bya.
Let's demonstrate. You can find out the current directory using the pwd </ font> command.
[neko@localhost ~]$ pwd
/home/neko
/ home / neko is the current directory. Let's move to neko-beya.
[neko@localhost ~]$ cd neko-beya
[neko@localhost neko-beya]$
Did you go?
that's all,
It was about the directory path.
Recommended Posts