Linux下常用命令
针对经常使用到的Linux命令,汇总一下,以备查看:
一、安装类:
1、GIT
sudo apt install git
sudo apt-get install git-core
2、Bazel
方法1:(下载最新版本)
sudo apt-get install curl
echo "deb[arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
curl https://bazel.build/bazel-release/pub.gpg | sudo apt-key add -
sudo apt-get update
sudo apt-get install bazel
sudo apt-get upgrade bazel
方法2:(下载指定版本)
下载地址:https://github.com/bazelbuild/bazel/releases
下载版本如:bazel-0.25.2-installer-linux-x86_64.sh
chmod +x bazel-0.25.2-installer-linux-x86_64.sh
./bazel-0.25.2-installer-linux-x86_64.sh --user :--user标志将Bazel安装到$HOME/bin目录,并设置.bazelrc路径$HOME/.bazelrc
方法3:源码编译
git clone https://github.com/bazelbuild/bazel.git
cd bazel
./compile.sh
卸载:bazel的卸载比较麻烦:
ll .bazel
sudo rm -rf .bazel/bin
sudo rm -rf .bazel
sudo rm -rf /usr/local/bazel (如果有该目录)
sudo rm -rf /usr/bin/bazel (如果有该目录)
sudo rm -rf /usr/lib/bazel (如果有该目录)
注意:卸载完一个版本再安装新版本前一定要记得重启一下。
3、JDK8
sudo apt-get install openjdk-8-jdk
4、GCC
删除指定版本:
sudo apt-get remove gcc gcc-xx
安装:
sudo apt-get install -y gcc-4.8 sudo apt-get install -y g++-4.8
sudo apt install gcc-4.8 gcc-4.8-multilib g++-4.8 g++-4.8-multilib (for 4.8)
sudo apt install gcc-5 gcc-5--multilib g++-5 g++-5--multilib (for 5)
重新建立软连接:
cd /usr/bin
sudo rm -r gcc
sudo ln -sf gcc-4.8 gcc
sudo rm -r g++
sudo ln -sf g++-4.8 g++
测试:gcc --version
5、本地服务器nginx
sudo apt-get install nginx-light
sudo service nginx start
测试下:打开浏览器输入 http://127.0.0.1 显示welcome to nginx!
6、Tensorflow
git clone http://github.com/tensorflow/tensorflow Source code
https://github.com/lhelontra/tensorflow-on-arm/releases for ARM
https://blog.csdn.net/qq_31261509/article/details/79840385(ARM setup Tensorflow)
bazel build --
7 Python
设置默认python版本
方法1:
which python python3.5
rm /usr/bin/python
ln -s /usr/bin/python3.5 /usr/bin/python (建立软链接)
方法2:
sudo gedit ~/.bashrc
alias python='/usr/bin/python2.7'
source ~/.bashrc
二、查看类:
1、查看GCC版本
方法1:gcc -v
方法2:ll usr/bin/gcc*
2、查看glibc版本
ldd --version
3、查看bazel版本
bazel version
4、查看java版本
java -version
5、查看Ubuntu系统信息:
uname -a
6、查找文件:
find /usr/ -name crti*