3 篇文章带有标签 “快捷键”

Linux Shell 实践

  • 执行时的所有信息都输出到文件(&>)
echo hello &> log.info
$ cat log.info 
hello
  • 创建一个文件并写入内容(> filename <<EOF)
cat > hello.sh << EOF
#!/bin/bash
echo hello
EOF
  • 整数四则运算(let)
let n=10-3+4/2
echo $n
9
  • 四种执行模式运行
$ vim test.sh
#!/bin/bash
echo $str
$ chmod u+x test.sh
$ bash test.sh 
$ ./test.sh 
$ source test.sh 
hello world
$ . test.sh 
hello world
  • 导出变量(export),父进程定义的变量子进程可见。
$ export str
$ bash test.sh 
hello world
$ source test.sh 
hello world
  • 移除变量(unset)
$ unset str
$ echo $str
  • $$ 当前进程ID
$ echo $$
26102
  • $0 当前进程名
$ echo $0
-bash
  • 显示所有数组元素
$ echo ${ips[@]}
10.0.0.1 10.0.0.2 10.0.0.3

macOS实践

  • 拍摄屏幕快照
Command+Shift+5             随意截取或者录制窗口的图像和视频
Command+Shift+3             将屏幕捕捉到文件
Command+Shift+4             将所选屏幕内容捕捉到文件,或按空格键仅捕捉一个窗口
Command-Shift-Control-3     将屏幕内容捕捉到剪贴板
Command-Shift-Control-4     将所选屏幕内容捕捉到剪贴板,或按空格键仅捕捉一个窗口
  • Safari
Command+T               新建标签页
Command+N               新建窗口
Command+W               关闭标签页
Command+L               定位地址栏
Command+Shift+L         显示|隐藏边栏
Command+Z               撤销关闭的标签页
Control+Tab             移到下一个标签页
Control+Shift+Tab       移到上一个标签页
  • 查找指定目录下(包含子目录)所有的指定名字的文件,可以使用通配符(? *)
$ find . -name '.DS_Store'
$ find . -name '.DS_*'
$ find . -name '.DS_Stor?'
./.DS_Store
./test/.DS_Store
./images/.DS_Store

删除指定目录下(包含子目录)所有的指定名字的文件 $ find . -name '.