簡單說,執行以下命令就可大部分重建回來:
cd /dev; sudo /sbin/MAKEDEV generic若你想先確認這個指令做了哪些動作,可以加 "-n -v" 參數做一次 dry run (也就是沒有實際產生作用的演練,只看看輸出訊息)。
實際情況是,你不見得可以執行上述命令。譬如說,還沒關機就發現此狀況,但 terminal 已經開不起來;或關機了,可能就再也無法開機等等。這些狀況的應變太瑣碎,就不多談了。
靠軟體謀生真不易... 勤作筆記,幫助記憶...
cd /dev; sudo /sbin/MAKEDEV generic若你想先確認這個指令做了哪些動作,可以加 "-n -v" 參數做一次 dry run (也就是沒有實際產生作用的演練,只看看輸出訊息)。
wakeonlan 00:11:22:33:44:55 #這裡請改成被叫者的網路卡位址沒有成功?請查被叫者的電源線是否接好且有電,以及網路線是否有 link 燈號且跟叫人者有連接起來。若以上都確認沒問題,也許查查叫人者 PC 是否有兩張網路卡。wakeonlan 似乎不能控制由哪張網路卡送出 WOL magic packet,以下方法可解決這個問題:
wakeonlan -i 192.168.0.255 00:11:22:33:44:55
sudo arp -i eth1 -s 192.168.0.1 00:11:22:33:44:55
wakeonlan -i 192.168.0.1 00:11:22:33:44:55
--- /etc/ssl/openssl.cnf 2012-04-20 00:29:01.000000000 +0800我不確定這樣改有多少影響。建議 key 產生完畢後再改回原來的設定。
+++ /etc/ssl/openssl.cnf 2014-03-14 16:11:58.225994353 +0800
@@ -237,7 +237,7 @@
# extensions.
#basicConstraints = critical,CA:true
# So we do this instead.
-basicConstraints = CA:true
+basicConstraints = CA:false
# Key usage: this is typical for a CA certificate. However since it
# prevent it being used as an test self-signed certificate it is best
sudo apt-get install lame
ls *.wav | sed -e 's/\.wav//' | xargs -i -n 1 lame -h -b 128 "{}.wav" "{}.mp3"
$ dmesg | grep tty如上述範例的 device name 的是 ttyUSB0。一般來說,你可能會沒有足夠的權限:
[ 7842.193255] usb 2-2: pl2303 converter now attached to ttyUSB0
$ ls -l /dev/ttyUSB0像上述範例,你如果不是 root,就要把自己加入 dialout 那個 group (修改 /etc/group)。然後就可用自己喜好的 terminal emulator 開始上工了。
crw-rw---- 1 root dialout 188, 0 8月 31 10:33 /dev/ttyUSB0
avconv -i input.mp4 -f mp3 -vn output.mp3若不能成功,可能是缺少 mp3 codec,用以下方法安裝:
sudo apt-get install libavcodec-extra-53不習慣 avconv (亦即之前的 ffmpeg) 命令列的,可以安裝 winff 來用 GUI。
root@ubuntu:~# dmesg | grep eth以上輸出,很清楚看到系統抓的兩張網路卡,eth0 & eth1。有些時候,你會看到 "eth0 is renamed to eth1" 之類的訊息。這時候,你用 ifconfig 去看時,會發現網路界面的名稱跟系統抓到的好像不一致。遇到這種情況,請檢查 /etc/udev/rules.d/70-persistent-net.rules:
[ 1.678186] i2c-core: driver [aat2870] using legacy suspend method
[ 1.678186] i2c-core: driver [aat2870] using legacy resume method
[ 2.718021] via-rhine 0000:01:06.0: eth0: VIA Rhine II at 0xfebffc00, 00:11:22:ab:cd:ed, IRQ 19
[ 2.718735] via-rhine 0000:01:06.0: eth0: MII PHY found at address 8, status 0x782d advertising 01e1 Link cde1
[ 2.726899] forcedeth: Reverse Engineered nForce ethernet driver. Version 0.64.
[ 2.727153] forcedeth 0000:00:0f.0: PCI INT A -> Link[LMAC] -> GSI 20 (level, low) -> IRQ 20
[ 2.727160] forcedeth 0000:00:0f.0: setting latency timer to 64
[ 3.253390] forcedeth 0000:00:0f.0: ifname eth1, PHY OUI 0x732 @ 1, addr 00:33:44:ab:cd:ed
[ 3.253394] forcedeth 0000:00:0f.0: highdma pwrctl mgmt gbit lnktim msi desc-v3
# PCI device 0x1106:/sys/devices/pci0000:00/0000:00:0a.0/0000:01:06.0 (via-rhine)也就是說,網路界面的名稱可被 udev 重新定義。確認網路界面之後 (確認沒有的網路卡,可以直接刪除),就可以設定各個界面的網路型態:
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:11:22:ab:cd:ef", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x10de:/sys/devices/pci0000:00/0000:00:0f.0 (forcedeth)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:33:44:ab:cd:ef", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
root@ubuntu:~# cat /etc/network/interfaces以上範例,eth0 會自動取得 IP,eth1 則自行指定 IP 位址。
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
auto eth1
iface eth1 inet static
address 192.168.1.1
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
echo -ne "\033]0;NEW TITLE\007"若你當場測試,八成會說我騙你。請再試試以下指令:
echo -ne "\033]0;NEW TITLE\007"; read第一個指令看起來無效的原因是因為 bash 在完成你的指令之後,馬上又將他改掉了。第二個指令多加一個 read,就是為了讓你看清楚。利用這個特性,內容如下的 ~/bin/vi 在你用 vi 編輯 hello.c 時分頁 titile 會是 "vi hello.c",讓你一目了然:
#!/bin/bash同樣的方法,你可以應用到 gdb、adb、minicom 等等。
echo -ne "\033]0;vi $*\007"
/usr/bin/vi $*
# If this is an xterm set the title to user@host:dir注意 PS1 定義。其中 \e 和 \a 相當於前面指令的 \033 和 \007、\u 是使用者名稱、\h 是主機名稱、\w 是工作目錄。切換目錄時 title 會跟著改,就是因為 \w 的關係。\w 用在 prompt 很好,但當作 title 就太長了,建議用 \W 當 title,也就是整個路徑的最後一個目錄名稱。
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac
<background>
<starttime>
<year>2003</year>
<month>6</month>
<day>14</day>
<hour>05</hour>
<minute>30</minute>
<second>00</second>
</starttime>
<static>
<duration>1795.0</duration>
<file>/path/to/picture-1.png</file>
</static>
<transition>
<duration>5.0</duration>
<from>/path/to/picture-1.png</from>
<to>/path/to/picture-2.png</to>
</transition>
<static>
<duration>1795.0</duration>
<file>/path/to/picture-2.png</file>
</static>
<transition>
<duration>5.0</duration>
<from>/path/to/picture-2.png</from>
<to>/path/to/picture-1.png</to>
</transition>
</background>
其中:gsettings set org.gnome.desktop.background picture-uri 'file:///path/to/wallpaper.xml'
dpkg -i libmp4v2-0_1.6dfsg-0.2ubuntu9_amd64.deb
dpkg -i libmpeg4ip-0_1.6dfsg-0.2ubuntu9_amd64.deb
dpkg -i mpeg4ip-utils_1.6dfsg-0.2ubuntu9_amd64.deb
printer_PostScript/default.print_footercenter =>以上是將列印檔名預設為 firefox.pdf,頁首頁尾設成空白。若你的設定不一樣,要先在列印對話框的 Options 做好設定列印一次,再重新進入 about:config。找出以下看起來是亂碼的設定項目:
printer_PostScript/default.print_footerleft =>
printer_PostScript/default.print_footerright =>
printer_PostScript/default.print_headercenter =>
printer_PostScript/default.print_headerleft =>
printer_PostScript/default.print_headerright =>
printer_PostScript/default.print_to_filename => ~/firefox.pdf
printer_Ã¥ÂÂå°è³æªÂæ¡Â.print_...就可以看出設定字串如何寫 (譬如 "&T"),將此字串複製到 default.print 對應那一部份就可以了。
unzip -O big5 your_compressed_file.zipPS: 我發現 Ubuntu 10.04 的 unzip 已經移除 -O 的功能 (怪怪~~稍微新或舊一點的版本卻都有)。需要此功能的朋友,可以到以下頁面下載稍微新一點的版本來用:
http://packages.ubuntu.com/oneiric/unzip
sudo apt-get install compizconfig-settings-manager執行 ccsm 之後,找到 Ubuntu Unity Plugin > Experimental 的 Launcher icon size,就可自由調整 (最小 32 點)。
sudo apt-get install sni-qt:i386Ubuntu 12.04 之前的版本,解法需先安裝 dconf-tools 這個套件:
sudo apt-get install dconf-tools接著執行 dconf-editor 並找到 com.canonical.Unity.Panel.systray-whitelist (較新的作法) 或 desktop.unity.panel.systray-whitelist (較舊的作法),然後在最後加上 'Skype' 即可 (需登出再登入)。例如:
['JavaEmbeddedFrame', 'Wine', 'scp-dbus-service', 'Update-notifier', 'Skype']
pcscd: readerfactory.c:965:RFInitializeReader() Open Port 0x200000 Failed (USB:0CA6/0010:LIBUDEV:0:/DEV/BUS/USB/004/002)
pcscd: readerfactory.c:275:RFAddReader() CASTLES EZ100PU init failed.
pcscd: hotplug_libudev.c:377:HPAddDevice() Failed adding USB device: CASTLES EZ100PU
這問題有兩個解法:第一個較簡單,第二個較安全。# DO NOT start the daemon on startup解法二是較安全的方式,是以使用者身份動態執行 pcscd,但你必須賦予這台讀卡機特殊的權限。作法是新建一個檔案:/etc/udev/rules.d/92-pcscd-ccid.rules。內容如下:
# comment the line to have the same behavior as in version < 1.6.0
#exit 0
# If not adding the device, go away注意上面的 idVendor 和 idProduct 必須對應到讀卡機的 USB ID。你可用 lsusb 查出 USB ID,譬如:
ACTION!="add", GOTO="pcscd_ccid_rules_end"
SUBSYSTEM!="usb", GOTO="pcscd_ccid_rules_end"
ENV{DEVTYPE}!="usb_device", GOTO="pcscd_ccid_rules_end"
# Castles Technology Co., Ltd EZUSB PC/SC Smart Card Reader
ATTRS{idVendor}=="0ca6", ATTRS{idProduct}=="0010", GROUP="pcscd"
# All done
LABEL="pcscd_ccid_rules_end"
Bus 003 Device 003: ID 0ca6:0010 Castles Technology Co., Ltd EZUSB PC/SC Smart Card Reader改完後 sudo service udev restart,應該就大功告成了。