以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}两头不能有空格
发表回复