Shell learning notes (1) key concepts and commands in shellVariable variableName = value
There cannot be spaces around the equal sign
The variable content must be enclosed by space, but v = "hello $ name" $ does not support the original function. It cannot be enclosed in single quotes. v = "hello '$ name'" is plain text.
Escape Character \ converts special characters into common text 'COMMAND ', $ (comm
Online troubleshooting commands-Shell, online troubleshooting-shell
Creation: Liu Xinyu, latest modification: about 4 hours ago
Go to metadata start 1. Track online logs and regularly refresh the latest content
tail-fn 200 $log
2. Search for a specified string
# Show only matching rowsgrep$String $file# Match up or down n rows of the row
2 3
Do
For var2 in 0 5
Do
if [ $var 1 -eq 2-a $var 2 -eq 0 ] /c0>
Then
break 2
Else
Echo "$var 1 $var 2"
fi
Done
Done
As above, break 2 means to jump out of the outer loop directly. Operation Result:1 01 5Continue commandThe continue command is similar to the break command, with only a little difference, and it does not jump out of all loops and just jumps out of the current loop.To modify the above example:
#!/bin/bash
While :
Do
echo- n "Input a num
Use shell commands to operate databases and shell command Databases
You can use the-e parameter of mysql to perform various SQL operations (create, delete, add, delete, modify, and query ).Usage
Mysql-uxxx-pxxx-e "mysql Command"
You can also use the following statement:
Mysql-e-uxxx-pxxx "mysql Command"Practice
[Root @ iZwz99qnmldt4n744noo9gZ ~] # Mysql-e
1. Show the top 10 processes consuming memory/cpu
Copy Code code as follows:
PS aux | Sort-nk +4 | Tail
PS aux | Sort-nk +3 | Tail
2. View process
Arrange by memory from large to small
Copy Code code as follows:
PS-E-O "%c:%p:%z:%a" |sort-k5-nr
3. By CPU utilization from large to small arrangement
Copy Code code as follows:
PS-E-O "%c:%p:%z:%a" |sort-nr
3. View the number of concurrent requests for Apache and its TCP connect
During the loop, there are times when you need to force out of the loop without reaching the end of the loop, and the shell uses two commands to implement the function: Break and continue.
Break command
The break command allows you to jump out of all loops (terminating all loops after execution).
In the following example, the script goes into a dead loop until the user enters a number greater than 5. To
The shell script reads data in several ways:1. keyboard input, default2. read from the file3. Pass through Pipeline command
Functions of Echo:\c: No Line change\f: Paper Feed\ t: the jump Grid\ n: Wrapping Line\ represents escape, for example: "\"/dev/rmt0 "\" translates to, "/dev/rmt0"
READ: Reads information from a line of text in a keyboard or file and assigns it to a variable.
Copy Code code as follows:
[Jb51]/>read Name
Hello I
10.1 Commond: Suppress normal shell function lookups
10.2 exec: Replacing the current shell process with the Execute command
10.3 Bash:gnu's Bourne-again shell interpreter
10.4 Builtin: Execute shell built-in command
10.5 Enable: Enables or disables built-in shell
Shell internal commands and external commandsInternal command: is actually part of the shell program, which is a command executed by the shell itself, usually loaded and resides inside the system when the Linux system loads and runs. External command: Is the utility part of the system, because the utility is usually mo
Label:MongoDB is a very popular NoSQL database management system, officially: MongoDB, I installed in localhost is the Enterprise Server version, the default installation file directory is: C:\Program files\mongodb\server\3.2\bin, click Windows+r, enter cmd, start command Prompt, go to the installation directory Every time you open command prompt you need to enter the installation directory of MongoDB is very troublesome, you can modify the computer environment Variables, right click this pc->p
the cross-process. At this point the code in Robotium can not be executed, the approximate reason is that the app we are testing is suspended, causing Robotium to be suspended together, so the next thing can not be executed, unless back to the app. So we have a general understanding that what the shell commands to do is complete the entire photo, confirm, clip action, and then go back to the program. A des
Guide
When you're going to really manipulate your Linux system, there's nothing like a command-line interface that lets you do that. To be a Linux master, you must be able to understand the different types of shell commands and use them correctly under the terminal.
There are several types of commands under Linux, and for a Linux novice, it is imp
Guide
When you're going to really manipulate your Linux system, there's nothing like a command-line interface that lets you do that. To be a Linux master, you must be able to understand the different types of shell commands and use them correctly under the terminal.
There are several types of commands under Linux, and for a Linux novice, it is imp
There are many things worth learning about the shell kernel. Here we mainly introduce the Linux shell kernel, including the shell kernel. As the operating system shell, the Linux system shell provides users with the interface to use the operating system. It is a general term
Tags: end reverse start linu size History command Show OCA textThe basics of the shellFirst, Bash has the following features:1. Record command history2. Command and file name completion3. AliasesAlias rm= ' Rm-i '4. Wildcard characters* 0 or more characters?? match one character5 Input and output redirectionInput redirection output redirection;?6. Pipe symbol |second, the variableenvironment variable Path: It is a variable of the shell presetEcho $PAT
Introduction and use of shell commands
1. What is shell?In computer science, Shell, commonly known as shell, is a software (command parser) that provides user interfaces ). It is similar to command.com in DOS. It receives user commands
Statistics commands sort, WC, uniq
Sortsort [-fbmnrtuk] [file or stdin]-F ignores case-B ignores the front space-m sort by month name-N using pure numeric sorting-R Reverse Sort-U The same data item appears only one item-T delimiter-K to sort by that intervalegcat/etc/passwd | Sort-t ': '-K 1//pair to: Sort the first column of the split
WC statistic Word, line or character numberWC [-LWM]-L Number of rows-W Words-M character CountegCat/etc/prof
adb shell as root after device rootedOnce device rooted, we must perform "su" before we get root permission in adb shell,this are not convenient in some Situati Ons,so there has a method to get permission without perform "su".-O remount,rw/4755 /system/bin/shexit-rwsr-xr-x root Shell 285016 2015-02-02 20:57 SHWe set /system/bin/sh to SUID Permissonand now we can
Examples of common Linux commands and Bash Shell scripts, bashshellSummary
The Linux Command isText-based input/outputAccording to the simple functions, loose input, and rigorous output of the program mentioned in the Unix philosophy, various program combinations can have more powerful functions, the main reason for this flexibility is that Linux requires that the input and output of a program must adhere t
. (5) In essence, the shell script is a simple combination of command-line commands into a file. The shell is basically a command interpreter, similar to a DOS Command.com. It receives the user command and then invokes the appropriate application. 2, Shell features: (1) The proper combination of the existing
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.