当前位置: 代码迷 >> 综合 >> The basics of how to use Linux (如何使用Linux,基础笔记四)
  详细解决方案

The basics of how to use Linux (如何使用Linux,基础笔记四)

热度:48   发布时间:2023-09-30 04:47:34.0

Navigation in Linux

Before we said “Everything is the file in Linux” and know some important directories, and those files are under various directories. In this blog, we are going to see some commands which help us navigate in directories of Linux.

1. Understanding The File System Tree

The basics of how to use Linux (如何使用Linux,基础笔记四)The basics of how to use Linux (如何使用Linux,基础笔记四)

2. Display the current working directory, which show where we are at : “pwd”

e.g. The basics of how to use Linux (如何使用Linux,基础笔记四)

3. Change the current working directory : “cd”

The command, “cd”, can help us to navigate through Linux directories.
e.g.The basics of how to use Linux (如何使用Linux,基础笔记四)
3.1. Absolute pathname and Relative pathname
For the usage of “cd”, we have to introduce two concepts, “absolute pathname” and relative pathname.

Absolute pathname means the file’s name which a name contains paths from the root to the current directory and pulses the name of file.
e.g.
The basics of how to use Linux (如何使用Linux,基础笔记四)
Relative pathname involves the relationship between tow files, and it describes a location of one file which is relative to another file.

e.g.
The basics of how to use Linux (如何使用Linux,基础笔记四)
In the exampe above, the relative pathname(“linuxPractices/dir1”) involves tow files, the current directory(“local”) and the directory (dir1) which is under the “local/linuxPractices”, and we omit the current path.

3.2. Some tips

3.2.1. The “.” stands for the current directory
e.g.
The basics of how to use Linux (如何使用Linux,基础笔记四)
3.2.2. The “…” stands for the super (top) directory which contains the current directory.
e.g.
The basics of how to use Linux (如何使用Linux,基础笔记四)
The basics of how to use Linux (如何使用Linux,基础笔记四)
3.2.3. Some useful shortcuts
The basics of how to use Linux (如何使用Linux,基础笔记四)