2019年7月21日

Mint18:好用的螢幕截圖軟體 deepin-screenshot

這個螢幕截圖軟體 deepin-screenshot,在 ubuntu/mint 下,可以自由畫矩形、圓形、箭號、加文字說明,很好用喔,如下圖。


ubuntu 18.x 以上已包含此套件


see also:Deepin-Scrot – Lightweight Screenshot Capture Program in Ubuntu

像我的是 mint 18.x,只能找舊版的 deb 檔來安裝。不然就是要自已下程式碼來編譯了,參考 這篇「

LinuxMint使用源码安装Deepin-Screenshot

」。


舊版 deb 檔下載:
http://ftp.vim.org/ftp/os/Linux/distr/deepin/pool/main/d/deepin-scrot/

2019年7月19日

使用tar備份資料(ubuntu/mint)

使用tar備份資料(Linux)

資料來源 : http://linux.vbird.org/linux_basic/0240tarcompress.php#tar
範例一:將整個 /etc 目錄下的檔案全部打包成為 /tmp/etc.tar

$ tar -cvf /tmp/etc.tar /etc  <==僅打包,不壓縮!
$ tar -zcvf /tmp/etc.tar.gz /etc  <==打包後,以 gzip 壓縮
$ tar -jcvf /tmp/etc.tar.bz2 /etc  <==打包後,以 bzip2 壓縮

範例二:將 /tmp/etc.tar.gz 檔案解壓縮在 /usr/local/src 底下
$ cd /usr/local/src
$ tar -zxvf /tmp/etc.tar.gz

範例三:將 /etc/ 內的所有檔案備份下來,並且保存其權限
$ tar -zcvpf /tmp/etc.tar.gz /etc

# 這個 -p 的屬性是重要的,特別是當您要保留原本檔案的屬性時!

 


2019年7月18日

備份軟體 timeshift 在 mint 18 下之還原

備份軟體 timeshift 在 mint 18.3 以後,已成為預裝累積備份/還原軟體。但似乎還無法從 live CD 開機,再還原完整之系統。例如,還原後開機,無法順利進入,畫面出現錯誤如下:

它要我要 root password for maintenance,但 mint/ubuntu 預裝時,根本沒有設 root 密碼!!! (猜應該是目錄權限問題... 不知有無高手知道解決法,已有解方)。

Give root password for maintenance
(or press Control-D to continue):





原來是掛載硬碟的 /etc/fstab 表出了問題。。。因為重新還原後,有可能硬碟重新格式化,而使硬碟的 uuid 改變。主硬碟會重新掛載修正 uuid,但其它的不會,包含 swap。這導致開機出問題,也無法進 root 去修復...

Linux 如何查詢系統硬碟的 UUID

先用 live CD 開機,然後在終端機中下指令,可以查到所有已掛載的硬碟的 uuid

blkid



UUID= 後面的一長串字,就是 UUID,用文字編輯器,例如 gedit 把它們填好如下即可。注意,這個例子,/dev/sda1 是掛在根目錄 /。而 /dev/sda1 是掛 swap。




 

後來才發現,這篇其實解說了此事:https://askubuntu.com/questions/1149674/timeshift-restore-to-different-partitions

舊版 Linux /etc/fstab說明

/dev/sda1        /                ext3        defaults         1   1
/dev/sda2        /extp            ext3        defaults         1   2
/dev/sdb1
/array           ext3        defaults         1   2
/dev/sda4        swap             swap        defaults         0   0
/dev/cdrom       /mnt/cdrom       auto        noauto,owner,ro  0   0
/dev/fd0         /mnt/floppy      auto        noauto,owner     0   0
devpts           /dev/pts         devpts      gid=5,mode=620   0   0
proc             /proc            proc        defaults         0   0

2019年7月15日

Mint 18: VirtualBox 找不到 USB 裝置

在 Ubuntu/Mint 的 VirtualBox 下,若 guest OS 找不到 USB 裝置時,是沒有把自己加入 vboxuser 群組,所以無權使用。只要把帳號加入即可。

按左下啟動鈕,在「系統」 ->「使用者及群組」->




找到自己的帳號,按管理群:


找到 vboxusers, 按屬性



 在下方的群組成員中,勾選自己,再按「確定」。重新登出/或重開機就OK啦...

Mint 18.2:fcitx 輸入法無法選字

在 Mint 18 中,若要使用 wine (PlayOnLinux) + line (windows版),使用 ibus 輸入法會衝突而無法輸入文字。改用 fcitx 輸入法可以解決這個問題。

但重灌 Mint 18.2 時,卻無法出現候選字視窗 (像這樣)



這時可以用停用 Kimpanel 套件,到 Synaptic 去移除 fcitx-module-kimpanel 即可

2019年7月14日

linux 測硬碟速度指令 hdparm

ubuntu/Mint 下預裝有測硬碟速度指令 hdparm。其用法,例如:

sudo hdparm -Tt /dev/sda
可以測 sda 硬碟速度。

我的 WD 2TB 3.5吋碟,測試結果:

#sudo hdparm -Tt /dev/sda

/dev/sda:  Timing cached reads:   7406 MB in  2.00 seconds = 3704.50 MB/sec
 Timing buffered disk reads: 374 MB in  3.01 seconds = 124.27 MB/sec


我的 128G SSD碟,測試結果:

#sudo hdparm -Tt /dev/sdb

/dev/sdb:  Timing cached reads:   7466 MB in  2.00 seconds = 3734.90 MB/sec
 Timing buffered disk reads: 800 MB in  3.00 seconds = 266.45 MB/sec

===2020/12/28===
A-Data model: SX8200PNP 碟, 測試結果:
/dev/nvme0n1p3: Timing cached reads:   20314 MB in  2.00 seconds = 10168.51 MB/sec Timing buffered disk reads: 8342 MB in  3.00 seconds = 2780.22 MB/sec

2019年6月13日

google drive 同步工具:grive


Grive 指令工具,可以讓Google 雲端硬碟跟本機硬碟中的檔案同步

==grive 2.0的安裝==

用 PPA,參見 Grive2
在 terminal 中下指令:
sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt-get update
sudo apt-get install grive
 或從 github 自行下載 compile (see grive2)

==grive 的使用參數==

source: http://blog.ilc.edu.tw/blog/index.php?op=printView&articleId=649021&blogId=25793

-v 列出 grive 版本
/usr/local/bin/grive -v
grive version 0.5.1-dev Jun 30 2016 13:33:47

-a 取得授權碼
/usr/local/bin/grive -a

-p 要同步的根目錄,同步到 Google Drive 後,呈現的就是 /home/t850008/Google 目錄下的檔案及目錄
/usr/local/bin/grive -p /home/t850008/Google

-s 單一子目錄同步
/usr/local/bin/grive -s /home/t850008/Google/123

-V 詳細模式,啟用比正常更多的訊息
/usr/local/bin/grive -p /home/t850008/Google -V
config file name "/home/t850008/Google/.grive"
Reading local directories
file .grive_state is ignored by grive
file .grive is ignored by grive
Reading remote server file list
file "/home/t850008/Google/格式工廠 format factory 3.8.0.0 中文免安裝版.exe" is already in sync
Synchronizing files
sync "/home/t850008/Google" already in sync
sync "/home/t850008/Google/pCloud_Windows_3.2.4.exe" deleted in remote. deleting local
sync "/home/t850008/Google/格式工廠 format factory 3.8.0.0 中文免安裝版.exe" already in sync
change stamp is set to 14
Finished!

-l 設定輸入的 log 檔的檔案名稱

-f 強制
/usr/local/bin/grive -p /home/t850008/Google -f

-u 不從 Google Drive 下載檔案, 只上傳本地端有改變的檔案
/usr/local/bin/grive -p /home/t850008/Google -u

-n 只下載 Google Drive 有改變且已存在本地端的檔案,也會上傳本地端的檔案到 Google Drive
/usr/local/bin/grive -p /home/t850008/Google -n

--dry-run 只偵測哪些檔案要處理,並不實際做檔案的上傳或下載
/usr/local/bin/grive -p /home/t850008/Google --dry-run

--ignore 使用 Perl 常規表示式來過濾一些不處理的目錄(針對相對應目錄處理)

-U 限制上傳的速度  kbytes per second
-D 限制下載的速度  kbytes per second

==grive -h==

~ $ grive -h
Grive options:
  -h [ --help ]               Produce help message
  -v [ --version ]            Display Grive version
  -a [ --auth ]               Request authorization token
  -i [ --id ] arg             Authentication ID
  -e [ --secret ] arg         Authentication secret
  -p [ --path ] arg           Path to working copy root
  -s [ --dir ] arg            Single subdirectory to sync
  -V [ --verbose ]            Verbose mode. Enable more messages than normal.
  --log-http arg              Log all HTTP responses in this file for
                              debugging.
  --new-rev                   Create new revisions in server for updated files.
  -d [ --debug ]              Enable debug level messages. Implies -v.
  -l [ --log ] arg            Set log output filename.
  -f [ --force ]              Force grive to always download a file from Google
                              Drive instead of uploading it.
  -u [ --upload-only ]        Do not download anything from Google Drive, only
                              upload local changes
  -n [ --no-remote-new ]      Download only files that are changed in Google
                              Drive and already exist locally
  --dry-run                   Only detect which files need to be
                              uploaded/downloaded, without actually performing
                              them.
  -U [ --upload-speed ] arg   Limit upload speed in kbytes per second
  -D [ --download-speed ] arg Limit download speed in kbytes per second
  -P [ --progress-bar ]       Enable progress bar for upload/download of files