When it comes to learning about Linux and OpenStack, it's important to learn scripts well, whether it's a large-scale deployment or operation, and shell scripts are already standard.
Here are just some basic notes for the Linux shell, which are noted here as notes.
===============linux Shell Introduction ======================
1, Command completion: Press two times in a row tab
File or folder completion: One tab at a time
Command Help:--help
2. chmod u=rwx,g+w,o+r filename
Chown root.root filename "-r" recursion
With S permission, the user has root privileges on the file
T permissions are for folders, and files under that folder are given root permissions
chmod 744 filename
The default value for Umask is 022, which means that the default permissions for files and directories are 644 and 755
Ln-s filename1 filename2 filename1 is the source, Filename2 is a shortcut
3. The first two lines of the shell script
#!/bin/bash #调用bash
# #注释, it doesn't make sense
Run the shell script
chmod u+x shell.sh #赋予运行权限
./shell.sh #运行脚本
Alias ls= ' Ls-l ' #别名
ls ' cat filename '-al #命令替换
Nohup Command & #后台处理
ls | Sort turns the output of LS into a sort input
Sort <filename filename for output source
Sort <filename>filename1 input the filename output to the filename1
At this point, filename is the source, filename1 for the purpose
"" ' can recognize spaces and special characters
; One row can run multiple commands
& Indicates background run
======================= Variables and operators ==================
Set environment variables via export, env to view, globally valid
echo $ORACLE _sid Display the values of environment variables
unset $ORACLE _sid to clear the value of the environment variable
======================= shell output and input ==================
Echo Tee | grep < > << >> 0 Standard input (default keyboard) 1 standard output (default screen) 2 error input (default screen)
======================= Control Flow Structure ==================
If condition one is true
Then execute command one
Elif If condition one is not true
Then execute command two
else if none of the above matches, execute command three
Fi end
This article is from the "Heavenly Soul Eternal" blog, please be sure to keep this source http://tianhunyongheng.blog.51cto.com/1446947/1668688
Basics of Linux Shell learning