Linux下和硬件相关的命令

Category: /knowledge /linux
Tags: linux

Hard disk

查看硬盘信息

  • SATA

    smartctl -i /dev/sda sudo hdparm -I /dev/sda -tT: test read speed 测试硬盘读取速度时有用

  • IDE

    find /proc/ide/ide[0-9]/hd? -type f -name model -exec cat {} \;

  • SCSI硬盘

    cat /proc/scsi/scsi

总写入量 – Total Bytes Written (TBW)

http://serverfault.com/questions/238033/measuring-total-bytes-written-under-linux

关于 /proc/diskstats

Field 1 -- # of reads issued
Field 2 -- # of reads merged, field 6 -- # of writes merged
Field 3 -- # of sectors read
Field 4 -- # of milliseconds spent reading
Field 5 -- # of writes completed
Field 7 -- # of sectors written
Field 8 -- # of milliseconds spent writing
Field 9 -- # of I/Os currently in progress
Field 10 -- # of milliseconds spent doing I/Os
Field 11 -- weighted # of milliseconds spent doing I/Os

sysstat

sudo aptitude install sysstat
sudo iostat

下面是我的传统硬盘的参数(以MB为单位):

Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
sda               4.81        56.35        45.71   67161429   54478969

如果你的文件系统是ext4, 还可以试

/sys/fs/ext4/sd(a|b|c)/lifetime_write_kbytes

格式化硬盘

sudo mkfs.ext4 -b 1024 -E stride=128,stripe-width=128 /dev/sdb1
-O ^has_journal: 关闭journaling feature

图片来源

Keyboard

Key mappings

  • run xev to catch keycodes
  • open ~/.xmodmap

    keycode 94 = Alt_L

  • to get a list of current mappings

    xmodmap -pke

If you want to switch Esc and Caps Lock,

remove Lock = Caps_Lock
remove Control = Escape 
keysym Escape = Caps_Lock
keysym Caps_Lock = Escape
add Control = Escape 
add Lock = Caps_Lock

If you want rotate Esc, Caps_Lock and Control_L, do

remove Lock = Caps_Lock
remove Control = Control_L
remove Control = Escape

keysym Escape = Caps_Lock
keysym Caps_Lock = Control_L
keysym Control_L = Escape

add Control = Escape
add Control = Control_L
add Lock = Caps_Lock

Monitor

setup undetected resolution ———————————

cvt 1680 1050
# 1680x1050 59.95 Hz (CVT 1.76MA) hsync: 65.29 kHz; pclk: 146.25 MHz
Modeline "1680x1050_60.00"  146.25  1680 1784 1960 2240  1050 1053 1059 1089 -hsync +vsync

xrandr --newmode "1680x1050_60.00"  146.25  1680 1784 1960 2240  1050 1053 1059 1089 -HSync +VSync
xrandr --addmode VGA1 1680x1050_60.00
xrandr --output VGA1 --mode "1680x1050_60.00"

Setup SD card within laptop

first, find the card,

lspci
08:00.0 System peripheral: JMicron Technology Corp. SD/MMC Host Controller

then, test it out

sudo modprobe tifm_sd

try to insert a SD card into the slot. If you can see the light flashes and the file manager pops up the drive, it works, then add the info to system config.

sudo vi /etc/modules
add the following line to the file
tifm_sd    

评论

提示

  • 如果看不到评论部分, 请暂时关掉adblock in Firefox/Chrome
  • 本网站使用Javascript实现评论功能, 此处外链对提高您的网站PR没有帮助. (潜台词: 请不要灌水, 谢谢)