For people who are new to Linux, or who want to re-examine or improve their understanding of basic Linux concepts (such as copying and moving files, creating symbols and hard links, setting file system object ownership and permissions, and using standard text processing commands for Linux with pipes and redirects), One of the serial articles in this series is the ideal textbook. In this direction, we will share a lot of ideas, tips, and tricks to make the tutorial "Flesh and Blood" and practical, even for experienced Linux veterans.
Many of the articles in this series are novel to beginners, and more experienced Linux users may find this tutorial an effective way to "get the most out of their basic Linux skills".
Introducing Bash
Shell
If you've ever used a Linux system, you know that when you log in, you'll see a prompt like this:
$
The special prompts you see may look very different. It may contain the host name of the system, the current working directory name, or both. But whatever this particular cue looks like, one thing is for sure. The program that prints out this prompt is called "shell," and most likely your special shell is a program called Bash.
Are you running bash?
You can check to see if you are running bash by entering the following command:
$ echo $SHELL
/bin/bash
If the command line above complains or does not respond similarly to our example, you may be running a shell that is different from bash.
About Bash
BASH is the acronym for the "Bourne-again Shell", which is the default shell for most Linux systems. The Shell's task is to execute your commands, enabling you to interact with the Linux system. When you have finished losing the command, you can notify the shell to execute the exit or logout command, where you will return to the login prompt. Incidentally, you can also log off by pressing control-d at the bash prompt.
Using the CD
You may have found that staring at the bash prompt is not the most exciting thing in the world. So let's start with bash to browse our file system. At the prompt, enter the following command (excluding $):
$ cd /
We only tell bash that you want to work in/(also known as the root directory); All directories on the system form a tree,/is considered the top of the tree, or it is the root. The CD sets the directory that you are currently working on, also known as the current working directory.
Path
To see Bash's current working directory, you can enter:
$ pwd
/
In the example above, the CD/parameter is called the path. It tells the CD where we're going to go. In particular, the/parameter is an absolute path, meaning that it specifies the location relative to the root of the file system tree. Absolute path Here are a few other absolute paths:
/dev
/usr
/usr/bin
/usr/local/bin
As you can see, all absolute paths have one thing in common: they all start with/. Through the path/usr/local/bin, we tell the CD to enter/directory, then enter the USR directory under this directory, and then enter the local and bin. Absolute paths are always judged by whether or not they begin with/.