アラのアラアラしい日記

こっそりかいてます

ubuntuのapt commandが頼もしくなって帰ってきててすごい

先日久しぶりにubuntuを触っていたら、package管理で気づいてしまいました。

すっかりMacのhomebrewに慣れてしまっていたので、
brew searchの乗りでapt-get searchと打ち込んでみると

$ apt-get search git
E: Invalid operation search

怒られました。

ふぁっ?!ってなって探してみると、

$ apt-get --help
~~(略)~~
Commands:
   update - Retrieve new lists of packages
   upgrade - Perform an upgrade
   install - Install new packages (pkg is libc6 not libc6.deb)
   remove - Remove packages
   autoremove - Remove automatically all unused packages
   purge - Remove packages and config files
   source - Download source archives
   build-dep - Configure build-dependencies for source packages
   dist-upgrade - Distribution upgrade, see apt-get(8)
   dselect-upgrade - Follow dselect selections
   clean - Erase downloaded archive files
   autoclean - Erase old downloaded archive files
   check - Verify that there are no broken dependencies
   changelog - Download and display the changelog for the given package
   download - Download the binary package into the current directory

packageを探せそうなcommandがありません。
実はこれ、探すときはapt-cacheというのを使います。

$ apt-cache search OKOME

ちなみにapt-cacheは他に以下のようなコマンドが使えます。

$ apt-cache --help
~~(略)~~
Commands:
   gencaches - Build both the package and source cache
   showpkg - Show some general information for a single package
   showsrc - Show source records
   stats - Show some basic statistics
   dump - Show the entire file in a terse form
   dumpavail - Print an available file to stdout
   unmet - Show unmet dependencies
   search - Search the package list for a regex pattern
   show - Show a readable record for the package
   depends - Show raw dependency information for a package
   rdepends - Show reverse dependency information for a package
   pkgnames - List the names of all packages in the system
   dotty - Generate package graphs for GraphViz
   xvcg - Generate package graphs for xvcg
   policy - Show policy settings

なんかわかんなくなっちゃうな〜と思いながら調べていたら、
ubuntu14.04からapt commandというものが出たという情報を仕入れました。

このapt commandは、今までapt-◯◯◯と入力していたそれぞれを、
一つに統合してくれています。要するにbrew searchのノリでいけます。

aptと入力すると以下のようにヘルプが表示されます。

$ apt
apt 1.0.1ubuntu2 for amd64 compiled on Oct 28 2014 20:55:14
Usage: apt [options] command

CLI for apt.
Basic commands:
 list - list packages based on package names
 search - search in package descriptions
 show - show package details

 update - update list of available packages

 install - install packages
 remove  - remove packages

 upgrade - upgrade the system by installing/upgrading packages
 full-upgrade - upgrade the system by removing/installing/upgrading packages

 edit-sources - edit the source information file

検索もapt search OKOMEと打てるので楽勝です。

search-result
しかも検索結果やinstall中の表示も色分けされていて、
見やすくなっています。

とても使いやすくなっていて心がぴょんぴょんしました。
まだ基本のところしか使っていませんが、これから色々見ていこうと思います。

あと、Macでの開発をメインに行っていましたが
vagrant等でこちらも積極的に使っていきたいと思いました。


おしまい!