A growing diary of Yun-Xiao-bai (m20-1 2016.7.22)

Source: Internet
Author: User
Tags echo command

    1. Screen command:

Open a new screen:screen-s [SESSION]

Join session: Screen-x [Session]

Exit and Close Screen:exit

Stripping Current Screen:ctrl+a,d

Show all open Screen:screen ls

Restore a screen:screen-r [SESSION]

Focus:

(1) When using the system only one screen request, directly using the Screen-x direct connection to help

(2) When using a system with multiple screen requests, you must use Screen-x [SESSION] to help

If the requested name is different, directly indicate the screen name that needs to be connected

If the request name is the same or similar, indicate the screen name that needs to be connected and the process number of the PID in front of the process

(3) For the system backup time long, run long command, it is recommended to first turn on screen, after execution, to prevent the current shell to break the network, etc., resulting in loss of data and errors.

(4) When using the join session is recommended to directly use the program's PID to connect.

(5) When the user's request [SESSION] is a number, it is recommended to use the user's PID direct connection, reduce the generation of errors.

(6) When there are multiple session requests on the system, it is recommended to connect directly with the PID in front of the user session.

2.echo command:

Function: Display characters

Syntax: Echo [-nee][string]

Description: Echo will send the input string to standard output. The output string is separated by a white space character, and a newline number is added at the end

echo "$VAR _name": variable is replaced, double quotation mark table weak reference

Echo ' $VAR _name ': variable does not replace, strong reference

$echo –e "Enter the file name: \c"

Echo needs to print the escape character using the-e parameter.

echo Command options:

-N does not wrap characters at the end of the line

-E If the following character appears in the string, it is handled in particular, not as a general text output:

\a issued a warning sound;

\b Backspace key

\c finally not add the line break symbol;

\ n Wraps and the cursor moves to the beginning of the line;

\ r The cursor moves to the beginning of the line, but does not wrap;

\ t Insert tab;

\ \ insert \ character;

\0NNN insert ASCII character represented by NNN (octal)

Echo-e "\033[43;31mred color\033[0m"

\XHH Insert the ASCII represented by HH (hex)

Background color problem:

\e[40m--\e[47m Set background color
\e[40m setting the background color to black
\e[41m setting the background color to red
\e[42m setting the background color to green
\e[43m setting the background color to light red
\e[44m set the background color to blue
\e[45m set the background color to purple
\e[46m setting the background color to light blue
\e[47m setting the background color to gray

Font Color issues:

\e[30m change the display color of a character to black
\e[31m change the display color of a character to red
\e[32m change the display color of a character to green
\e[33m change the display color of a character to light red
\e[34m change the display color of a character to blue
\e[35m change the display color of a character to purple
\e[36m change the display color of a character to light blue
\e[37m change the display color of a character to Gray

3. Knowledge of command history

The user enters the command's history profile under the user's home directory. Bash_history

When the system is used, the command is stored in memory, and the history can be written to the user's home directory only when the user logs off or shuts down.

4. Generate a Whatis database

CentOS7 mandb

CentOS6 Makewhatis

5.TAB Key Completion:

A. Command completion

Internal command: Use the TAB key to complete the command directly;

External command: Bash searches for a file named after a given command name from the left and right, based on the path defined by the PATH environment variable, and the first command found is the command to be executed the user is given a string with only a single corresponding command, which is directly complete; otherwise, tab will give the list

B. Path completion

Take the user-given string as the beginning of the path and search under its specified parent directory for the file name that begins with the specified string if it is unique: directly complements; otherwise: tab to list again

Note: CentOS6 does not support the TAB key for the command long option, CENTOS7 supports the long option of the tab completion command

6. The execution process of the command:

When the command executes, the command is looked up from $path, and then executed,

centos6.x:

/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

centos7.x:

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin

Note: After executing a command, the cache is saved, and the command is executed again, first read from the cache;

If the cache is not emptied, read directly from the cache and execute the command directly;

If the cache is emptied, you need to re-query the file where the command is located from $path and then execute

Whereis command: View the location of the commands and the location of the Help files

7. A few small points of knowledge about the system:

View Host Name: hostname

View the version of the system: Lsb_release equivalent to Cat/etc/centos-release

Hide the version of the system, modify/etc/centos-release

The user's logon configuration file/etc/issue

Refresh the user's login interface command line under the prompt interface, ctrl+d

View the kernel version uname-r

8.Linux Philosophical thought:

Everything is a file (including hardware)

Small, single-use programs

Link programs to accomplish complex tasks together

Avoid confusing user interfaces

Configuration data is stored in text

9.Linux virtual terminal, switch CentOS6 and CentOS7 using ctrl+alt+ (F1---F6)

If GUI graphical interface is installed, F1 is GUI graphical interface, F2-F6 is 5 CLI command line interface

If GUI graphical interface is not installed, F1-f6 is a 6 CLI command line interface

CentOS5 f1-f6 for CLI command line interface, F7 GUI graphical interface

CHVT CLI and GUI input switch to each other, can only be used in this machine, remote cannot be used

10. View the Mount condition DF

Filesystem 1k-blocks used Available use% mounted on

/dev/sda2 100660656 4932516 90608140 6%/

Tmpfs 436532 436456 1%/DEV/SHM

/DEV/SDA1 194241 39147 144854 22%/boot

/dev/sda3 20027260 331052 18672208 2%/testdir

/dev/sr0 3824484 3824484 0 100%/media/centos_6.8_final

11. Install VMware Tools:

Select the virtual machine option on the VMware virtual machine to install VMware Tools

Cd/media/vmware\ TOOLS/CD to the folder where the VMware Tools CD is mounted

LS View the contents of the/media/vmware Tools folder below

CP vmwaretools-10.0.0-2977863.tar.gz/testdir/ copies the compressed packages from VMware tools to the/testdir

Cd/testdir CD to the folder after the file has been copied/testdir

LS to see if this file is copied.

Tar xvf vmwaretools-10.0.0-2977863.tar.gz Unzip the files that we've copied. VMware Tools folders

LS View there is no decompression completely

CD vmware-tools-distrib/into the folder we just unzipped.

LS View the Vmware-tools-distrib after decompression, find the vmware-install.pl program that you want to see installed

./vmware-install.pl d for the installation of VMware tools (d for everything to be installed by default with the software installed)

12. Related knowledge points for command aliases:

Alias command: View the commands alias

Unalias command: To cancel an alias

Alias command= ' NEW command ': Defining aliases for commands

Note: The method of using the original command

/usr/bin/command directly indicates that the command

\command using the backslash + command

' Command ' double quotes inside add commands

13. Level of command execution: aliases > Internal commands > Cache external > External commands

14. The knowledge point of the clock:

Clock: Display hardware clock

-s:--hctosys: Calibration of the system clock, whichever is the hardware clock

-W:--SYSTOHC: Calibration of hardware clocks, whichever is the system time



A growing diary of Yun-Xiao-bai (m20-1 2016.7.22)

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.