Transferred from: http://www.opsers.org/linux-home/base/full-version-of-bash-keyboard-shortcuts.html#toc-3Living in the Bash shell, memorizing the following shortcuts will greatly improve the efficiency of your command line operations.Edit command
Ctrl + A: Move to the beginning of the command
Ctrl + E: Move to the end of the command line
Ctrl + F: Move forward by character (right)
Ctrl
How to use if and for statements in bash scripts
In the bash shell script, we need to understand three execution sequences first.
Sequential execution (from left to right, from top to bottom)
Select execution (a structure is executed only when the conditions are met or not met)
Loop execution (repeated execution of a segment structure)
The if statement written today is "select order", and "for" indicat
Linux bash script concise manual! Script Execution and debugging 1. absolute path execution. The file must have the execution permission. 2. Execute the sh command without the execution permission. 3 ,. add space or source to execute the command. The script will be executed in the current shell. 4. Check the script syntax bash-v test. sh5. Execute bash-x test. sh
The insite Short Message of the blog site team was originally removed from the homepage by mistake due to improper handling by the editors, and the previous article has been moved back.
Pay tribute to the earnest and responsible work attitude of the blog community team!
Because the same article appears twice on the blog homepage, I have removed the previous article from the homepage.
SlaveServer.conf
1 #global var: glServerList2 glServerList="192.168.31.98 \3 192.168.31.3 \
Before giving you a detailed introduction to LINUX Bash, let us know how to edit the command line, and then introduce LINUX Bash in detail, hoping to be useful to you. In LINUX Bash, you can edit the command line so that you can modify the command you typed before executing the command you typed.
Edit command line
In LINUX B
Understanding and learning bashtable OF CONTENTS
1. Understand bash
2. Shell Variable Functions
3. Command alias and History commands
4. bash shell operating environment
5 Data Stream redirection
6 pipeline commands
1 Understanding bash
Use shell to communicate the input commands with the kernel so that the kernel can control th
Arithmetic Operations in Bash:
Operators +,-, *,/, and %
Declare:
-I: integer variable
-X: environment variable, similar to export
1. Let: performs arithmetic operations in the format of let varname = arithmetic expression
If the calculation result is decimal, the fractional part is omitted.
For example, let sum = 4 + 1 and the result is 5.
Echo $ sum
Let s = 16/3, the result is 5
Echo $ s
2. varname = $ [arithmetic expression]
3. varname = $ (arithm
Hive hql: from a string "P? A? B? C? PPP? Hhh "? As the separator, find the 5th string
Bash program:
Test. Sh#!/bin/bashhive -e "select (split('p?a?b?c?ppp?hhh','?'))[4] from a limit 1;"Error:Caused by: Java. util. RegEx. patternsyntaxexception: dangling meta character '? 'Near index 0 is changed:Test. Sh#!/bin/bashhive -e "select (split('p?a?b?c?ppp?hhh','\\\\?'))[4] from a limit 1;"Reason for correct running:The second parameter of split is a RegEx,
Bash is a Linux-based shell, and many of the commands described in the front are handled by Bash's environment. Here's a general-to-local understanding of bash. For bash I've roughly divided it into three parts: variables, the configuration of the operating environment, and the output of commands. The summary of Bash d
This problem occurs because there is no configuration. Bash_profile problem, or we accidentally emptied or deleted the. bash_profile file.Method One: Modify the ~/.bash_profile fileThe steps are as follows:Vim ~/.bash_profile(No tube. Bash_profile This file has a few, you can create a new one is also possible)At the end addExport ps1='[\[email protected]\h \w]\$'And then executeSOURCE ~/.bash_profileThis way the shell can display the path.Method Two: Copy the new user to the root user-
Login Linux The system command prompt appears as: -bash-4.1$1. Description of the problemLogin Linux The system command prompt appears as follows:
-bash-4.1$-bash-4.1$
2. Cause Analysisconfiguration file for user-related environment variables . BASHRC and bash_profile. 3. Workaround/etc/skel when a new user is createdthrough the Useradd
Linux Summary bash features
Command history:
Use command: History
Environment variables:
Histsize: The number of bars recorded in the command history buffer, which defaults to 1000;
Histfile: Record the current logged-in user logout the history command to store files;
Histfilesize: Command history file records the number of history, the default is 1000;
Operation Command History:
Bash featuresTerminal, the interface program attached to the terminal:Gui:kde, GNome, XFCECli:/etc/shellsBashZshFishFeatures of bash:Command line expansion: ~, {}Command aliases: Alias, UnaliasCommand history: HistoricalFile name wildcard: GlobShortcut keys: Ctrl + A, E, U, K, lCommand completion: $PATHPath Completion:Bash features: command hashCache the results of previous commands: Key-valueKey: Search KeyValue: ValuesHash command:Hash: Listhash-d C
Features of bash in the shellFeatures of bash in the shellOne of the bash features: command line expansion The mechanism of automatically replacing a given special symbol of a command line with another stringDirectory: Command: CD "Built-in command" Working directory: The directory that is currently locatedCd:change directory (switch directory)CD target path (
Let's review the usage of the last section redirect:1. Quickly empty filesCat Demo.txt Note: Linux has a classic saying "Everything is a file",/dev/null can be considered a special empty file, more image point, can be understood as a sci-fi film in the black hole, any information to the output to it, there is no return, of course, there is no information in the black hole can come out.In general, the above meaning is the use of /dev/null There are other uses, such as using it to let nohup do not
The definition format of the 1:bash function
[Function] funname [()]{action; [return int;]}Description1: Can be defined with function fun () or directly fun (), without any parameters.2: The function returns a value that can be returned with a return, or, if not, the result of the execution of the last line of the function body as the return value. Return followed by a value of 0-255. After calling the function, the return value is obtained by $
Ubuntu and Debian's shell are installed by default to dash, not bash.Run the following command to view the details of SH and confirm which program the shell corresponds to:$ls-al/bin/shDash is lighter and faster than bash. But bash is more common.If some commands, scripts, and so on are not always executed properly, it may be the cause of dash.For example, when compiling the Android source code, if you use
The Linux shell is basically bash by default, and here are some of the tips I've summed up.
${varible##*string} The string ${varible#*string after the last string is intercepted from left to right
${varible%%string* the string after the first string from left to right
The string ${varible%string* after the last string from right to left
intercepts the string after the first string from right to left
Background Run programs () use a child shel
default;
My blog: Code encyclopedia: www.codedq.net; amateur grass: www.xttblog.com; love to share: www.ndislwf.com or ifxvn.com.-Icon Component (addition icons): Choose whether to create a Quick Launch bar icon or create a desktop shortcut;-Desktop Browsing (Windows Explorer integration): Browse the source method, separate context browsing using only bash or git GUI tools only; The advanced context browsing method uses Git-cheetah plugin plug-ins;-A
Shell--command parser, also a programming languageBash-a specific instance of the shell, zsh, bash are instances of the shell
The "Echo $SHELL" command can be used in the terminal to view the shell instance currently in use and can be switched to zsh or other shell instances through "Chsh-s/bin/zsh" .
Global profile (all in/etc/directory, etc for Environment config abbreviation):
/etc/profile (not recommended)--each user is called at logon
/ETC/BA
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.