text edit,
2022-10-04 21:15 tonyniu8 阅读(17) 评论(0) 编辑 收藏 举报top
Values under 1.0 indicate that the machine is not busy.
/proc/cpuinfo
sort
cat -e test.sh
print no display word
-n display blank line
sort by multiple column
sort -k 1,1 -k 2n distros.txt
sort -k 3.7 nbr -k3.1nbr distros.txt
sort default with tabs and spaces
可以指定 by -t
sort -t “:” -k 7 /etc/passwd
uniq
sort foo.txt |uniq -c
cut
cat xxx.txt|head -2|cut -d' ' -f 1-3
https://blog.csdn.net/wuli13141516/article/details/104419255
sed command
echo “front”| sed “s_front_back”
add
插入
sed -i "2a iii" test.txt
sed -i '2a append' test.txt
mac default has backup , skip backup by add one more parameter
sed -i "" "2a iii" test.txt
sed -i "" '2a append' test.txt
delete
sed -i '2d' test.txt
shell script basics
思考如何弄test 即 if 语句
- $0 script name
$# script parameter numbers
$@ all parameters
$? scrip return
type used to check [[
https://www.baeldung.com/linux/bash-single-vs-double-brackets
single and double bracket
The single bracket is a built-in command that’s older than the double bracket. The double bracket is an enhanced version of the single bracket. If we want the portability of scripts, we should prefer single brackets. However, using the double brackets is generally more convenient.