工作中常用命令行

508 阅读1分钟

常用命令行总结:

# 设置代理
export http_proxy=http://192.168.0.2:7890
export https_proxy=http://192.168.0.2:7890

# 取消设置代理
unset http_proxy
unset https_proxy


zip -r predict_images ./predict_images
scp m:~/xxx.zip ~/Downloads/xxx.zip
# rm 的时候打醒十二分精神,万分小心,一不留神,容易惯性删除
rm -rf *.json
mv from_path to_path
cp from_path to_path 
nvtop # 监控GPU运算情况
htop # F4筛选 F9 + 9 kill process
nohup jupyter notebook --ip 0.0.0.0 --no-browser --allow-root  > jupyter.log &
jupyter notebook --generate-config
jupyter notebook password

nohup python train.py >> train_logs/0601_13_classes_2.txt &
nohup tensorboard --logdir=./ --host=0.0.0.0 --port=8099  > tensorboard.log &
source activate dl # or conda  activate dl
df -h
du -sh *
disk -l
history|grep build
du --max-dept 1 -h
mount -t ntfs-3g /dev/sdc1 /mobileHDD/ # 挂载移动硬盘
 # 不覆盖本地已存在的文件.
rsync -avzu --progress from_path   to_path
source activate dl # or  conda activate dl
conda list
find / -name "xxx"
fdisk -l
# 排除某个目录内容进行压缩
zip -r xxx.zip xxx -x "xxx/logs/*"


sudo rabbitmqctl list_users
sudo rabbitmq-server start 
rabbitmqctl add_user chris 123
sudo rabbitmqctl status
rabbitmqctl set_user_tags chris administrator
rabbitmq-plugins enable rabbitmq_management
# https://unix.stackexchange.com/questions/548691/bash-argument-list-too-long
rsync -av --include='*.json' --exclude='*' username@remote:/remote_path/ /local_path/
# 批量重命名
sudo find . -name '*.txt' -exec rename 's/_questions.txt/.txt/' {} +

 git clone --depth 1 --branch tag_name(0.1) xxxx.git
 
 
 for i in {9010..9011};do sudo docker run -itd --net='host' -v /etc/localtime:/etc/localtime -v /media/moveDir/dxq/test/xxxx:/home/code -w /home/code/service --name "bs_$i" xxxx:v11 /bin/bash;done
 #查看 经常pid 启动命令
 


# 进入容器
sudo docker exec -it container_name /bin/bash


# github 下载加速
vi ~/.gitconfig
[http "https://github.com"]
    proxy = http://172.0.0.1:7890
[http]


# 删除文件夹总大小 小于 50K的
# 先确认一下,然后再删除
find ./ -mindepth 1 -maxdepth 1 -type d -exec du -ks {} + | awk '$1 <= 50' | cut -f 2-
# 确认无误后添加上 | xargs -d \\n sudo rm -rf
find ./ -mindepth 1 -maxdepth 1 -type d -exec du -ks {} + | awk '$1 <= 50' | cut -f 2-| xargs -d \\n sudo rm -rf

# 日志实时追踪
tail -f xxx.txt

将目录下【递归】复制到另一个文件夹中
sudo find -maxdepth 3 -name '*.png' -exec cp -t ./all_images {} +

chown tom:users file