How to check battery status in cli under Debian/Ubuntu based Linux?

You may need to install upower via sudo apt-get install upower first

Use upower with parameter -e / --enumerate to list the devices:

peter@peter-MacBookPro ~ $ upower -e
/org/freedesktop/UPower/devices/line_power_ADP1
/org/freedesktop/UPower/devices/battery_BAT0

Then use -i / --show-info with the device path to show the details

peter@peter-MacBookPro ~ $ upower --show-info /org/freedesktop/UPower/devices/battery_BAT0
native-path: BAT0
vendor: *********************************
model: *********************************
power supply: yes
updated: Sat 14 Feb 2015 04:11:52 PM CST (9 seconds ago)
has history: yes
has statistics: yes
battery
present: yes
rechargeable: yes
state: discharging
energy: 7.63 Wh
energy-empty: 0 Wh
energy-full: 55.75 Wh
energy-full-design: 57.7 Wh
energy-rate: 15.946 W
voltage: 10.9 V
time to empty: 28.7 minutes
percentage: 13%
capacity: 96.6205%
History (charge):
1423901482 13.000 discharging
History (rate):
1423901512 15.946 discharging
1423901482 14.978 discharging
1423901452 14.740 discharging
1423901422 16.179 discharging

It’s pretty easy to show all details in one line command:

$ upower -e | xargs -n 1 upower -i
native-path: ADP1
power supply: yes
updated: Sat 14 Feb 2015 09:58:27 AM CST (22532 seconds ago)
has history: no
has statistics: no
line-power
online: no

native-path: BAT0
vendor: *********************************
model: *********************************
power supply: yes
updated: Sat 14 Feb 2015 04:13:52 PM CST (7 seconds ago)
has history: yes
has statistics: yes
battery
present: yes
rechargeable: yes
state: discharging
energy: 7.08 Wh
energy-empty: 0 Wh
energy-full: 55.75 Wh
energy-full-design: 57.7 Wh
energy-rate: 18.069 W
voltage: 10.846 V
time to empty: 23.5 minutes
percentage: 12%
capacity: 96.6205%
History (charge):
1423901602 12.000 discharging
History (rate):
1423901632 18.069 discharging
1423901602 16.164 discharging
1423901572 15.799 discharging
1423901542 16.767 discharging
batteryCliStatusScreenshot
upower screenshot

How to find reverse dependency on Debian/Ubuntu based GNU/Linux?

List all the reverse depends of certain package:

$ apt-cache rdepends pkg_name

For example:

$ apt-cache rdepends vde2

And you’ll get result like this:

vde2
Reverse Depends:
virtualbox
qemu-system-x86
qemu-system-sparc
qemu-system-ppc
qemu-system-misc
qemu-system-mips
qemu-system-arm
user-mode-linux
virtualbricks
virtualbox
vdetelweb
libvde-dev
libvde-dev
user-mode-linux
qemu-kvm
qemu-system
liblwipv6-2

More details via $ apt-cache showpkg pkg_name

Package: vde2
Versions:
2.3.2-4 (/var/lib/apt/lists/opensource.nchc.org.tw_debian_dists_wheezy_main_binary-amd64_Packages) (/var/lib/dpkg/status)
Description Language:
File: /var/lib/apt/lists/opensource.nchc.org.tw_debian_dists_wheezy_main_binary-amd64_Packages
MD5: c1d59c710a94c274459c01b82f926c5a
Description Language: en
File: /var/lib/apt/lists/opensource.nchc.org.tw_debian_dists_wheezy_main_i18n_Translation-en
MD5: c1d59c710a94c274459c01b82f926c5a

Reverse Depends:
virtualbox,vde2
qemu-system-x86,vde2
qemu-system-sparc,vde2
qemu-system-ppc,vde2
qemu-system-misc,vde2
qemu-system-mips,vde2
qemu-system-arm,vde2
user-mode-linux,vde2
virtualbricks,vde2
virtualbox,vde2
vdetelweb,vde2
libvde-dev,vde2 2.3.2-1
libvde-dev,vde2 2.3.2-1
user-mode-linux,vde2
qemu-kvm,vde2
qemu-system,vde2
liblwipv6-2,vde2
Dependencies:
2.3.2-4 – adduser (0 (null)) libc6 (2 2.7) libpcap0.8 (2 0.9.8) libvde0 (0 (null)) libvdeplug2 (0 (null)) vde2-cryptcab (0 (null)) qemu-kvm (0 (null)) qemu (0 (null)) vde (0 (null))
Provides:
2.3.2-4 –
Reverse Provides:

If we only want to know the installed dependencies, ask aptitude:

$ aptitude why vde2

It’ll tell us:

i qemu Depends qemu-system (>= 1.1.2+dfsg-6a+deb7u6)
i A qemu-system Recommends vde2

What about recursive depends? Try $ apt-rdepends --reverse pkg_name !
(Install via apt-get install apt-rdepends)

PS: reverse-depends has similar feature, but it’s in ubuntu-dev-tools, which depends on toooooo many packages, so I’ll not suggest you to use it for just finding the dependencies.

Adobe Reader on Linux

因為 Ubuntu 系列 GNU/Linux 預設的 Document Reader 滿好用的 (我很喜歡他內建顏色反轉的功能),一直沒發現原來 Adobe 有出 for linux 的 PDF Reader,而且內心隱約也覺得不會有這種東西,直到昨天看到這篇 Adobe Pulls Linux PDF Reader Downloads From Website,才發現原來 Adobe 有出 Linux client … 而且 deb 跟 rpm 的 package 都有提供,意味著大多數的 GNU/Linux distrobutions 都可以使用,有點驚訝啊…

順手裝起來試試看,畫面大概就長這樣:
adobeReaderOnLinuxMint

希望不要跟 Windows 版一樣會出現一些相容性比 3-party reader 還差的情形…
(有遇過某些檔案用 Chrome/Firefox 內建 PDF reader 讀取沒問題,用 Adobe reader 跟Acrobat 會出錯的,而且出錯的頁數跟狀況還不一樣=_=|||)

PS: 下載位置:
ftp://ftp.adobe.com/pub/adobe/reader/unix/

在 Ubuntu based Linux 上用 cue 切音檔

通常我音樂CD都是買來收藏、買來放的,為了有更好的保存,通常是第一次整軌讀出來以後就收著不動了,平常聽音樂透過比較常透過 KKBOX 或 Spotify~當然有些音樂想聽比較好的音質,還是需要靠原版光碟來轉,用 cue + flac/wav 的無損格式保存是一種滿常見的作法,另外網路上有一些要求教高品質的音樂交流也滿多這種作法的,通常在 Windows 底下要切的話都是用 Medieval CUE Splitter 來做,說真的還滿好用的,不過到了 Ubuntu 底下該怎麼做呢?

搜尋了一下找到一個很潮的作法,之所以潮是因為只在終端機底下就可以做、而且指令相當簡單

只需要安裝所需套件:
[bash]
$ sudo apt-get install cuetools shntool flac wavpack
[/bash]

然後用 cuebreakpoints 把cue內容讀出來,餵給shnsplit就行了!
[bash]
$ cuebreakpoints cd.cue | shnsplit -o wav cd.wav
[/bash]

至於進階用法如指定輸出檔名格式等功能,等閒來無事再來研究好了~