以 bash 为例
Ctrl + l (⌘ + l) 清屏
Ctrl + d (⌘ + d) 敞开终端
nohup 起的程序,敞开终端后程序仍然在:
例如 nohup firefox https://freecodecamp.org
起后盾过程
nohup firefox https://freecodecamp.org &
通过过程名杀过程
killall firefox
通过过程名一部分杀过程
pkill fire*
time 查看命令执行工夫
如 time gcc -g *.c
查看发行版名字cat /etc/*rel*
sed 文本替换命令,只会在规范输入里替换,源文件不扭转
- 把 myfile.txt 第一次呈现的 apples 替换为 oranges
sed s’/apples/oranges/’ myfile.txt - 把 myfile.txt 所有呈现的 apples 替换为 oranges
sed s’/apples/oranges/g’ myfile.txt - / 是分隔符,也能够用其余分隔符,如 -
sed s’_apples_oranges_’g ` myfile.txt - 加 - i 选项会批改源文件
sed -i s’_apples_oranges_g’ myfile.txt
查看 IP 地址
内网 IP:ifconfig
公网 IP:curl ifconfig.me ; echo
Ctrl + R 后输出命令,主动从历史命令外面实现
应用 shell 做数学计算 echo $((19*34))
分数计算:scale=2 小数点保留 2 位echo "scale=2; 9*3/((2*2)+1)" | bc
批量创立文件 file1.txt, file2.txt, file3.txt … file100.txttouch file{1..100}.txt
创立 app.html, app.css, and app.jstouch app.{html,css,js}
- mkdir {images,css,src,templates,scripts}两头不能有空格