2023.12
- ssh连接大量服务器需要输入yes or no ?
ssh -o StrictHostKeyChecking=no user@ip
配置下/etc/ssh/ssh_config即可
- 定时任务、开机脚本
crontab -e and /etc/rc.local开机执行的脚本
更好的办法是使用systemd timer
-
vim命令
:X 加密文件
ZZ = :wq
ZQ = :q!
:%s/a/b/g 全局替换
:sort
:!grep
:!bash
:g/test/d 删除包含test的行,g means global
:v/test/d 删除不包含test的行,v means global!
30gg 跳转到30航
10↓(down arrow) 向下移动10行
mark: # 没用过
1. you are on line 10 and you want to mark this line
2. press ma, which marks the current line to register a
3. when you're on aother line and you want to return to line 10, just press 'a and you'll jump back
4. 'a jumps back to the line ,while `a jumps back to the exact cursor position
ctrl + v(列可视模式) and register # 最常用可视模式, 搭配vim :set mouse=a
- 重定向
ansible-playbook transfer.yml 1>success 2>error
or
ansible-playbook transfer.yml &> log
- bash语法
新shell(bash)的控制流语法基于steve喜欢的ALGOL 68语言 -- Unix传奇
难怪学不会...
- 快速编辑文件
> file bash上快速清空文件
:> file fish上快速清空文件,可alais em(pty) :>
cat > file
then cmd + v
then Ctrl + D
清空文件并把剪贴板内容输入文件
clipboard能当成文件操作ma?
- macos介绍
macOS 是一个结合了多种技术的操作系统:它的内核基于 Mach 和 FreeBSD 的部分,使用了许多 FreeBSD 的用户空间工具,并具有自己独特的 Aqua 图形用户界面。这种结合为 macOS 提供了其独特的性能和用户体验。
- bash自定义prompt
PS1=‘\u@\h \w> ’ # 日常还是用fish吧
- date格式
date 月日时分年
date 080422202024 # 只在mac上测试过
- java stream流
Stream API Introduce