Introduction to Linux Basic knowledge

Source: Internet
Author: User

1) Show Command history
Commands running in Linux are saved in the. bash_history file in the user's home directory, and 1000 command records are saved by default.
History Show Command Chronicle
!! Executes the previous command
!n Execute nth Command
!ls executes the last 1 commands that begin with LS

2) wildcards and other characters
* Match the prefix character to match 0 or more characters
+ Match the prefix character to match 1 or more characters
? Match any of 1 characters
# comment Characters
\ escape character, \ character followed by normal character
!$ last 1 variables in last command
~ User home directory, user home directory, root user home directory:/root, normal user home directory:/home/username
& put commands in the background to execute
REDIRECT Symbol
> redirect General information and overwrite to file >> redirect General information and append to file
2> REDIRECT error message and overwrite to file 2>> redirect error message and append to file
[] character or number combination, select a character or number from the range
; Command 1, Command 2, command 1, and command 2 All need to be executed.
&& Command 1&& Command 2 command 2 executes after command 1 executes successfully
|| Command 1| | Command 2 command 2 executes after command 1 fails

3) variables
Shell variables are generally uppercase, you can use the ENV command to view environment variables, and set commands to view all variables in the system.
directory where PATH holds the running program
Home User's home directory
Histsize History Command Record Count
LOGNAME User's login name
HOSTNAME Host Name
Shell type of shell user
LANG language configuration file storage directory
Mail Mail Store Directory
PWD current Directory

In/etc/profile, the variable is set and can be used by all logged-in users
In the. bashrc file in the user's home directory, set the variable that can only be used by that user
Variable definition: variable = variable value, there can be no space on both sides of the equal sign, the variable name can only contain letters, numbers and underscores, cannot start with a number, the variable contains special characters, you need to enclose a single quotation mark ("), if the value contains single quotation marks, you need to enclose the quotation mark (" " ) wrapped up.

Common system Configuration files:
The. Bash_profile user logs on when the file is executed, executed 1 times, and can be understood as: global variable configuration file.
. BASHRC user-specific files, each time you log in and open the shell, execute the file, which can be understood as: A variable profile for the user.
. bash_history files that record historical commands
When the. Bash_logout exits the shell, the file is executed

Introduction to Linux Basic knowledge

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.