Linux entry command (cd ls pwd ...)

Reference Catalog for Linux learning sequence: https: //www.cnblogs.com/lv1572407/p/11815911.html

 

  This chapter we learn some of the entry-level common commands it. Less frequently used commands are included, what does?

1. pwd command
First let us use what pwd command.
[root @ mysql1 ~] # cd / etc / sysconfig / Network-scripts /
[root @ mysql1 Network-scripts] # pwd
/ etc / sysconfig / Network-scripts
where we presented in two commands that basename and dirname.
[mysql1 the root @ ~] # the basename / etc / sysconfig / Network-scripts / the ifcfg-eth0
the ifcfg-eth0
[mysql1 the root @ ~] # dirname / etc / sysconfig / Network-scripts / the ifcfg-eth0
/ etc / sysconfig / Network- scripts
tips1: these two commands in normal operation is rarely used, but in a shell script, it was a commonly used commands.

2. cd command
Next we come to learn about the cd command.
[root @ mysql1 usr] # cd / etc / sysconfig / network-scripts / // specify the path to be switched, the absolute path can be a relative path
[root @ mysql1 network-scripts] # cd - // returns the directory on the occurrence
/ usr
[root @ mysql1 usr] # cd
[root @ mysql1 ~] #
After completing cd's underlying operating, we have to talk about what is the absolute path, what is the relative path.
After a long study, all personally I think that the path can be a relative path.
The only difference is the relative path is based on the current path, and the path is the root of the absolute basis.

3. ls command
After reading pwd and cd commands, we learn about the ls command. ls command is used to traverse the object in the specified directory.
By with different parameters, a different view details. Next we come to learn about common options.
[root @ mysql1 ~] # ls -a / dir1000 / Show hidden files and directories containing hidden files.
. .. the httpd.conf
[mysql1 the root @ ~] -l # LS / dir1000 / length format details of files and directories.
-R & lt -rw -. 34445 r-- On Jun. 1 the root 12 is the root 04:09 the httpd.conf
[mysql1 the root @ ~] -LH LS # / dir1000 / humanized file and directory display size.
-R & lt -rw -. r-- On Jun. 1 the root 12 is the root 34K 04:09 the httpd.conf
[mysql1 the root @ ~] # -ld LS / dir1000 / display detailed information directories.
XR-X-drwxr. 2 the root 12 is the root On Jun 4096 04:09 / dir1000 /
[the root mysql1 @ ~] # LS -Li / dir1000 / display inode number of files and directories.
661664 -rw-r - r-- 1 root root 34445 Jun 12 04:09 httpd.conf.
Entirety under [root @ mysql1 ~] # ls -R / dir1000 / recursive directory and directory display.
/ dir1000 /:
the httpd.conf
[mysql1 the root @ ~] -l --full-LS # Time / dir1000 / humanized document display time is displayed.
.-R & lt -rw - r--. 1 the root the root 34445 2019-06-12 04: 09: 05.369258040 +0800 the httpd.conf
Tips1: -l ls parameters most commonly used, -d, -R. The --full-time parameter is prepared for the bad English people.
tips2: Like -h, -d, -i and other parameters, usually used in conjunction with the -l parameter.

4. history command
history command to view the command history, command history to see all the time to use.
[root @ mysql1 ~] # history
above command which commands can be used to view these used commands on the one hand is in memory, on the other hand is present in the command history file.
Let's learn basic command usage history and common parameters.
[root @ mysql1 ~] # history -c // clear, for history command to clear the cache.
[root @ mysql1 ~] # history -a // append, append to the current session history command history file.
[root @ mysql1 ~] # history -r // read, reading history file command to the cache.
[root @ mysql1 ~] # history -w // write, write command overwrites the current cache history to the history command file.
In fact, the above-mentioned parameters, just for the purpose of understanding, in the actual environment is basically not used. Just remember history can be commonly used.

It is found in the use of command history, some commands have full time, and some can only display the most recent five commands. In fact, these are configurable.
The reason why such a configuration is relatively safe. For example: an operator may be positioned logged events; shows the number shown to prevent leakage of sensitive information.
Next, bring a little extended knowledge for everyone, history configuration:
HISTFILE command history file location (the current default home directory)
HISTFILESIZE command history file records the number of
HISTSIZE command history number of records (the default is 1000)
HISTTIMEFORMAT = " % F% T "command execution time history of
HISTIGNORE =" str1: str2 "ignores the specified history commands
HISTCONTROL contains the following four parameters options
ignoredups ignored repeated commands, and the same continuous the session
ignorespace ignore a blank at the beginning of the command
ignoreboth: specify above two values separated by commas intermediate.
erasedups remove duplicate history command
which personally think that the more commonly used HISTSIZE, HISTFILESIZE and HISTTIMEFORMAT.

Guess you like

Origin www.cnblogs.com/lv1572407/p/11815981.html