Nguồn
http://www.familug.org/2013/09/cli-cac-lenh-quan-ly-package-tren.html#more
1. Tìm tên Package:
~ $ apt-cache search ten-chuong-trinh
Tên của chương trình không có nghĩa là tên của package đó
mà muốn cài đặt một chương trình thì bạn phải biết được tên package của chương trình đó
ví dụ bạn muốn cài flak - một micro web flamework
thanhnguyen1010@thanhnguyen1010-Satellite-L640:~$ sudo apt-get install flask
[sudo] password for thanhnguyen1010:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package flask
không có tên package nào là flask
để tìm tên package:
thanhnguyen1010@thanhnguyen1010-Satellite-L640:~$ apt-cache search flask
libselinux1 - SELinux runtime shared libraries
libselinux1-dev - SELinux development headers
libsepol1 - SELinux library for manipulating binary security policies
checkpolicy - SELinux policy compiler
libsemanage-common - Common files for SELinux policy management libraries.
libsemanage-ruby1.8 - Ruby bindings to for SELinux policy management
libsemanage1 - SELinux policy management library.
libsemanage1-dev - Header files and libraries for SELinux policy manipulation
policycoreutils - SELinux core policy utilities
python-flask - micro web framework based on Werkzeug, Jinja2 and good intentions
python-flaskext.wtf - Simple integration of Flask and WTForms
python-selinux - Python bindings to SELinux shared libraries
python-semanage - Python bindings for SELinux policy management
python-uwsgicc - uWSGI control center
ruby-selinux - Ruby bindings to SELinux shared libraries
==> để cài flask, bạn phải cài:
~$ apt-cache search python-flask
done
bonus: bạn có thể dùng ' | grep keyword' để kết quả chi tiết hơn
vd :
thanhnguyen1010@thanhnguyen1010-Satellite-L640:~$ apt-cache search flask | grep python
python-flask - micro web framework based on Werkzeug, Jinja2 and good intentions
python-flaskext.wtf - Simple integration of Flask and WTForms
python-selinux - Python bindings to SELinux shared libraries
python-semanage - Python bindings for SELinux policy management
python-uwsgicc - uWSGI control center
2. Hiện thông tin về một package
~$ apt-cache show tên-package
ví dụ:
thanhnguyen1010@thanhnguyen1010-Satellite-L640:~$ apt-cache show python-flask
Package: python-flask
Priority: optional
Section: universe/python
Installed-Size: 596
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Piotr Ożarowski <piotr@debian.org>
Architecture: all
Source: flask
Version: 0.8-1
Depends: python2.7, python (>= 2.7.1-0ubuntu2), python (<< 2.8), python-werkzeug (>= 0.8), python-jinja2 (>= 2.4)
Recommends: python-pkg-resources
Filename: pool/universe/f/flask/python-flask_0.8-1_all.deb
Size: 71162
MD5sum: 4fdf6149d8517e7f9fe18075de845e72
SHA1: 9c2081930892e72298101001cfb6bb8fda56220a
SHA256: a14dd76a725c1cd2b3140c264fd6ff3fbf8e2147e6bd09daca866e50a27d0d0a
Description-en: micro web framework based on Werkzeug, Jinja2 and good intentions
Flask is a micro web framework for Python based on Werkzeug, Jinja 2 and good
intentions. A minimal Flask application looks like that:
.
from flask import Flask
app = Flask(__name__)
.
@app.route("/")
def hello():
return "Hello World!"
.
if __name__ == '__main__':
app.run()
Homepage: http://flask.pocoo.org/
Description-md5: af80b4121514ac9080cae2382910000f
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Origin: Ubuntu
Tương tự, để tìm hiểu chi tiết hơn về một attribute của package đó bạn dùng
"| grep"
ví dụ:
thanhnguyen1010@thanhnguyen1010-Satellite-L640:~$ apt-cache show python-flask | grep Version
Version: 0.8-1
3. Danh sách các package đã cài:
~$ dpkg -l
chi tiết hơn về các package có liên quan đến vim, nghĩa là có từ Vim trong tên package hoặc phần mô tả:
$ dpkg -l '*vim*'
ví dụ:
thanhnguyen1010@thanhnguyen1010-Satellite-L640:~$ dpkg -l '*vim*'
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Description
+++-==============-==============-============================================
ii vim 2:7.3.429-2ubu Vi IMproved - enhanced vi editor
un vim-athena <none> (no description available)
ii vim-common 2:7.3.429-2ubu Vi IMproved - Common files
un vim-doc <none> (no description available)
un vim-gnome <none> (no description available)
un vim-gtk <none> (no description available)
un vim-nox <none> (no description available)
ii vim-runtime 2:7.3.429-2ubu Vi IMproved - Runtime files
un vim-scripts <none> (no description available)
ii vim-tiny 2:7.3.429-2ubu Vi IMproved - enhanced vi editor - compact v
hoặc
thanhnguyen1010@thanhnguyen1010-Satellite-L640:~$ dpkg -l | grep vim
ii vim 2:7.3.429-2ubuntu2.1 Vi IMproved - enhanced vi editor
ii vim-common 2:7.3.429-2ubuntu2.1 Vi IMproved - Common files
ii vim-runtime 2:7.3.429-2ubuntu2.1 Vi IMproved - Runtime files
ii vim-tiny 2:7.3.429-2ubuntu2.1 Vi IMproved - enhanced vi editor - compact version
4. Tên các thư mục trong package
~$ dpkg -L ten_package
ví dụ:
thanhnguyen1010@thanhnguyen1010-Satellite-L640:~$ dpkg -L Vim
/.
/usr
/usr/bin
/usr/bin/vim.basic
/usr/share
/usr/share/bug
/usr/share/bug/vim
/usr/share/bug/vim/presubj
/usr/share/bug/vim/script
/usr/share/lintian
/usr/share/lintian/overrides
/usr/share/lintian/overrides/vim
/usr/share/doc
/usr/share/doc/vim
Với các package có nhiều file, ban có thể thêm "| head" để hiển thị 10 file đầu tiên
thanhnguyen1010@thanhnguyen1010-Satellite-L640:~$ dpkg -L ipython | head
/.
/usr
/usr/bin
/usr/bin/ipcluster
/usr/bin/ipcontroller
/usr/bin/ipengine
/usr/bin/iplogger
/usr/bin/ipython
/usr/bin/irunner
/usr/bin/pycolor
http://www.familug.org/2013/09/cli-cac-lenh-quan-ly-package-tren.html#more
1. Tìm tên Package:
~ $ apt-cache search ten-chuong-trinh
Tên của chương trình không có nghĩa là tên của package đó
mà muốn cài đặt một chương trình thì bạn phải biết được tên package của chương trình đó
ví dụ bạn muốn cài flak - một micro web flamework
thanhnguyen1010@thanhnguyen1010-Satellite-L640:~$ sudo apt-get install flask
[sudo] password for thanhnguyen1010:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package flask
không có tên package nào là flask
để tìm tên package:
thanhnguyen1010@thanhnguyen1010-Satellite-L640:~$ apt-cache search flask
libselinux1 - SELinux runtime shared libraries
libselinux1-dev - SELinux development headers
libsepol1 - SELinux library for manipulating binary security policies
checkpolicy - SELinux policy compiler
libsemanage-common - Common files for SELinux policy management libraries.
libsemanage-ruby1.8 - Ruby bindings to for SELinux policy management
libsemanage1 - SELinux policy management library.
libsemanage1-dev - Header files and libraries for SELinux policy manipulation
policycoreutils - SELinux core policy utilities
python-flask - micro web framework based on Werkzeug, Jinja2 and good intentions
python-flaskext.wtf - Simple integration of Flask and WTForms
python-selinux - Python bindings to SELinux shared libraries
python-semanage - Python bindings for SELinux policy management
python-uwsgicc - uWSGI control center
ruby-selinux - Ruby bindings to SELinux shared libraries
==> để cài flask, bạn phải cài:
~$ apt-cache search python-flask
done
bonus: bạn có thể dùng ' | grep keyword' để kết quả chi tiết hơn
vd :
thanhnguyen1010@thanhnguyen1010-Satellite-L640:~$ apt-cache search flask | grep python
python-flask - micro web framework based on Werkzeug, Jinja2 and good intentions
python-flaskext.wtf - Simple integration of Flask and WTForms
python-selinux - Python bindings to SELinux shared libraries
python-semanage - Python bindings for SELinux policy management
python-uwsgicc - uWSGI control center
2. Hiện thông tin về một package
~$ apt-cache show tên-package
ví dụ:
thanhnguyen1010@thanhnguyen1010-Satellite-L640:~$ apt-cache show python-flask
Package: python-flask
Priority: optional
Section: universe/python
Installed-Size: 596
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Piotr Ożarowski <piotr@debian.org>
Architecture: all
Source: flask
Version: 0.8-1
Depends: python2.7, python (>= 2.7.1-0ubuntu2), python (<< 2.8), python-werkzeug (>= 0.8), python-jinja2 (>= 2.4)
Recommends: python-pkg-resources
Filename: pool/universe/f/flask/python-flask_0.8-1_all.deb
Size: 71162
MD5sum: 4fdf6149d8517e7f9fe18075de845e72
SHA1: 9c2081930892e72298101001cfb6bb8fda56220a
SHA256: a14dd76a725c1cd2b3140c264fd6ff3fbf8e2147e6bd09daca866e50a27d0d0a
Description-en: micro web framework based on Werkzeug, Jinja2 and good intentions
Flask is a micro web framework for Python based on Werkzeug, Jinja 2 and good
intentions. A minimal Flask application looks like that:
.
from flask import Flask
app = Flask(__name__)
.
@app.route("/")
def hello():
return "Hello World!"
.
if __name__ == '__main__':
app.run()
Homepage: http://flask.pocoo.org/
Description-md5: af80b4121514ac9080cae2382910000f
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Origin: Ubuntu
Tương tự, để tìm hiểu chi tiết hơn về một attribute của package đó bạn dùng
"| grep"
ví dụ:
thanhnguyen1010@thanhnguyen1010-Satellite-L640:~$ apt-cache show python-flask | grep Version
Version: 0.8-1
3. Danh sách các package đã cài:
~$ dpkg -l
chi tiết hơn về các package có liên quan đến vim, nghĩa là có từ Vim trong tên package hoặc phần mô tả:
$ dpkg -l '*vim*'
ví dụ:
thanhnguyen1010@thanhnguyen1010-Satellite-L640:~$ dpkg -l '*vim*'
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Description
+++-==============-==============-============================================
ii vim 2:7.3.429-2ubu Vi IMproved - enhanced vi editor
un vim-athena <none> (no description available)
ii vim-common 2:7.3.429-2ubu Vi IMproved - Common files
un vim-doc <none> (no description available)
un vim-gnome <none> (no description available)
un vim-gtk <none> (no description available)
un vim-nox <none> (no description available)
ii vim-runtime 2:7.3.429-2ubu Vi IMproved - Runtime files
un vim-scripts <none> (no description available)
ii vim-tiny 2:7.3.429-2ubu Vi IMproved - enhanced vi editor - compact v
hoặc
thanhnguyen1010@thanhnguyen1010-Satellite-L640:~$ dpkg -l | grep vim
ii vim 2:7.3.429-2ubuntu2.1 Vi IMproved - enhanced vi editor
ii vim-common 2:7.3.429-2ubuntu2.1 Vi IMproved - Common files
ii vim-runtime 2:7.3.429-2ubuntu2.1 Vi IMproved - Runtime files
ii vim-tiny 2:7.3.429-2ubuntu2.1 Vi IMproved - enhanced vi editor - compact version
4. Tên các thư mục trong package
~$ dpkg -L ten_package
ví dụ:
thanhnguyen1010@thanhnguyen1010-Satellite-L640:~$ dpkg -L Vim
/.
/usr
/usr/bin
/usr/bin/vim.basic
/usr/share
/usr/share/bug
/usr/share/bug/vim
/usr/share/bug/vim/presubj
/usr/share/bug/vim/script
/usr/share/lintian
/usr/share/lintian/overrides
/usr/share/lintian/overrides/vim
/usr/share/doc
/usr/share/doc/vim
Với các package có nhiều file, ban có thể thêm "| head" để hiển thị 10 file đầu tiên
thanhnguyen1010@thanhnguyen1010-Satellite-L640:~$ dpkg -L ipython | head
/.
/usr
/usr/bin
/usr/bin/ipcluster
/usr/bin/ipcontroller
/usr/bin/ipengine
/usr/bin/iplogger
/usr/bin/ipython
/usr/bin/irunner
/usr/bin/pycolor
4. Tên các thư mục trong package
Trả lờiXóa=> sai.
chưa nói đến nhiều chỗ sai trong câu này, cái sai to nhất là "thư mục" trong khi nó trả về cả file.
VD: /usr/bin/irunner