1. Convert lowercase letters to uppercase
echo "ABcD" |tr ' A-Z ' ' A-Z '
2. Uppercase letter Conversion lowercase letters
echo "ABcD" |tr ' A-Z ' ' A-Z '
3. Current Script path
basepath=$ (CD ' DirName $ '; pwd)
For detailed explanations, please see http://www.cnblogs.com/FlyFive/p/3640267.html
4. Common Date Variables
Date + '%y%m%d%h%m%s '
The output format is: 20161027090005
Date + '%y-%m-%d%h:%m:%s '
The output format is: 2016-10-27 09:00:05
5. Sed common commands
Delete the line that matches test
Sed-i '/test/d '/tmp/test.txt
Modify the contents of the/tmp/test.txt test to Test1
Sed-i ' s/test/test1/g '/tmp/test.txt
If you encounter special characters, replace/substitute # or other characters. For example: Sed-i ' s#test#test1#g '/tmp/test.txt
6, Row to column
Execute command: Cat/tmp/test.txt
Output:
A b C
Execute command:
For Parm in $ (cat/tmp/test.txt)
Do
Echo $parm
Done
Output Result:
A
B
C
7. List of career change
Execute command: Cat/tmp/test.txt
Output:
A
B
C
Execute command: cat/tmp/test.txt|xargs-r
Output:
A b C
Linux Common commands