返回归档

归档 2018

Command

常用的 CMD 命令

CommandBashZSHNotebook
本文目录28
  1. Common
  2. Mac shadowsocks kcptun not working
  3. Mac Allow apps downloaded from anywhere
  4. Mac ReInstall CommandLineTools
  5. Run comment as sudo
  6. GEO SQL
  7. check the 40 largest file
  8. Find all files in current directory recursively
  9. find all file match regex
  10. Package Manager
  11. homebrew
  12. Mac 上使用 brew update 会卡住的问题
  13. Install plantUML
  14. yarn
  15. npm
  16. Process
  17. Kill all php-fpm pool www
  18. checkstatus.sh
  19. restartworker.sh
  20. startworker.sh
  21. stopworker.sh
  22. stop flutter
  23. check port
  24. vim 粘贴格式不对
  25. Grep without nodemodules
  26. rsync
  27. copy file from remote
  28. curl with duration

Common

Mac shadowsocks kcptun not working

你用的是两个不同分支的 kcptun,下载的这个版本不支持从插件选项里面读参数 似乎目前只支持到 kcptun 的 2017 版本

bash
ln -s ../kcptun_v20170718/kcptun_client ./kcptun

Mac Allow apps downloaded from anywhere

bash
sudo spctl --master-disable

Mac ReInstall CommandLineTools

Solve No Xcode or CLT version detected!

bash
rm -rf /Library/Developer/CommandLineTools
xcode-select --install

Run comment as sudo

text
eugene        ALL=(ALL)       NOPASSWD:/usr/bin/systemctl reload nginx

GEO SQL

sql
UPDATE `do_onepage_store` SET geom = GeomFromText('POINT(0 0)')
SELECT * FROM `do_storelist` WHERE ST_Distance_Sphere(Point(0, 0), geom)  =0

check the 40 largest file

bash
sudo du -x -h / | sort -h | tail -40

Find all files in current directory recursively

bash
find . -type f | wc -l

find all file match regex

bash
find . -regex ".*/api/.*\.ts"

Package Manager

homebrew

bash
brew leaves #list installed top-level packages
brew install PACKAGE
brew uninstall PACKAGE

Mac 上使用 brew update 会卡住的问题

bash
# 替换源地址
cd "$(brew --repo)"
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git

# 重置为官方地址
cd "$(brew --repo)"
git remote set-url origin https://github.com/Homebrew/brew.git

Install plantUML

Installing Java 11 on MacOS with HomeBrew

bash
brew install caskroom/cask/brew-cask
brew install java
brew install graphviz

yarn

bash
yarn install
yarn add
yarn remove
yarn global list --depth=0 #list installed top-level packages
yaml
nodeLinker: pnp
yarnPath: .yarn/releases/yarn-3.0.1.cjs
unsafeHttpWhitelist:
  - '*.tuzhanai.com'
npmRegistryServer: http://npm.tuzhanai.com/

pnpMode: loose

npm

bash
npm install
npm remove
npm -g list --depth=0

Process

Kill all php-fpm pool www

bash
kill -9 `ps -ef | grep 'php-fpm: pool www' | awk ' { print $2 }' | head -n -1`

check_status.sh

bash
ps -fp $(pgrep  -f Qworker)

restart_worker.sh

bash
pgrep -f Qworker.php |xargs kill -9/home/goopter/start_worker.sh

start_worker.sh

bash
cd /var/www/qa/goopter_common/mq/receivernohup php Qworker.php > worker.log &

stop_worker.sh

bash
pgrep -f Qworker.php |  xargs kill -9

stop flutter

bash
ps -ef | grep flutter | grep -v grep | awk '{print $2}' | xargs kill -9

check port

bash
ss -ntuap | egrep $PORT
ps -ef | egrep $PID

vim 粘贴格式不对

text
# 开启
:set paste

# 关闭
:set nopaste

Grep without node_modules

bash
# grep without node_modules
grep -rF --exclude-dir=node_modules --exclude-dir=.cache-loader '@fe/common/lib/file-uploader' *

rsync

bash
# copy without node_modules
rsync -avltrc --exclude="node_modules" --exclude=".cache-loader" --exclude="logs" --delete admin/ admin_xy/

# dry-run with --include-from
rsync -avltrc --dry-run \
  --include-from '/Users/jiyu/Code/rabbitpre/@fe-deploy/rsync_xy-include.txt' \
  /Users/jiyu/Code/rabbitpre/@fe-deploy/ \
  ~/Desktop/@fe-deploy.bak/

rsync_xy-include.txt

text
+ /*/
+ /*/prod_xy/
+ /*/prod_xy/**
- *

copy file from remote

bash
scp -P 22 root@66.42.74.139:/root/kcptun.sh ./

curl with duration

bash
curl -o /dev/null -s -w %{time_connect}:%{time_starttransfer}:%{time_total} --location --request GET 'https://ema-home.xyzq.cn/slowtest.txt' \
--header 'Cookie: renderer.sid=s%3A8h0vJmXRqGnDBxuPNd5a_vBLo_4ILUdq.xDo7bjJWXOxZDsqwIFVPLxqtWjy8cKa3ydsjZfMa3j4; rp.sid=s%3AnGR4PA6TtkJAw_OewqAKydIv1UKxKk48.cuhLIH53b8aJ86GlRgR5Gwr2fxx137GEZ5rBIy76NlE'
返回首页
上一篇WeChat下一篇常用配置

Discussion

留言与讨论

想法、补充和不同意见都欢迎。