Since the use of Mac after the various configurations, the premise of this article is to use Tmux friends, introduce a god plugin zsh, first of all why use it:
Crtl + Z Displays the PID of the process when the process is suspended, so that
The recently built SVN service does not know why the service is always turned off (if you do not know how to build SVN can refer to the SVN version control software under Linux ), so a daemon is implemented with shell scripts. Used to monitor if the
First name the shell command as a. sh fileSave the above code as test.sh and CD to the appropriate directory:chmod +x./test.sh #使脚本具有执行权限./test.sh #执行脚本If an error/bin/bash^m:bad interpreter:no such file or directoryOne of the reasons for the
Hardware Chapter
CPU-related
Lscpu #查看的是cpu的统计信息. Cat/proc/cpuinfo #查看CPU信息详细信息, such as the model of each CPU, frequency, etc.
Memory-related
Free-m #概要查看内存情况 The unit here is
Shell command and Process ControlThere are three types of commands that can be used in shell scripts:1) Unix command:Although you can use any Unix command in a shell script, there are some relatively common commands. These commands are usually used
The shell is a command interpreter that provides interaction between the user and the operating system for a non-interactive interface that is oriented to the command line. The user enters commands at the command line, the shell interprets them, and
1.shell between the operating system and the user. Responsible for interpreting the command line2./etc/shells Record login system effectively supports Shell3./ETC/PASSWD Finally, someone who can see the user's default shell4. Directly enter the name
In the shell, arguments can be passed to a function when it is called. Inside the function body, the value of the parameter is obtained in the form of a $n, for example, $ $ for the first argument, and $ = for the second argument ...Examples of
-mtime 0 represents files that are currently 0 days away from the file modification time, which is less than 1 days (24 hours) away from the current time.-mtime 1 is a file that is currently 1 days away from the file modification time, which is 1
FunctionCase One :#!/bin/bashHello () {echo "Hahahah"}HelloExecutes the function with the result : hahahaCase two :#!/bin/bashFunwithreturn (){echo "The function is to get the sum of the number"Read-p "Input first number" NUM1Read-p "Input second
About redirectsAdditional redirection operatorsUse set-c collocation Posix shell : execute set -c command to open shell The so-called forbidden override option simple > redirect encountered when the destination file already exists
4. Input and output#! /bin/bash# Read users input and then get his nameread"Please input your first name: " firstNameread"Please input your last name: " lastNameecho-e"Your full name is: $firstName $lastName"Read usage:read[-ers][-a 数组][-d
Structure of this article: Bash shell Introduction--variables and variable operations, array-->bash Environment profile analysis
What is a shell:
Operating system is a set of software to control the entire hardware and management
grep is a powerful text-search tool that uses regular expressions to search for text and print matching lines grep [option] [mode] [file]-C #只输出匹配行的数量-I. #搜索时忽略大小写-H #查询多文件时不显示文件名-L #只列出符合匹配的文件名 instead of listing specific matching rows-N#列出所有的匹配行
Listen to people say that text classification when processing 100G text files, incredibly without big data, processing method is to use the shell split to split into a number of small files.Split commandNAME split-split a file into Piecessynopsis
Shell Script (ii)#find查找文件 to find based on time, name, UID, GID, permissions, size, etc.A file or directory accessed within #-amin-10:10 minutes; a file or directory accessed +10:10 minutes ago. The time unit is minutes.#查找10分钟之前30分钟之内访问过的文件或目录Find/
Suppose we define a variable as:File=/dir1/dir2/dir3/my.file.txtDifferent values can be replaced with ${}, respectively:${file#*/}: Delete the first/its left string: dir1/dir2/dir3/my.file.txt${file##*/}: Remove the last/and left string: my.file.txt$
Solution: show only-bash-4.1 in shell command line # Do not show users and pathsToday, I accidentally typed the home Directory deletion command. Although it was not deleted for various reasons, many files and directories in the home directory were
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