常用的指令(更新中)

1、python

(1) pip list

/usr/python3.7/bin/python3.7 -m pip list
apt-get install python3-pip

(2) 清华镜像下载

# 清华源
pip install scipy -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install (需要安装的库) -i https://pypi.tuna.tsinghua.edu.cn/simple

#百度
pip install scipy -i https://mirror.baidu.com/pypi/simple

(3) 软链接

# 将python3链接到python3.8
ln -s /usr/bin/python3.8 /usr/bin/python3
# 解除
rm -rf /usr/bin/python3

(4) 安装setuptools和pip

setuptools

2、gdb调试

(1) 生产可进行gdb调试的可执行文件

#include <stdio.h>
int main ()
{
    unsigned long long int n, sum;
    n = 1;
    sum = 0;
    while (n <= 100)
    {
        sum = sum + n;
        printf("%d \n", sum);
        n = n + 1;
    }
    return 0;
}
# main.c
# 加-g,生产的可执行文件,才能进行gdb调试
$ gcc main.c -o main -g
$ gbd main   # 启动调试
$ l          # list 代码
$ r          # run: 直接运行,运行完[Inferior 1 (process 55828) exited normally]  退出
$ b 10       # break 在第十行设置断点
$ r          # 开始运行,直到遇到断点
$ c          # continue 继续执行,直到遇到下一个断点
$ q          # quit  退出调试

结果:

(gdb) c
Continuing.
sum = 3

Breakpoint 1, main () at main.c:11
11              sum = sum + n;

gdb学习

3、Linux

(1)、centos安装指定路径

yum -c /etc/yum.conf --installroot=/home/XXX/debuginfo-install --releasever=/  install debuginfo-install -y glibc-2.17

(2) 进程树

pstree

(3) locate

locate opencv

(4) 进程

ps aux | grep nginx
ps -ef | grep nginx

(5) 压缩

 tar czvf pytorch.tar pytorch

(6) ldd链接库

ldd -r /path/to/.so
ldd /path/to/.so

(7) 使用指令"which"查看指令"bash"的绝对路径,输入如下命令

which cc
which gcc

# gcc 降级
sudo apt-get install gcc-7 g++-7
gcc -v
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 100
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 100

(8) 硬盘占用
https://blog.csdn.net/achenyuan/article/details/78674102
菜鸟教程

$ du --max-depth=1 -h  /source/code/
$ df -h
$ du -sh *   # 推荐

(9) 查看服务器CPU核心信息

$ cat /proc/cpuinfo

(10) 更改Ubuntu软件镜像为清华镜像 sourcelist

#1、将原始的source list复制替换
sudo cp /etc/apt/sources.list  /etc/apt/sources.list.old
#2、使用vim打开source list
sudo vim  /etc/apt/sources.list
# 注释原因链接,添加下列镜像源
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://archive.ubuntu.com/ubuntu/ bionic main restricted
deb-src http://archive.ubuntu.com/ubuntu/ bionic main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://archive.ubuntu.com/ubuntu/ bionic-updates main restricted
deb-src http://archive.ubuntu.com/ubuntu/ bionic-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://archive.ubuntu.com/ubuntu/ bionic universe
deb-src http://archive.ubuntu.com/ubuntu/ bionic universe
deb http://archive.ubuntu.com/ubuntu/ bionic-updates universe
deb-src http://archive.ubuntu.com/ubuntu/ bionic-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://archive.ubuntu.com/ubuntu/ bionic multiverse
deb-src http://archive.ubuntu.com/ubuntu/ bionic multiverse
deb http://archive.ubuntu.com/ubuntu/ bionic-updates multiverse
deb-src http://archive.ubuntu.com/ubuntu/ bionic-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu bionic partner
deb-src http://archive.canonical.com/ubuntu bionic partner

deb http://security.ubuntu.com/ubuntu/ bionic-security main restricted
deb-src http://security.ubuntu.com/ubuntu/ bionic-security main restricted
deb http://security.ubuntu.com/ubuntu/ bionic-security universe
deb-src http://security.ubuntu.com/ubuntu/ bionic-security universe
deb http://security.ubuntu.com/ubuntu/ bionic-security multiverse
deb-src http://security.ubuntu.com/ubuntu/ bionic-security multiverse


sudo apt-get update

(11) ubuntu下buff/cache占用过大处理

su
echo 1 > /proc/sys/vm/drop_caches
echo 2 > /proc/sys/vm/drop_caches
echo 3 > /proc/sys/vm/drop_caches

4、shell脚本

(1) shell 脚本报错总结

if [ ! -f "$temp.txt"]; then
	echo "txt no exist"
fi
./test.sh: 第 50 行:[: 缺少 `]'
if [ ! -f "$temp.txt" ]; then   # 空格
	echo "txt no exist"
fi
5、nohup
CUDA_VISIBLE_DEVICES=3 nohup /usr/python3.8/bin/python3.8 server.py run > /path/to/log.file 2>&1
6. git
git clone --recursive https://github.com/ZeroE04/CenterNet_onnxruntime.git
7.切换gcc/g++版本
sudo update-alternatives --config gcc

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

DYF-AI

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值