Here are some of the two major points to know. The following is the point:
First, hardware, core, and Shell.
1. Hardware: Of course, your hardware is equipped.
2. Core management: The core of the operating system.
3. Application: Graphical interface software (this is the shell).
Second, why to learn the shell.
1. All Linux supports the shell.
2, Remote management: Shell command transmission very fast. (Video transmission under Windows is always captured, transmission speed is very slow)
3, want to be a high-end system administrator: Shell and shell scripts must learn.
Third, the legal shell and/etc/shells function of the system
1, Linux version of the system inside the common shell types (Query method: Shell) storage directory:/etc/shells
? · /bin/sh (has been replaced by/bin/bash)
? · /bin/bash (which is the Linux preset shell)
? · /bin/ksh (KornShell by T-Bell Lab. Developed, compatible with bash)
? · /bin/tcsh (full and C Shell, providing more features)
? · /BIN/CSH (has been replaced by/BIN/TCSH)
? · /bin/zsh (base and Ksh developed, is the more powerful shell)
2, some strange shell (such as:/etc/nologin) source
Sometimes the FTP site checks the user's available shells, and if you don't want them to use a host resource other than FTP,
May give the user some weird shell, which will make it impossible for users to log in to the host with other services. This time, you will have to
The weird shell was written in/etc/shells.
such as:/etc/nologin This file is a weird shell.
View SHELL:CAT/ETC/PASSWD of current work
3. Bash Shell Features
①, command editing ability: History
②, command and file completion function: Tab key
? [Tab] is followed by the first word of a string of commands, then the command completion
? When [Tab] is followed by the second word of a sequence of commands, the file is padded
③, command alias settings: Alias
Alias dd= ' Ls-al '
DD/MNT View the directory under MNT
④,
Programmatic Scripting: Bash script
Wildcard character: ll/usr/bin/x*
⑤, Query Bash Shell key command: Type cd
⑥, line wrapping for multiple commands and commands
The middle of a line of multiple commands is separated by semicolons:;
Multiple lines of a command, ending with \ separate: \
four, shell syntax;
1. Conversion of variables and variables;
Categories of variables: Local variables, environment variables, position variables, system variables
Shell switchover: Bash
View the current shell Id:echo $$
2, the Declaration and cancellation of variables, as well as precautions (general all variables);
Disclaimer: (export,declare) parameter variable name = value
Cancel: unset= variable name
Considerations for the definition:
① variable names can be underlined with alphanumeric characters, but cannot begin with numbers;
② equal to no spaces on either side, or quotation marks if there are spaces
3, the definition and reference of local variables;
Definition: variable name = value (keyword not previously required, direct variable name = value)
Reference:echo $ variable name
Note: In bash, when a volume name has not been set, the default content is empty;
4, the definition and reference of environment variables;
Defined:
Export variable name = value
Declare-x Variable name = value
Reference: Echo $ variable Name
The characteristics of environment variables: affect all child shells;
But will not affect the previous shell;
5, local variables and environment variables to view and transform;
View:
View all variables (local variables and environment variables):Set
View all environment variables: env, export, Export-p
Transformation:
Local variables--Environment variables:
The local variable yy is converted to an environment variable:
Export yy
Declare-x yy
Environment variables--Local variables:
environment variable ZZ Swap to local variable: declare +x ZZ
6, Position variable;
$----> represents the name of the script file
$#----> representative number of parameters
$*----> representative parameter list
$$
[Email protected]
$?
Difference Reference Blog: http://www.cnblogs.com/kaituorensheng/p/4002697.html
7, System variables;
System variables are generally uppercase.
When a system variable is assigned: it is assigned when the system is logged in.
Since the system variables are already set in the system, all we can refer to directly.
Method of reference: Echo $HOME
Echo $PATH
Echo $MACHINE
Echo $HISTFILESIZE (view the maximum number of command caches in the current system)
8. View the current encoding and current encoding supported by the system;
To view system-supported encodings: LOCAL-A
To view the encoding of the current system: Echo $LANG
One of the shell programming