Commands and special symbols in the shell

1. Record the command:!!! : Continuous "! "indicates that the last instruction was executed! N: Represents the second instruction in the execution of the command historyNote:! 2 actually shut me down.! String (string greater than 1) indicates the

Shell exercises (11)

Exercise 1:Statistics and summationRequirements: calculates the number of digits that appear in each row in document 1.txt and calculates a total of several numbers in the entire document.Reference Answer:#!/bin/bash# date:2018 March 6 sum=0for i in

Shell uses a small note

The shell is the preferred system administrator for its stability, efficiency and flexibility.1. Shell Introduction:Command line: Refers to the interface for the user to enter a command, which itself simply accepts input and then passes the command

Shell Introductory Learning--1 (draft version)

When we learn is the first to realize that we learn the shell is used to do what, it and other programming languages are different and advantages, do not blindly study, and finally do not know what the purpose of learning shell is to do. Let's start

Using the shell to do the Nginx log analysis

#!/bin/bashif [[$# = = 0]];thenecho "Error: Please enter the number of days to query???"Elseecho "Temporarily does not support the 7 version of CentOS!!! "now_time_cuo=date +%s((end_time_cuo=${now_time_cuo}- echo $1*3600*24 | bc ))Now_time=date |

01:shell Basic Use

1.1Write a login welcome script(1a new script file, welcome.sh, is used to output various monitoring information. [[Email protected]~]#vi/root/welcome.sh#!/bin/bashEcho"Number of open processes: $ (PS aux | wc-l)"Echo"number of logged-in users: $

Shell Exercises (vii)

Exercise 1:Statistics Log size If we need to execute the script you wrote every hour. In the script to implement such a function, when the time is 0 and 12 points, you need to empty the file under directory/data/log/, notice can only empty the

Shell exercises (eight)

Exercise 1: Monitoring disk usageRequirements: Write a shell script that detects all disk partition usage and inode usage and logs to a log file named after today's date, and notifies you when a partition capacity is found or the Inode usage is

Shell Script View Linux system performance bottlenecks (RPM)

Shell Script View Linux system performance bottlenecks (go to: http://blog.51cto.com/lizhenliang/1687612)[[email protected] ~]# cat show_sys_info.sh #!/bin/bash#os_check () {if [-e/etc/redhat-release]; then redhat= ' cat/etc/redhat-release |cut-d

Full-Library hot backup of shell scripts

#!/bin/bashbackup_dir=/oracle/backuplog_file= $ORACLE _base/admin/$ORACLE _sid/hold_backup_$oracle_sid.logecho   "Backuping cold backup"  > $log _filedata>> $log _filesqlplus -s /  As sysdba > $log _filealter database backup controlfile to   '

Bulk add users using the shell

Batch Create 10 system accounts (OLDBOY01-OLDBOY10), and set the password (password is random number, the requirement is a mix of characters and numbers)To create a random password:#echo $RANDOM | Cut-c 3-9and write the user name and password to a

Shell Learning Notes

First, Shell discussionSecond, the script execution modeCreate and open a shell scriptVim Hello. SHEdit#!/bin/Bash#-E allows echo to support Shell escape character echo"\e[1;34m First shell script \e[0m"Run#赋予权限, running (common) chmod 755 Hello. SH

Shell Exercises (v)

Exercise 1:Delete the letters in the textRequirements: Delete the line containing the letters in the first 5 lines of a text document and delete all the letters from 6 to 10 lines (file 1.txt, lines greater than 10 lines)Reference Answer:#!/bin/bash#

Logical judgment in the shell

1.if judgment① simple judgment, if the condition is met, return OK#!/bin/basha=5if [$a-gt 3]then echo "OK" fi[[email protected] test_shell]#./test.shok② two conditions, you can use elif and else#!/bin/basha=5if [$a-lt 3]then echo "Common symbols in

Shell Exercises (iii)

Exercise 1:Batch Change file nameRequirements: Find all files with the suffix. txt in the/123 directory Bulk Modify. txt to. txt.bak Package all. bak files into 123.tar.gz The name of the batch restore file, that is, to remove

Shell exercises (i)

Exercise 1: Generate a file every dayRequirements: please generate a daily file according to the date format (XXXX-XX-XX), for example, the file generated today is 2018-02-05.log, and write the disk usage to this file (do not consider Cron, just

Application practice of Shell array

Definition of shell array:Method 1: The variable value is assigned to the array variable with a small extension, and each variable value is separated by a space.The syntax is as follows:array= (value1 value2 value3 .... ) #常用Method 2: Enclose the

An array of special variable types in the shell

There are two types of data in the shell: one is a numeric type, the other is a string type , and although the shell itself is a weak type, it can be so distinguished.If we need to store multiple values in a variable in the shell, we need a more

An example of passing parameters in Shell programming and an example of shell Parameters

An example of passing parameters in Shell programming and an example of shell Parameters When executing a Shell script, we can pass parameters to the script. The parameter format obtained in the script is $ n. N indicates a number. 1 indicates the

Shell programming echo command usage instructions, shell programming echo command

Shell programming echo command usage instructions, shell programming echo command Shell echo commands are similar to PHP echo commands and are used to output values. We can use echo to implement more complex output format control.Show normal

Total Pages: 541 1 .... 512 513 514 515 516 .... 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.