Mac 与 Linux Windows 常见使用区别
- 1 常见命令
- 2 常见操作
- 3 常见问题
- 4 说明
本文记录一些mac和linux、windows之间常见的使用区别,以便于有需要的读者查阅,后续也会在本文中续更相关操作。
1 常见命令
function | mac | linux | windows | remark |
搜索 | command+空格 | windows | windows+F | |
关闭窗口 | command+W | alt+F4 | alt+F4 | |
截图 | fn+⬆️+C ctrl+⬆️+command+4 | 可以自定义 也可以直接使用print screen键 | snipping tool即可 |
2 常见操作
- 设置terminal 所有目录访问权限
Apple menu -> System Preferences -> Security & Privacy -> Privacy -> Full Disk Access -> +
Choose:
Applications -> Utilities -> folder -> Terminal -> open/grant terminal full disk access privileges. -> Relaunch terminal - 安装brew
网上看到一个大佬放上一条命令,直接解决了一系列问题,可以下载。很感谢这位大佬,不多说直接上命令:
自动脚本(全部国内地址)(在Mac os终端中复制粘贴回车下面这句话)
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
- 安装openv_p_n
mac下对应的为Tunnelblick,直接在如下地址中下载Stable安装包即可
Tunnelblick downloads - 安装redis
brew install redis
启动redis
brew services start|stop redis
redis-cli [-h ip -p 6379] - 软件多开
nohup /Applications/popo_mac.app/Contents/MacOS/popo_mac >/dev/null 2>&1 &
此处以 popo 为例,其它以此类推即可; - 安装jdk
在~/.bash_profile 添加如下内容:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home/ source ~/.bash_profile
卸载时候只需要删除对应djk版本即可 - 设置文本打开格式
mac 的textedit默认为utf-8格式,会出现打开中文乱码的情况,此时需要在 TextEdit-》Preferences-》Open and Save-》Plain Text File Encoding 中悬着格式为Chinese(GB 18030), 再次打开的时候就可以正常显示中文了。 - 安装配置 kubectl
- 下载最新kubectl
curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl"
- 添加可执行权限
chmod +x ./kubectl - 添加到环境变量中
vim ~/.bash_profile
export PATH=$PATH:/Users/xg/soft/k8s/bin
# 笔者kubectl放在k8s/bin 目录下,根据实际调整即可
重新打开终端机会将可执行文件加载到环境变量中,
% kubectl version --client
Client Version: version.Info{Major:"1", Minor:"16+", GitVersion:"v1.16.6-beta.0", GitCommit:"e7f962ba86f4ce7033828210ca3556393c377bcc", GitTreeState:"clean", BuildDate:"2020-01-15T08:26:26Z", GoVersion:"go1.13.5", Compiler:"gc", Platform:"darwin/amd64"}
- 使用kubectl
下载k8s集群的kube-config文件,将其放在~/.kube/config 处,随后就可以正常查看k8s集群状态了;
% kubectl get nodes
NAME STATUS ROLES AGE VERSION
ip-10-71-xxx-xxx.ap-northeast-1.compute.internal Ready master 31d v1.12.4-release-20191028
ip-10-71-xxx-xxx.ap-northeast-1.compute.internal Ready master 31d v1.12.4-release-20191028
···
ip-10-71-xxx-xxx.ap-northeast-1.compute.internal Ready <none>
- 参考文档:
install-kubectl
3 常见问题
- mac 无法正常打开app中的链接
最近使用mac的时候,发现点击app内部的链接都会出现如下提示:
The application “Google Chrome” is not open anymore.
查看网络发现浏览器内部某些配置发生了变化,需要杀掉相关浏览器,然后重启浏览器即可恢复。
ps -ef | grep '/Applications/Google Chrome.app' | awk '{print $2}' | xargs kill
- the application google chrome is not open anymore
4 说明
笔者测试的mac 系统为 10.15.6,linux 一般为ubuntu或者debian,windows一般为window上10