メイン

2007年07月22日

Debian / コマンド / df

wikiからの移植です。

ディスクの使用状況を表示するファイルシステムごとに、デバイス名、全容量、使用容量、残り容量、使用割合、マウント先を表示する。

% df -k
Filesystem  1K-blocks     Used    Avail Capacity  Mounted on
/dev/sd0s1a    118959    71251    38192    65%    /
/dev/sd0s1f   3540086  2488705   768175    76%    /usr
/dev/sd0s1e    197951    19640   162475    11%    /var
procfs              4        4        0   100%    /proc
/dev/cd0c      662942   662942        0   100%    /cdrom
オプション:
  • k - 512バイト単位ではなく、1キロバイト単位で表示
  • i - i-node の消費量も表示

i-node はファイルを作成するたびに必ず一つ必要となる。i-node を全て使いつくすと、ディスク容量に空きがあっても新たなファイルを作成できなくなる。iused・ifree・%iused が i-node に関わる情報で、それぞれ「使用中の i-node」「未使用の i-node」「i-node の使用率」である。

Filesystem  1K-blocks     Used    Avail Capacity iused   ifree %iused  Mounted on
/dev/ad0s1a  37352396 16260170 18104036    47%  363569 4464589    8%   /
devfs               1        1        0   100%       0       0  100%   /dev
procfs              4        4        0   100%       1       0  100%   /proc
linprocfs           4        4        0   100%       1       0  100%   /usr/compat/linux/proc
  • H - 人間が読みやすい単位で表示

% df -H Filesystem Size Used Avail Capacity Mounted on /dev/ad0s1a 38G 17G 19G 47% / devfs 1.0K 1.0K 0B 100% /dev procfs 4.1K 4.1K 0B 100% /proc linprocfs 4.1K 4.1K 0B 100% /usr/compat/linux/proc

普通 df コマンドをオプションなしで実行すると、容量が 512 バイト単位で表示されてしまい わかりにくいので、上の例のように -k オプションを使うとよい。また、-k オプションの代わりに環境変数 BLOCKSIZE を設定しておく手もある。

  • help (df --help)
 -a, --all             include filesystems having 0 blocks
     --block-size=SIZE use SIZE-byte blocks
 -h, --human-readable  print sizes in human readable format (e.g., 1K 234M 2G)
 -H, --si              likewise, but use powers of 1000 not 1024
 -i, --inodes          list inode information instead of block usage
 -k, --kilobytes       like --block-size=1024
 -l, --local           limit listing to local filesystems
 -m, --megabytes       like --block-size=1048576
     --no-sync         do not invoke sync before getting usage info (default)
 -P, --portability     use the POSIX output format
     --sync            invoke sync before getting usage info
 -t, --type=TYPE       limit listing to filesystems of type TYPE
 -T, --print-type      print filesystem type
 -x, --exclude-type=TYPE   limit listing to filesystems not of type TYPE
 -v                    (ignored)
     --help            display this help and exit
     --version         output version information and exit

2007年07月15日

aptについて

wikiからの移植です。

apt-get

apt-getは、パッケージの一括管理システム

新しいパッケージの導入

検索語を使って導入するパッケージ名を探す
apt-cache search 検索語

パッケージの状態を調べてどのようなパッケージに依存しているかをチェック

apt-cache show パッケージ名

パッケージのインストール

apt-get install パッケージ名

usr/share/doc/パッケージ名/README.Debianにreadmeがある。その他ドキュメントもusr/share/doc/パッケージ名/にあるのでチェックする

パッケージの削除

apt-get remove パッケージ名

deborphan(必要のなくなったパッケージを調べる) それらもapt-get removeで削除する

コマンドのまとめ

apt-get dist-upgrade
システムを自動的に新バージョンにアップグレードする
apt-get install パッケージ名
パッケージをインストールする
apt-get remove パッケージ名
パッケージをアンインストールする
apt-get update
入手可能なパッケージリストを調べデータベースを更新
apt-get upgrade
パッケージをアップグレードする

apt-lineの編集

etc/apt/sources.list を編集
先頭に'#'でコメントアウトが可能

設定例
deb http://近くのサーバ/archives/linux/debian/debian woody main contrib non-free
deb http://近くのサーバ/archives/linux/debian/debian-non-US woody/non-US main contrib non-free
deb http://security.debian.org/ woody/updates main contrib non-free

最近のエントリー最近のエントリー