汇总Linux命令 --查看环境变量,查看已安装包信息

1,查看,设置环境变量:env,unset, set 

$ env
MAC=64
MANPATH=usr/kerberos/man:/usr/local/share/man:/usr/share/man/en:/usr/share/man:/usr/X11R6/man
HOSTNAME=cp01-rdqa-dev390.cp01.baidu.com
SHELL=/bin/bash
TERM=vt100
HISTSIZE=1000
SSH_CLIENT=172.22.4.12 12919 22
MAVEN_2_2_1=/home/tools/tools/maven/apache-maven-2.2.1/bin
SSH_TTY=/dev/pts/5
MAVEN_3_0_4=/home/tools/tools/maven/apache-maven-3.0.4/bin
ANT_HOME=/home/tools/tools/ant/apache-ant-1.6.5
USER=luye
LS_COLORS=no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=01;32:*.cmd=01;32:*.exe=01;32:*.com=01;32:*.btm=01;32:*.bat=01;32:*.sh=01;32:*.csh=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.bz=01;31:*.tz=01;31:*.rpm=01;31:*.cpio=01;31:*.jpg=01;35:*.gif=01;35:*.bmp=01;35:*.xbm=01;35:*.xpm=01;35:*.png=01;35:*.tif=01;35:
PATH=/home/users/luye/software/android/bin:.....
MAIL=/var/spool/mail/luye
INPUTRC=/etc/inputrc
PWD=/home/users/luye
LANG=en_US
JAVA_HOME_1_6=/home/tools/tools/java/jdk1.6.0_20
JAVA_HOME_1_5=/home/tools/tools/java/jdk1.5.0_07
ANT_HOME_1_7=/home/tools/tools/ant/apache-ant-1.7.1
HOME=/home/users/luye
SHLVL=2
SSH_CONNECTION=172.22.4.12 12919 10.99.37.53 22
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:
LESSOPEN=|/usr/bin/lesspipe.sh %s
HISTTIMEFORMAT=%Y-%m-%d %H:%M:%S 
G_BROKEN_FILENAMES=1
_=/bin/env


使用unset命令来清除环境变量
set可以设置某个环境变量的值。清除环境变量的值用unset命令。如果未指定值,则该变量值将被设为NULL。

2,查看系统已安装包信息(针对Ubuntu系统):

1) dpkg -s 

$ dpkg -s python
Package: python
Status: install ok installed
Priority: important
Section: python
Installed-Size: 640
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Architecture: all
Source: python-defaults
Version: 2.6.5-0ubuntu1
Replaces: python-base, python-xmlbase, python2.3 (<= 2.3.2-6)
Provides: python-ctypes, python-email, python-plistlib, python-wsgiref, python-xmlbase
Depends: python2.6 (>= 2.6.5), python-minimal (= 2.6.5-0ubuntu1)
Suggests: python-doc (>= 2.6.5-0ubuntu1), python-tk (>= 2.6.5-0ubuntu1), python-profiler (>= 2.6.5-0ubuntu1)
Conflicts: libboost-dbg (<< 1.34.1-15ubuntu3), libboost-python-dev (<< 1.34.1-15ubuntu3), libboost-python1.35-dev (<< 1.35.0-8ubuntu5), libboost1.35-dbg (<< 1.35.0-8ubuntu5), pitivi (<< 0.11.3-1ubuntu1), python-aubio (<< 0.3.2-2ubuntu3), python-base, python-bz2, python-central (<< 0.5.5), python-csv, python-freevo (<< 1.8.1-3ubuntu3), python-xmlbase, python2.1 (<= 2.1.2), python2.3 (<< 2.3.5-14), qmtest (<< 2.4-5ubuntu1), ufw (<< 0.27~r416)
Description: An interactive high-level object-oriented language (default version)
 Python, the high-level, interactive object oriented language,
 includes an extensive class library with lots of goodies for
 network programming, system administration, sounds and graphics.
 .
 This package is a dependency package, which depends on Debian's default
 Python version (currently v2.6).
Original-Maintainer: Matthias Klose <doko@debian.org>

2)dpkg-query -l 

$ dpkg-query -l python
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Cfg-files/Unpacked/Failed-cfg/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version        Description
+++-==============-==============-============================================
ii  python         2.6.5-0ubuntu1 An interactive high-level object-oriented la

3)dpkg --get-selections列出系统中所有已安装包

$ dpkg --get-selections|grep python

libpython2.6 install
python install
python-appindicator install
python-apport install
python-apt install
python-aptdaemon install
python-aptdaemon-gtk install
python-avahi install
python-brlapi install
python-cairo install
python-central install
python-configglue install
python-couchdb install
python-crypto install
python-cups install
python-cupshelpers install
python-dbus install
python-debian install
python-desktopcouch install
python-desktopcouch-records install
python-egenix-mxdatetime install
python-egenix-mxtools install
python-farsight install
python-fstab install
python-gconf install
python-gdbm install
python-glade2 install
python-gmenu install
python-gnome2 install
python-gnomeapplet install
python-gnomecanvas install
python-gnomekeyring install
python-gnupginterface install
python-gobject install
python-gst0.10 install
python-gtk2 install
python-gtksourceview2 install
python-gtkspell install
python-httplib2 install
python-ibus install
python-imaging install
python-indicate install
python-launchpad-integration install
python-launchpadlib install
python-lazr.restfulclient install
python-lazr.uri install
python-libxml2 install
python-louis install
python-mako install
python-minimal install
python-newt install
python-notify install
python-oauth install
python-openssl install
python-pam install
python-papyon install
python-pexpect install
python-pkg-resources install
python-problem-report install
python-protobuf install
python-pyatspi install
python-pycurl install
python-pygoocanvas install
python-pyinotify install
python-pyorbit install
python-rdflib install
python-serial install
python-simplejson install
python-smbc install
python-software-properties install
python-speechd install
python-support install
python-telepathy install
python-twisted-bin install
python-twisted-core install
python-twisted-names install
python-twisted-web install
python-ubuntuone install
python-ubuntuone-client install
python-ubuntuone-storageprotocol install
python-uno install
python-virtkey install
python-vte install
python-wadllib install
python-webkit install
python-wnck install
python-xapian install
python-xdg install
python-xkit install
python-zope.interface install
python2.6 install
python2.6-minimal install

4)dpkg -L python  使用“-L”参数来找出包中文件的位置

$ dpkg -L python
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/python
/usr/share/doc/python/faq
/usr/share/doc/python/faq/extending.html
/usr/share/doc/python/faq/general.html
/usr/share/doc/python/faq/gui.html
/usr/share/doc/python/faq/installed.html
/usr/share/doc/python/faq/library.html
/usr/share/doc/python/faq/programming.html
/usr/share/doc/python/faq/windows.html
/usr/share/doc/python/FAQ.html
/usr/share/doc/python/python-policy.html
/usr/share/doc/python/python-policy.html/index.html
/usr/share/doc/python/python-policy.html/ch-python.html
/usr/share/doc/python/python-policy.html/ch-module_packages.html
/usr/share/doc/python/python-policy.html/ch-programs.html
/usr/share/doc/python/python-policy.html/ch-embed.html
/usr/share/doc/python/python-policy.html/ch-other.html
/usr/share/doc/python/python-policy.html/ap-build_dependencies.html
/usr/share/doc/python/python-policy.html/ap-packaging_tools.html
/usr/share/doc/python/python-policy.html/ap-upgrade.html
/usr/share/doc/python/python-policy.txt.gz
/usr/share/doc/python/changelog.Debian.gz
/usr/share/doc/python/README.Debian
/usr/share/doc/python/copyright
/usr/share/doc/python/python-policy.sgml.gz
/usr/share/doc/python2.6
/usr/share/python
/usr/share/python/python.mk
/usr/share/man
/usr/share/man/man1
/usr/share/pixmaps
/usr/share/apps
/usr/share/apps/konsole
/usr/share/apps/konsole/python.desktop
/usr/share/doc-base
/usr/share/doc-base/python-policy
/usr/bin
/usr/lib
/usr/lib/valgrind
/usr/lib/valgrind/python.supp
/usr/share/doc/python2.6/python-policy.html
/usr/share/doc/python2.6/python-policy.sgml.gz
/usr/share/doc/python2.6/python-policy.txt.gz
/usr/share/man/man1/pydoc.1.gz
/usr/share/man/man1/pygettext.1.gz
/usr/share/man/man1/pdb.1.gz
/usr/share/pixmaps/python.xpm
/usr/share/pixmaps/idle.xpm
/usr/bin/pyversions
/usr/bin/pydoc
/usr/bin/pygettext
/usr/bin/pdb
/usr/bin/2to3

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值