ubuntu下面嘚一些常用基本命令

1)环境变量配置:

9 ~/.bashrc
or
~/.bash_profile.


sudo gedit ~/.bashrc






第一种
sudo vim ~/.bashrc

export PYTHONPATH=~/caffe/python:$PYTHONPATH
export PYTHONPATH=/home/caffe/python:$PYTHONPATH

source ~/.bashrc


第二种××××××××××××个人觉得这种方式是最好嘚
sudo gedit ~/.bashrc

export PYTHONPATH=~/caffe/python:$PYTHONPATH  

source ~/.bashrc

可以用下面的命令查看 LD_LIBRAY_PATH 的设置内容:

echo $LD_LIBRARY_PATH



第三种
https://blog.csdn.net/jiachen0212/article/details/79569076

sudo gedit /etc/profile
需要修改
export PATH=/usr/local/cuda9-.0/bin:$PATH  
export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64:$LD_LIBRARY_PATH
注意生效后前面红框里的颜色都变了...
原本嘚
export PATH=/usr/local/cuda-9.0/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64\
                                            ${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
source /etc/profile

三者区别:

Linux下 环境变量/etc/profile、/etc/bashrc、~/.bashrc的区别

在安装nsq的时候遇到环境变量的配置问题,参考的博客中既有修改/etc/profile的,也有修改~/.bashrc的……

为了搞清楚为什么修改这个,转载了一篇总结得稍好些的博客记录。地址:http://blog.csdn.net/qiao1245/article/details/44650929

最近配置了JAVA和Scala的环境变量,发现自己对Linux下 /etc/profile、/etc/bashrc、~/.bashrc的区别不是特别清楚,特此查阅了相关资料,整理下来,供以后查阅。如有错误之处,还望各位朋友批评指正。 
①/etc/profile: 
该文件登录操作系统时,为每个用户设置环境信息,当用户第一次登录时,该文件被执行。也就是说这个文件对每个shell都有效,用于获取系统的环境信息。

 

  1. # /etc/profile
  2.  
  3. # System wide environment and startup programs, for login setup
  4. # Functions and aliases go in /etc/bashrc
  5.  
  6. # It's NOT a good idea to change this file unless you know what you
  7. # are doing. It's much better to create a custom.sh shell script in
  8. # /etc/profile.d/ to make custom changes to your environment, as this
  9. # will prevent the need for merging in future updates.

②/etc/bashrc: 
为每一个运行bash shell的用户执行此文件,当bash shell被打开时,该文件被读取。也就是说,当用户shell执行了bash时,运行这个文件。

  1. # /etc/bashrc
  2.  
  3. # System wide functions and aliases
  4. # Environment stuff goes in /etc/profile
  5.  
  6. # It's NOT a good idea to change this file unless you know what you
  7. # are doing. It's much better to create a custom.sh shell script in
  8. # /etc/profile.d/ to make custom changes to your environment, as this
  9. # will prevent the need for merging in future updates.

③~/.bashrc 
该文件存储的是专属于个人bash shell的信息,当登录时以及每次打开一个新的shell时,执行这个文件。在这个文件里可以自定义用户专属的个人信息。

那么在用户登录系统时候,相关的文件执行顺序是什么呢。 
在刚登录Linux时,首先启动 /etc/profile 文件,然后再启动用户目录下的 ~/.bash_profile、 ~/.bash_login或 ~/.profile文件中的其中一个,执行的顺序为:~/.bash_profile、 ~/.bash_login、 ~/.profile。如果 ~/.bash_profile文件存在的话,一般还会执行 ~/.bashrc文件

 

 

 

 

2)python不同版本切换命令:

vim --version 查看是否支持 python

sudo update-alternatives --config vim 可以让你在 python 和 python3 之间切换

 

 

 

 

 

3)使用anaconda 安装caffe

conda install -c anaconda3/ caffe





4)安装和卸载程序:
1在终端里 apt-get安装的软件:

安装软件sudo  apt-get install softname1 softname2softname3……

卸载软件 sudo apt-get remove softname1 softname2 softname3……

卸载并清除配置sudo  apt-get remove --purgesoftname1

更新软件信息数据库 sudo apt-get update

进行系统升级sudo  apt-get upgrade, sudo apt-get distupgrade

搜索软件包 sudo apt-cache search softname1 softname2 softname3……

2安装的deb包要用此方法:

安装deb软件包 dpkg -i xxx.deb

删除软件包 dpkg -r xxx.deb

连同配置文件一起删除 dpkg -r --purge xxx.deb

查看软件包信息 dpkg -info xxx.deb

查看文件拷贝详情 dpkg -L xxx.deb

查看系统中已安装软件包信息 dpkg -l

重新配置软件包 dpkg-reconfigure xxx

4在“synaptic pakagemanager”里:

点搜索,输入软件名

在需要安装或卸载的软件上右击-点标记-最后点应用

5现在还可以在 software center里面,直接卸载

6卸载源代码编译的的软件:

cd 源代码目录

make clean

./configure

(make)

make uninstall

rm -rf 目录

清理系统:

sudo apt-get autoclean

sudo apt-get clean

sudo apt-get autoremove

(或使用ubuntu-tweak清理)
posted @   水木清扬  阅读(204)  评论(0编辑  收藏  举报
编辑推荐:
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
点击右上角即可分享
微信分享提示