Linux Operations Command (i)

Source: Internet
Author: User

Portal: https://www.shiyanlou.com/courses/running

First, Experiment introduction 1.1 experimental content

This experiment will introduce the use of the LS, CD, pwd commands in Linux commands.

1.2 Experimental Knowledge points
    • ls command
    • ADB command
    • PWD command
1.3 Experimental environment

The experimental environment used in the course is the Ubuntu Linux 14.04 64-bit version. The program is used in the experiment:

    • XFCE Terminal
Second, the experimental steps 2.1 ls command

The LS command is the most commonly used command under Linux, and the LS command is the abbreviation for list.

LS is used to print out a list of current directories. If LS specifies a different directory, then the list of files and folders in the specified directory is displayed.

The LS command not only allows you to view the files contained in a Linux folder, but also to view file permissions (including directories, folders, file permissions) to view directory information, and so on.

(1) command format

ls [options] [directory name]

(2) Common parameters

Parameters Description
-A –all lists all files under the directory, including the. The implied file at the beginning
-L In addition to file names, the file's permissions, owner, file size, and other information are listed in detail
-D –directory Displays the directory as a file, rather than displaying the file below it
-H –human-readable list file sizes in an easy-to-understand format (e.g. 1K 234M 2G)
-T Sort by file modification time

(3) Common examples

Example One: list all the files and directories under the/home folder, using the following command:

12 ls-al/home

The result of the above two commands is as follows:

Notice the red box above, D for the directory (directory), the file, and the colors for the files and directories to display differently.

Example Two: listing the contents of all files in the current directory that begin with "D", you can use the following command:

1 ls-l d*

example Three : the size of all the file directories in the/home directory in an easy-to-understand format, you can use the following command:

1 ls  -alh/home  

(4) Study questions

1. List the size of all file directories in the/home directory that begin with "D" in an easy-to-understand format.

2. List all directories in the/home directory that begin with "s".

2.2 CD command

The CD command can be said to be the most basic command in Linux, the other command statements to operate, are based on the use of the CD command. The CD command is the abbreviation for Change directory, which toggles the current directory to the specified directory.

(1) command format

CD [Directory name]

(2) Common examples

Example one: from the current directory into the system root, you can use the following command:

1 CD  /

Example two: from the current directory into the parent directory, you can use the following command:

1 CD.

.. Represents the parent directory

example three: from the current directory into the current user home directory, you can use the following command:

1 CD ~

~ Represents the current user home directory, note that it is not the same concept as the system root directory

example four: from the current directory into the last directory, you can use the following command:

1 CD-

-Indicates the last entered directory

2.3 pwd Command

In Linux, use the PWD command to view the full path to the current working directory. Simply put, you will have a current working directory every time you operate in a terminal. When unsure of the current location, PWD is used to determine the exact location of the current directory within the file system.

The PWD command is the abbreviation for Print working Directory.

(1) command format

PWD [Options]

(2) Common parameters

Parameters Description
-P Displays the actual physical path, not the link path
-L When the directory is a connection path, the connection path is displayed

(3) Common examples

Example one: show the path of the current directory, you can use the following command:

1 pwd

Example Two: display the physical path of the current directory, you can use the following command:

1 pwd-p

Example Three: display the current directory connection path, you can use the following command:

1 pwd-l

(4) Study questions

Linux Operations Command (i)

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: info-contact@alibabacloud.com 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.