トップ  >  コマンドメモ

コマンドのメモ

便利だけど普段使わないコマンドなので忘れないようにメモ

  • ファイルまたはファイルシステムの状態表示

    ファイルの作成、更新、アクセス日時がわかる

    stat ファイル名
    # stat test.txt
      File: `test.txt'
      Size: 18              Blocks: 8          IO Block: 4096   通常ファイル
    Device: fd00h/64768d    Inode: 558829      Links: 1
    Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
    Access: 2010-01-02 00:00:00.000000000 +0900
    Modify: 2010-01-01 00:00:00.000000000 +0900
    Change: 2010-01-01 00:00:00.000000000 +0900
    

    ※Linuxでは無いけど、AIXの場合は

    istat ファイル名
    # istat smit.log 
    デバイス 10/5 上の Inode 1086   ファイル
    保護 : rw-r--r--        
    所有者 : 0(root)                グループ : 0(system)
    リンク・カウント :   1          長さ 46933683 バイト
    
    最後の更新:     Fri Jan  1 00:00:00 JST 2010
    最後の修正:     Fri Jan  1 00:00:00 JST 2010
    最後のアクセス: Sat Jan  2 00:00:00 JST 2010
    
  • ハードウェア構成情報を表示する

    BIOSや、ハードウェアベンダー、型番等を確認できる

    dmidecode
    # dmidecode 
    # dmidecode 2.10
    SMBIOS 2.4 present.
    45 structures occupying 1729 bytes.
    Table at 0x000E4010.
    
    Handle 0x0000, DMI type 0, 24 bytes
    BIOS Information
            Vendor: Phoenix Technologies LTD
            Version: 6.00
            Release Date: 07/29/2008
            Address: 0xEA6C0
            Runtime Size: 88384 bytes
            ROM Size: 64 kB
            Characteristics:
                    ISA is supported
                    PCI is supported
                    PC Card (PCMCIA) is supported
                    PNP is supported
                    APM is supported
                    BIOS is upgradeable
                    BIOS shadowing is allowed
                    ESCD support is available
                    USB legacy is supported
                    Smart battery is supported
                    BIOS boot specification is supported
                    Targeted content distribution is supported
            BIOS Revision: 4.6
            Firmware Revision: 0.0
    
    ~~略~~
    Handle 0x002C, DMI type 127, 4 bytes
    End Of Table
    
  • ディレクトリのパーミッション・オーナーの階層表示

    ※テキストに貼り付けて保存後、エクセル等で開くと幸せかも

    find パス -name "*" -type d -ls | sort -k11 | awk '{print $3,$5,$6,$11}' | sed s/" "/,/g
    # find /home/ -name "*" -type d -ls | sort -k11 | awk '{print $3,$5,$6,$11}' | sed s/" "/,/g
    drwxr-xr-x,root,root,/home/
    drwx------,test,test,/home/test
    drwxr-xr-x,test,test,/home/test/.mozilla
    drwxr-xr-x,test,test,/home/test/.mozilla/plugins
    drwxr-xr-x,test,test,/home/test/.mozilla/extensions
    
  • CPU別の負荷出力

    ※sysstatのパッケージが必要

    mpstat -P CPU番号 取得間隔(省略可)
    # mpstat -P ALL
    Linux 2.6.18-164.el5 (localhost)         2001年01月01日
    
    00時00分00秒     CPU   %user   %nice    %sys %iowait    %irq   %soft  %steal   %idle    intr/s
    00時00分00秒     all    0.05    0.00    0.04    0.02    0.00    0.02    0.00   99.86    711.43
    00時00分00秒       0    0.06    0.00    0.05    0.01    0.00    0.00    0.00   99.88    191.83
    00時00分00秒       1    0.06    0.00    0.03    0.09    0.00    0.01    0.00   99.81     28.28
    00時00分00秒       2    0.08    0.00    0.03    0.09    0.00    0.01    0.00   99.78     27.78
    00時00分00秒       3    0.06    0.00    0.03    0.07    0.00    0.01    0.00   99.82     26.87
    00時00分00秒       4    0.06    0.00    0.03    0.03    0.00    0.01    0.00   99.86     16.91
    00時00分00秒       5    0.04    0.00    0.02    0.02    0.00    0.00    0.00   99.91      8.60
    00時00分00秒       6    0.02    0.00    0.03    0.05    0.00    0.00    0.00   99.90      0.51
    00時00分00秒       7    0.01    0.00    0.01    0.03    0.00    0.00    0.00   99.96      0.29
    00時00分00秒       8    0.01    0.00    0.01    0.01    0.00    0.00    0.00   99.97      0.09
    00時00分00秒       9    0.01    0.00    0.00    0.01    0.00    0.00    0.00   99.98      0.06
    00時00分00秒      10    0.01    0.00    0.01    0.00    0.00    0.00    0.00   99.98      0.03
    00時00分00秒      11    0.01    0.00    0.01    0.00    0.00    0.00    0.00   99.99      0.00
    00時00分00秒      12    0.06    0.00    0.03    0.00    0.00    0.00    0.00   99.91      0.00
    00時00分00秒      13    0.13    0.00    0.13    0.04    0.00    0.13    0.00   99.58     28.21
    00時00分00秒      14    0.11    0.00    0.08    0.02    0.00    0.03    0.00   99.76     29.28
    00時00分00秒      15    0.10    0.00    0.07    0.02    0.00    0.03    0.00   99.78     40.69
    00時00分00秒      16    0.10    0.00    0.06    0.01    0.00    0.02    0.00   99.80     69.81
    00時00分00秒      17    0.07    0.00    0.04    0.01    0.00    0.02    0.00   99.85     96.94
    00時00分00秒      18    0.02    0.00    0.02    0.01    0.00    0.01    0.00   99.94      0.12
    00時00分00秒      19    0.09    0.00    0.10    0.02    0.00    0.13    0.00   99.66     18.91
    00時00分00秒      20    0.07    0.00    0.07    0.01    0.00    0.03    0.00   99.82     19.26
    00時00分00秒      21    0.06    0.00    0.06    0.00    0.00    0.02    0.00   99.86     19.80
    00時00分00秒      22    0.05    0.00    0.04    0.00    0.00    0.02    0.00   99.88     23.08
    00時00分00秒      23    0.02    0.00    0.02    0.00    0.00    0.02    0.00   99.94     64.08
    
プリンタ用画面
友達に伝える
前
シェルスクリプト:サンプル
カテゴリートップ
Linux
次
viメモ