1、文件拷贝
# 将a.txt拷贝至b文件夹 cp a.txt b/
2、显示访达的隐藏文件快捷键
command+shift+.
3、显示隐藏文件
ls -a
4、添加环境变量
位置一:/etc/profile,所有用户公用
位置二:/etc/bashrc,所有用户公用
位置三:~/.bash_profile,当前用户有效
# 方式一:添加整个目录 export PATH=/some/path/you/want/to/add:$PATH /etc/bashrc # 方式二:只添加一个程序的别名 alias code=/some/path/you/want/to/add/xxcommand
使环境变量立即生效
source /etc/profile #or source /etc/bashrc #or source ~/.bash_profile
5、国内Homebrew的安装
国内的开源项目
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
修改brew镜像源为中科大
cd "$(brew --repo)" git remote set-url origin https://mirrors.ustc.edu.cn/brew.git cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core" git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
配置brew环境变量为中科大
#文件.bash_profile export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles
6、ssh登录远程服务器
# 默认端口 22 ssh user@servername # 指定端口 8888 ssh -P 8888 user@servername
7、scp下载服务器文件至本地
# 下载单文件 scp username@servername:/path/to/server /path/to/local_dir # 下载文件夹 scp -r username@servername:/path/to/server_dir /path/to/local_dir
上传文件,只需将下载时两个地址互换即可
8、ps显示本机运行程序
ps # 可结合grep抓取关键程序 ps | grep node
打赏作者