This article describes the underlying file operations: Create, move, edit, delete files and foldersCommand and Case:mkdir Creating a Directory--Create two directories[Email protected]:~$ mkdir test2 test3--Create a new directory under Test1
Mission Requirements: Managing/USR/LOCAL/PHP7/SBIN/PHP-FPM-C in the simplest way/usr/local/php7/etc/php.ini This command includes starting a stop restartUsing technology: Shell Scripting Chkconfig Service ManagementImplementation process:1. Create a
#!/bin/sh# defines a function that checks the operating system version num_version=$ (UNAME-R) function check_os () {[[ $NUM _version =~ el6 ]] && return 0| | return 1}echo "##### #CPU使用情况 ######" cpu_hardware=$ (cat /proc/cpuinfo | grep name
1. What is a scriptThe shell script is actually a plain text document, we can edit this document, and then let this file Help usExecute more than one instruction at a time, or achieve some specific functionality.To install a certain logical
1. How shell scripts runCreate shell script files, usually ending with. SH (e.g. example.sh)The shell script works as follows:
Add ' x ' Execute permissions (relative or absolute path execution)
To invoke a script file using the bash or
For CentOS 7, run the following command with root user root :Cd/etc/yum.repos.d/wget Https://download.opensuse.org/repositories/shells:fish:release:2/CentOS_7/shells:fish: Release:2.repoyum Install FishFor CentOS 6, run the following command with
First, the script formatVim shell.sh#!/bin/bash//Declaration script interpreter, this ' # ' is not a comment, the rest is a comment#Program://program Content description#History://Time and authorIi. Types of Shell variablesUser-defined variables:
Shell Script Programming Syntax:Note:Article source http://www.cnblogs.com/yunquan/p/6821850.htmlVideo Source: https://www.bilibili.com/video/av10565321/index_1.html?t=684Each statement here must have a space control, or syntax error 1. file format以.
[[email protected] ~]# cut-d:-F 3/etc/passwd-d: delimiter-F plus number paragraph F is the first paragraph012[[email protected] ~]# cut-d:-F 3,4,5,6,7/etc/passwd can choose a few more paragraphs plus, you
I. Network management
Temporarily Modify network configuration
Modify IP Address
Ifconfig NIC name IP address
Modify DNS
vim/etc/resolv.conf: Modify nameserver DNS Address
Requirements: Query all files under a folder, change the file modification time to less than the current time, and be larger than the current time the previous day of the file backup to another server corresponding to the folderIdeas:1, recursive
1: What is Shell???
(1) The shell is an interface that the user interacts with the kernel, and the most popular shell is now called the Bash shell(2) The shell is also a programming language (3) A system can have more than one shell, you
Shell scripting is a very important "program" in Linux.
What shell script?
A shell script is an executable statement that is designed ahead of time to complete a particular task's file.Shell scripts can be divided into interactive and
ENGINEER1.4Shell Script BasicsUnderstanding the shell environmentHow bash shells are usedInteractive:--manual intervention, high degree of intelligence----explain execution by article, low efficiencyNon-interactive:-Need to design in advance, the
The steps are as follows: Vim ~/.bash_profile (no tube. Bash_profile This file has several, own new one is also possible) at the end add Export ps1= ' [\[email protected]\h \w]\$ ' Then execute the source ~/.bash_profile so the shell can display the
1. Count the number of files in the current folderLs-l |grep "^-" |wc-l2 . Count the number of directories under the current folderLs-l |grep "^d" |wc-l3. count the number of files in the current folder, including subfoldersLs-lr|grep "^-" |wc-l4.
In the first two articles, we have mastered some of the basic syntax of the shell, the use of variables, and the operation of basic data types. So this time we will learn the shell's structured commands, which are conditional selection statements
Statistical analysis of log files in the number of accesses per IP and sorted from high to low?Download the file to a local suffix#!/bin/bashawk? ' {print?$1} '? ip.log?|? Sort?|? Uniq?-c?|? Sort?-rn?|? MoreSh-x uniqip.sh?+ awk ' {print $} ' Ip.log+
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