The use of the Linux Basic instruction command

Source: Internet
Author: User
Tags root directory linux

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


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

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.


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:


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/.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.