Common Shell (Backup database, backup site, cut access log)

Back up your Web program#!/bin/bash/bin/tar czf/mnt/backup_website/web_$ (date +%y%m%d_%h%m%s). Gz. tar /mnt/wwwroot/web/mnt/backup_websitefind . -mtime +1"*20[1-9][3-9]*"xargsrm - 0Backing Up the

Linux shell command

Alias:Alias ll= "Ls-l"Steps to find the command: If you are using a relative command (such as./command directly executing the command file in the current directory), locate the file directly in the current directory and execute it. Absolute

A few common shell

Different shells have different functions, the shell also determines the syntax of the function in the script, the default shell in Linux is/bin/bash, the popular shell has ash, bash, Ksh, CSH, zsh, and so on, different shells have their own

Shell CPU Utilization Memory utilization

#!/bin/bashcpu_usage_idle= ' Top-b-N 1 | grep Cpu | awk ' {print $} ' | Cut-f 1-d "." ' Let cpu_usage=100-$cpu _usage_idlemem_total= ' awk '/memtotal/{total=$2}/memfree/{free=$2}end{print (total-free)/ 1024x768} '/proc/meminfo ' mem_usage= ' echo

shell--special position parameter variables and common built-in variables

Special positional parameter variables in 1.shell$: Gets the file name of the currently executing shell script, including the script path if the execution script contains a path$n: Gets the nth parameter of the currently executing shell script, n=1..

Write your own shell command of LS

The C language implementation of the LS command under Linux (supports-R-parameters):#include #include #include #include #include #include #include void Do_ls (char *), void Do_stat (char *,char *); void Show_ File_info (char *,struct stat

The most basic syntax for bash shell

1 Basic composition of shell statementsThe shell is separated by a space between each basic constituent element.For example, [-E file],[,-E, file,] these four basic elements are separated by a space.Same reason [!-e file],[,! ,-E, file,] each of

Post a shell for reference

1#! /bin/Bash2deploy_path=$ (CD"$ (dirname"$0")";pwd)3ini_file= $DEPLOY _path'/cnedmp_etl.ini'4 . $INI _file5base_path=$ (CD"$ (dirname"$DEPLOY _path")";pwd)6main_path=$ (CD"$ (dirname"$BASE _path")";pwd)7Currrent_date= 'Date-U +\%y\%m\%d

Encrypt a shell script

Automated maintenance of the system with shell scripts is simple, convenient and portable.But shell scripts are read-write and are likely to leak sensitive information, such as usernames, passwords, paths, IP, and so on.Similarly, sensitive

Shell scripting correlation, floating point, looping

Put a bunch of commands in the script into executable script execution;Script, file name is. SH, get hostname host nameSystem variables:ENV: View System VariablesSet: All variables can be printed with grep andExport path: Define Global variables

An obscure shell command

1. REDIRECT Symbol> Output redirected to a file or device overwriting the original file>! Output redirected to a file or device forcing overwriting of the original file>> output redirected to a file or device to append the original file2. Standard

shell-4-Let the text fly

1. Regular expressions ^ Line Start flag $ End of line Mark . Match any one character [ ] Match any one of the characterscontained in [ character ] ,Coo[kl] matches Cook or

Shell Regular expression (1)

First, what is the regularA regular is a way to describe a character or string by combining symbols with special meanings, called regular expressions. Or, the regular is the rule used to describe a class of things.Second, grep1. Parameters-N: Show

Use of read in the shell

read [parameter] [variable name]Read-p "Please input a number:" VarRead-t 10-p "Please input a number:" Var#!/bin/shWhile TrueDoRead-t 10-p "Please input number:" A BExpr $a + 0 >/dev/null 2>&1[$?-ne 0] && continueExpr $b + 0 >/dev/null 2>&1[$?-ne 0]

Shell Scripts-Conditional statements, case statements, function functions

Change the previous code1. Infer if it is hello, and if so, it shows "Hello, how is it?" ;2. Assume that no number of parameters is added or not. The method that prompts the user to be required to use the number of parameters.3. Assuming that the

Shell Script 1.1

#环境变量Echo $HOSTNAME #主机名Echo $SHELL #目前用的哪个解释器Echo $PATH #命令搜索路径Echo $USER #使用的哪个用户Echo $PWD #当前目录Echo $HOME #家目录是哪个Echo $LOGNAME #哪个用户# positional variablesEchoecho $Echoecho $Echo $* #显示所有位置值Echo $# #显示位置值的总数量echo $$ # Process number PID of the

What is a shell?

" What is Shell "Simple understanding, is the system with the computer hardware to use intermediate media, it is only a tool of the system. In fact, there is a layer of stuff between the shell and the computer hardware that is the system kernel. For

Shell Script whitespace specification

Shell Script whitespace specificationPractice, write a script:Pass a user name parameter to the script to determine if the user's user name matches the group name of their base group, and displays the results#!/bin/bash#if! ID $ &>/dev/null;thenecho

Environment Variables-linux command line and Shell script programming encyclopedia

Environment Variables Section:1. View Global variables: printenv/env2. Displays the value of a single environment variable: Echo as Echo $HOME3. Display all environment variables set for a particular process: set4. Setting global variables: Creating

Python3 determine if the process exists in the shell && start && Email notifications

Determine if the process existsdefisrunning (process_name):Try: Process= Len (Os.popen ('PS aux | grep "'+ Process_name +'" | Grep-v grep'). ReadLines ())ifProcess >= 1: returnTrueElse: returnFalseexcept: Print("Check

Total Pages: 541 1 .... 319 320 321 322 323 .... 541 Go to: GO

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.