Top of the Bash shell Command and monitor The last time we talked about the PS command, although the PS command is useful in collecting process information running on the system, but there are shortcomings, PS command can only display information
In this paper, the basic syntax of the shell is briefly recorded for future use!1. Shell variablesWhen you define a variable name without the dollar sign $, you only need to add the dollar sign before the variable name when using the variable. As1
First, about this article The monitoring system to be done requires monitoring the usage of disk space and alerting. When testing this feature, it is necessary to simulate two scenarios: one is the need to trigger the alarm mechanism when the disk
Very good!!Very good!!DeleteCTRL + D deletes the character at the cursor location equivalent to VIM x or DLCTRL + H deletes the character in front of the cursor, which corresponds to the HX or DH in vim.Ctrl + K Delete all characters after cursor
1.#!/bin/sh Use the SH program to execute the code below#!/bin/more output the code belowThe code below the #!/bin/executable will be used as input to this program2. * Can be used to match file names, regular matches, as multiplication. * * can also
Ctrl+u can delete rows under the shell, if this key doesn't work, try Ctrl+xCTRL + Z You can suspend a program without terminating the program, but you can suspend the program.This job can then be switched to the foreground by the FG commandCP
List of special variables
Variable
Meaning
$
File name of the current script
$n
Arguments passed to the script or function. N is a number that represents the first few parameters. For example,
Variable Description:$$The PID of the shell itself (ProcessID)$!PID of the Shell's last running background process$?End code of the last Run command (return value)$-Flag at a glance using the SET command$*All parameter lists. such as "$*" in the
The anti-quote bit (') is located above the TAB key of the keyboard, to the left of the 1 key. Note the difference between the single quotation mark (') on the left side of the ENTER key.Anti-quote bit (') plays the role of command substitution in
Occurs when a service command is executedShell-init:error Retrieving current Directory:getcwd:cannot access parent directories:no such file or directoryChdir:error Retrieving current Directory:getcwd:cannot access parent directories:no such file or
Exit statusThe built-in command in bash does not create a new process, but it also has the exit status, usually with 0 to indicate that a success nonzero indicates a failure, although the built-in command does not create a new process, but there is
0 indicates standard input1 indicates standard output2 indicates standard error output> default to standard output redirect, same as 1>2>&1 means redirecting the standard error output to the standard output.&>file means to redirect both the standard
One: Shell Programming basicsShell definition: The shell is a program that acts as an interface between a user and a Linux system. It allows the user to enter commands that need to be executed to the operating system. There are many shells in the
Original blog, reproduced please indicate the sourceThe shell is the command interpreter.See which shells are supported by this system1 Tab Command completionThis can be used almost every time, for example, I have a file called file.txt, if only one
Very powerful shell-written Tetris
On the Internet, you can see a Russian box written using linux shell scripts. It is the most awesome shell I have ever written. Share.
The original author information is included in the comments of the script.
:
Shell variables and shell Variables
Suppose we define a variable:File =/dir1/dir2/dir3/my.file.txt
You can replace $ {} with different values:$ {File # */}: Delete the first/and its left string: dir1/dir2/dir3/my.file.txt$ {File ### */}: Delete the
[Linux] shell, the application of anti-quotation marks ('), linuxshellThe quotation mark (') is located at the top of the Tab key of the keyboard and the left side of the key 1. Note the difference between it and the single quotation mark (') on the
Shell condition judgment1. if condition judgment: if [condition]; then do something fi multiple conditions: & represents AND | represents OR multiple judgments: if [condition]; then do something elif [condition 2]; then // do something else // do
Shell acronyms and judgment symbols []1. The test command is used to detect the file type and compare values. Determine whether a file exists:
[work@www sh]$ test -e file.txt && echo "exist" || echo "not exist" not exist[work@www sh]$
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.