macOS和linux操作

Posted by     "hehaoran" on Friday, October 22, 2021

TOC

macOS

  1. mac 终端变慢
sudo rm -f /private/var/log/asl/\*.asl
  1. 如何让Finder显示隐藏文件和文件夹
# 显示
defaults write com.apple.finder AppleShowAllFiles -boolean true ; killall Finder
# 隐藏
defaults write com.apple.finder AppleShowAllFiles -boolean false ; killall Finder

https://sspai.com/post/26273

  1. brew安装指定版本的软件

https://blog.csdn.net/aa464971/article/details/84860937 https://segmentfault.com/a/1190000015346120

  1. 删除本地git仓库
find . -name ".git" | xargs rm -Rf
  1. 全局忽略.DS_Store
# make a global .gitignore file somewhere, e.g.
echo .DS_Store >> ~/.gitignore_global
# Now tell git to use it for all repositories:
git config --global core.excludesfile ~/.gitignore_global

Linux

  1. 如何将本地文件或文件夹上传到云服务器上?
scp -r /Users/hehaoran/myblog root@host:/home/wwwroot/hehaoran.cn/
## 若仅仅是上传某一个文件,则没有-r参数
## host是你的公网ip
  1. 利用 hugo 自动生成博客网页文件
hugo --theme=hugo-theme-cleanwhite --baseUrl="http://hehaoran.cn"
  1. 复制文件夹中所有文件,但不包括子目录.git
rsync -av --exclude .git/ ./* ../
# 当前目录为目标文件所在的目录
  1. 复制docker某个文件夹下所有文件到宿主主机(即本机),比如
# docker cp 容器名(id):要拷贝的文件在容器里面的路径 要拷贝到宿主机的相应路径
docker cp -a muxviz:/muxViz-master/export/ ~/
# 或者反向操作
# 注:当在容器中运行muxviz时,需要将宿主主机中的配置文件(即txt和edges)复制到docker容器data中
docker cp -a ~/muxviz/data/interdependent/ muxviz:/muxViz-master/data

那些年我们遇到的坑

  1. CentOS 系统在~/.bashrc 文件中定义了一些别名,比如 cp = “cp -i”,使得 cp -rf 还是会出现询问是否覆盖的提示。需要在.bashrc 中注释掉。

「真诚赞赏,手留余香」

Haoran Blog

真诚赞赏,手留余香

使用微信扫描二维码完成支付