Linux Notes General section Summary
Shell; child shell
Bash--bash
Bash
1. Command history, Command completion
2, Pipeline, redirect
3. Command aliases
4. Command line editing
5. Command line expansion
6. File name Wildcard
7. Variables
8. Programming
command-line editing:
Cursor Jump:
Ctrl + A: Skip to the beginning of the command
Ctrl+e: Jump to the end of the command line
Ctrl+u: Delete the cursor to the beginning of the command line
CTRL+K: Delete the cursor to the end of the command line
Ctrl+l: Clear Screen
Command history:
View command history: Historical
-C: Empty command history
-D OFFSET [n]: Delete command at specified position
-W Save the command history to the history file
Environment variables
Path: Command Search Path
History: Command historical buffer size default 1000 bar
For example:
[Email protected]~] #echo $HISTSIZE
1000
There's a ~/.bash_history in the Ls-a home directory.
The use of command history tips:
!n: Executes the nth command in the command history;
!-n: Executes the reciprocal nth command in the command history;
!! : Execution of the previous order;
!string: The most recent command in the command history that starts with a specified string
!$: Reference the last parameter of the previous command
Esc. (Indicates press ESC to release press.)
ALT +. (remote terminal not supported)
Command completion: Command start
PATH:
Path Completion: Path start
Command aliases:
Alias cmdalias= ' COMMAND [options] [arguments] '
Example Alias Cls=clear
Aliases defined in the shell are valid only for the current shell life cycle, and the valid range of aliases is only the current shell process;
Revoke aliases
Unalias Cmdalias
\cmdalias with the command itself
Command substitution: $ (command), anti-quote, ' command '
To replace a subcommand in a command with the process of executing the result
[[email protected] sysconfig] #echo "The current directory is $ (PWD)."
The current directory is/etc/sysconfig.
[[email protected]] #touch./file-$ (date +%f-%h-%m-%s). txt
File-2014-07-21-14-27-36.txt
Quotes supported by bash:
": Command substitution
"": weak reference, can implement variable substitution
': Strong reference, do not complete variable substitution
File name wildcard, globbing
*: Any character of any length
? : Any single character
[]: matches any single character within the specified range
[Abc],[a-m],[a-z],[a-z],[0-9],[a-za-z],[0-9a-za-z]
[: Space:] white space characters
[:p UNCT:] Punctuation
[: Lower:] lowercase letters
[: Upper:] Uppercase
[: Alpha:] uppercase and lowercase letters
[:d Igit:] Number
[: Alnum:] numbers and uppercase and lowercase letters
View Details
# Man 7 Glob
[^]: matches any single character outside the specified range
[[: Alpha:]]*[[:space:]]*[[:alpha:]]
LS [[: Alpha:]]*[[:space:]][[:alpha:]] Initial white letter
#################################################################
Users, Groups, permissions
Security context (Secure):
Permissions
R, W, X
File:
R: Readable, you can use similar commands such as cat to view the contents of the file;
W: writable, can edit or delete this file;
X: Executable, exacutable, can be at the command prompt as a command to submit to the kernel to run;
Directory:
R: You can perform LS on this directory to list all internal files;
W: Files can be created in this directory;
X: You can switch to this directory using a CD, or you can use Ls-l to view the details of the internal files;
Rwx
r--: Read-only
R-x: Read and Execute
---: No permissions
0---: No permissions
1 001--x: Execution
2 010-w-: Write
3 011-wx: Write and Execute
4 r--: Read-only
5 101 R-x: Read and Execute
6 rw-: Read and Write
7 111 rwx: Read and write execution
755:rwxr-xr-x
Rw-r-----: 640
#############################################################
Users: UID,/ETC/PASSWD
Group: Gid,/etc/group
Shadow Password:
Users:/etc/shadow
Group:/etc/gshadow
User Category:
Admin: ID 0
Normal User: 1-65535 (16-bit 2 binary)
System users: 1-499
General Users: 500-60000
User group Type:
Administrators group:
Normal Group:
System Group:
General Group:
User Group Category:
Private group: When a user is created, a group with the same name as the user name is automatically created if the group to which it belongs is not specified
Basic group: Default group for users
Additional groups, additional groups: groups other than the default group
Process: Tom Tom
Object: rwxtw-r--Jerry Tom A.txt
Tom:ls
Rwxr-xr-x Root Root/bin/ls
This is the security context (77 minutes)
################################################################################
Password file: 7 attributes for a user account
cat/etc/passwd
Whatis passwd View Chapter man document description
Mans 5 passwd
Account: Login Name
Password: password
UID: User ID
GID: Basic Group ID
Comment: note (GECOS)
Home dir: Home directory
Shell: User's default shell
/etc/shadow
Account: Login Name
Encrypted Password: encrypted password
Encryption method: (MD5)
Symmetric encryption: Encrypt and decrypt using the same password
Public Key cryptography: each password appears in pairs, one for the private key (secret key) and one for the public key
One-way encryption, hash encryption: Extracting data signatures, often used for data integrity checks
1. Avalanche effect
2, fixed-length output
Md5:message digest,128 fixed-length output
Sha1:secure Hash algorithm,160 bit fixed length output
SHA256 SHA512
Cases:
Cat/etc/shadow
Syslog:*:16014:0:99999:7:::
Messagebus:*:16014:0:99999:7:::
Sshd:*:16014:0:99999:7:::
Geb:$1$r8jv5.nz$qs5/5kjkv0.qdmglm3h0n1:16014:0:99999:7:::
Second field * or!! Indicates a lock
Third field $r8jv5.nz$ for impurities
Text processing: Cat, more, less, head, tail, cut, sort, uniq, grep
Regular expressions
Pipelines and redirects:> < >> <<
This article is from the "View hardware under Linux" blog, so be sure to keep this source http://4285797.blog.51cto.com/4275797/1585389
Linux Notes General section summary (to be continued)