Today see the system space is occupied, and then look at large files, found that Catalina.out has been >60g, there are many solutions online, but still want to learn to write a shell script to deal with, in this record to write content, as well as
-CP and-classpath Specify the paths of other classes that the class runs on, usually the class library, the jar pack, and so on
Windows semicolon ";" separated by semicolons on Linux: "Delimited." Use a little "." Represents the current path
SET Command
The set command acts primarily to display shell variables that already exist in the system, and to set new variable values for shell variables. When you use set to change shell attributes, the function of the symbol "+" and "-" is to
How to implement the line content code to remove the file * * *:If you only want to see the first 5 lines of the file, you can use the Head command,such as: Head-5/etc/passwdIf you want to view the following 10 lines of the file, you can use the
Ideas:
1, back up yesterday's log, while deleting the five days before the backup data.
2, copy the log file, and set the original log file is empty
Shell
#!/bin/bash
#function: Cut nginx log files
#author Kung
log_path= '/home/wwwlogs/'
Echo is similar to the LS command. Many functions can be implemented through regular expressions.
For example, we can use echo. * To display all the files under the current folder, but by using echo-d. [!.]? * You can remove the current
~ Represents the current user's root directory/home/username/
/represents all the root directory
. Represents the current directory
Copy files:1. Copy Local files to remoteSCP filename User name @ computer IP: remote path2. Copy files back to local
#。 The first sentence in the footsteps, indicating the program used to execute the script
Example: #!/bin/bash
# comments, for help information or for ignoring statements that are temporarily not executed
# This is a comment
$ variable
#!/bin/bash
# This are a Shell script to find the files created by today
#
# Usage are:
#
# test.sh
#
function Recurce ()
{
CD is #进入该目录 for
file in *; #对目录中的每一个文件都逐一检查
do
if [d "$file"]; then
Shell Secript:Differences in execution modes:The./sh execution is performed in the creation of a subroutine that only inherits the environment variables,If the export declares that the subroutine's subroutine will inherit, it will not be promoted to
List of special variables
variables
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
Today I received a request that a string be included in the result of the script execution and asked to find out.The idea I gave was to write the text in an appended way according to the name of the script and the result, and then find the
1. Command-line parameters------similar to javac parameter 1 parameter 2Java-like compiled Javac parm1 ..... In the shell, the arguments are separated from the arguments by a space. Use positional parameters to identify corresponding parameter
seq 1 100The notation of the seriesWc-l count Rows-C bytes-W wordsbasename returns a basic file name for a stringDirName leave the non-directory part except the file nameRead-p "" Name prints a hint and waits for input input information to be given
In the Linux shell, often input commands have a lot of similarities, even the same, if the long command, the efficiency is really very low, but can be through ctl+r, find the history of the previous input commands, it is very useful.After pressing
PM2:Start ----- pm2 Start/bin/www-watch stop ----- pm2 Stop app_name| app_id Display LogView port occupancy and force the release of occupied portsSometimes when the software is turned off, the background process dies, causing the port to be
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.