Fast learning -Linux commonly used simple instructions

1, a simple command

1.1, ls command

Syntax 1: #ls [Path]

Representation list the names of folders and files in the specified directory, if the path is not specified lists (list) in the current directory
, for example: Enter the ls command in root user's home directory, you will see the following results:

Here Insert Picture Description
Requirements listed / home of the name of the document.

#ls /home

Here Insert Picture Description

Syntax 2: #ls -l [path]

Representation list the names of folders and files in the specified directory in a list
such as: use ls -l command lists the current user's home directory folder and file information
Here Insert Picture Description

Syntax 3: #ls -la [path]

Represents the list of folders and files in the specified path name in a list (containing hidden files, all)
such as: Enter the ls -la command in the current user's home directory, you can see all the folders and file names, and includes hidden files (based on the characteristics of the beginning of the name ".")
Here Insert Picture Description
Note: If a command has multiple options, under normal circumstances (+ 95%) did not ask for the order option, before whom who freely after. But in order to avoid confusion as recommended by the notes in order to remember.

Under Linux strict case-sensitive.

1.2, clear instructions

Meaning indicated: Clear All command (and its essence is not empty, just to go above the top) the current screen

Syntax: #clear

Here Insert Picture Description
Equivalent to shortcut: ctrl + L

Clear instructions called the Windows cmd: cls

1.3, su command

Action: switch user (switch user).
Syntax: #su need to switch to the user name (user name can not write, then switch to the root user)
For example:
1, switching from the root user to linux123 user.

#su linux123

Here Insert Picture Description
2, the user to switch from linux123 root.

#su root

Here Insert Picture Description
Equivalent to:

#su

Discovered by operation of a conclusion of the above two commands:
When switching to the user rights if lower than the current user's rights may be directly switched without a password; the other hand, if the corresponding low to high input switching is required to be switched to the account from password (senior privilege account password).

Will not have to enter a password when prompted for any input, you can press Enter after input is complete, if wrong, you can press Enter to re-enter, or hold down the backspace key more than three seconds, and then re-enter.

1.4, cd command

Role: Change directory (change directory).
Syntax: #cd need to switch to the path (the path may be a relative path, or an absolute path) path can write can not write, do not write it means to switch to the current user's home directory (one-click back to the city).
E.g:

1, switching from the root directory to the user's home the user's home directory linux123

#cd /home/linux123

Tip: Open a file in the switch path or late when you can use the tab key recommendations (to automatically complete the command path).

2, a user switches to switch linux123 user, then switch to the home directory of the root from the cd user's home directory linux123

Here Insert Picture Description
Conclusion: The low-level users have access to resources (rights) related to advanced users.

About path:
the path is divided into relative and absolute paths.
Relative paths are relative to the current path is a form of expression.
Features: As long as the "/" is the beginning of a relative path.
Absolute path is a path directly from the form of the "root" began.
Features: The path "/" at the beginning of the call absolute path.

/root/a/b/c
root/a/b/c
./root/a/b/c
../root/a/b/c

Case: switching from the root directory to the user's home linux123 user's home directory, it is required to write in the form of a relative path.
Here Insert Picture Description

1.5, pwd command

Role: Print the current working directory (print working directory).
For example: Use the pwd command in the current user's home directory.
Here Insert Picture Description

Released 1950 original articles · won praise 2067 · Views 180,000 +

Guess you like

Origin blog.csdn.net/weixin_42528266/article/details/105146997