2012年10月26日 星期五
[Ubuntu][一些測試]
[1] 在 Directory 中開啟新檔案,即使沒寫入任何內容,一樣會更動到 Directory 的 Last Modified Time。推測是因為編輯器(如 vim)會創建暫存檔(.swp)所以更動到 mtime。
2012年10月17日 星期三
[Ubuntu][Some problems met recently]
[1] Couldn't make x3270 because of "fatal error: X11/Intrinsic.h: No such file or directory"
sudo apt-get install apt-file
sudo apt-file update
apt-file search Intrinsic.h
X11/Intrinsic.h -> libxt-dev
X11/Xaw/Command.h -> libxaw7-dev
sudo apt-get install apt-file
sudo apt-file update
apt-file search Intrinsic.h
X11/Intrinsic.h -> libxt-dev
X11/Xaw/Command.h -> libxaw7-dev
2012年9月13日 星期四
[Ubuntu][把新硬碟設定成 NTFS 格式&改既有 NTFS partition 的 label]
標題有點怪,我知道 XD
最近新加了顆硬碟作為資料碟,因為電腦中還有 Win7,
希望能用 Windows 也能讀取的格式,所以想把資料碟用成 NTFS。
首先就是要把它格式改成 NTFS。
=================================================================
sudo fdisk /dev/sde
(sde 是新硬碟在我電腦裡的代號,請自行察看新硬碟在自己電腦中的代號)
=================================================================
在 fdisk 中建立 partition,因為我是想用整顆作為一個 partition,所以
就下指令 n 之後選 primary 後 default default 就建好了,情況像是下面:
=================================================================
Command (m for help): n <---------------這個是我輸入的
Command action
e extended
p primary partition (1-4)
p <---------------這個是我輸入的
Partition number (1-4): 1 <---------------這個是我輸入的
First cylinder (1-30401, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-30401, default 30401):
Using default value 30401
=================================================================
然後就順利的把 partition 切好了,可以輸入 p 看看狀況。
=================================================================
Command (m for help): p <---------------這個是我輸入的
Disk /dev/sde: 250.1 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xee202071
Device Boot Start End Blocks Id System
/dev/sde1 1 30401 244196001 83 Linux
=================================================================
因為 System 預設是 Linux,所以現在我要把它改成 NTFS,就輸入 t,
然後 Hex code 輸入 7,當然也可以用 L 看有什麼樣的格式可以選,
因為列出來很難排版,所以有興趣的人再自己去看。然後再輸入 p 列出資訊,
已經把 System 改成 NTFS 了。
=================================================================
Command (m for help): t <---------------這個是我輸入的
Selected partition 1
Hex code (type L to list codes): 7 <------這個是我輸入的
Changed system type of partition 1 to 7 (HPFS/NTFS)
Command (m for help): p <---------------這個是我輸入的
Disk /dev/sde: 250.1 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xee202071
Device Boot Start End Blocks Id System
/dev/sde1 1 30401 244196001 7 HPFS/NTFS
=================================================================
然後完成了嗎?還沒。還沒把資訊寫進去,所以要用 w 把資訊寫入,
才是真正的把硬碟改成 NTFS 的。
=================================================================
Command (m for help): w <---------------這個是我輸入的
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
=================================================================
然後就是要格式化它啦,這時可以設定 label 給那 partition,像是我用 Data。
格式化的時間有點長,因為要把 zero 寫入整個 partition 中。
這邊也可以設定 Cluster size,有興趣的自己 man。
=================================================================
sudo mkfs.ntfs -L Data /dev/sde1
Cluster size has been automatically set to 4096 bytes.
Initializing device with zeroes: 3%
=================================================================
等到跑到 100% 了,新硬碟就可以用囉,至於 fstab 那些就自己設定吧。
或者像我用 Ubuntu 的 GUI,可以直接在系統列選 Places,中文翻位置吧,
裡面找到新硬碟,點下去就自動 mount 起來了。
另外要改 label 的話,先把那 partition umount,以我這邊的狀況是。
=================================================================
sudo umount /media/Data
=================================================================
然後用 ntfslabel 改 label,像是改成 Fun。
=================================================================
sudo ntfslabel /dev/sde1 Fun
=================================================================
這樣就把 label 改掉了,然後再重新 mount 起來硬碟又可以用了。
最近新加了顆硬碟作為資料碟,因為電腦中還有 Win7,
希望能用 Windows 也能讀取的格式,所以想把資料碟用成 NTFS。
首先就是要把它格式改成 NTFS。
=================================================================
sudo fdisk /dev/sde
(sde 是新硬碟在我電腦裡的代號,請自行察看新硬碟在自己電腦中的代號)
=================================================================
在 fdisk 中建立 partition,因為我是想用整顆作為一個 partition,所以
就下指令 n 之後選 primary 後 default default 就建好了,情況像是下面:
=================================================================
Command (m for help): n <---------------這個是我輸入的
Command action
e extended
p primary partition (1-4)
p <---------------這個是我輸入的
Partition number (1-4): 1 <---------------這個是我輸入的
First cylinder (1-30401, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-30401, default 30401):
Using default value 30401
=================================================================
然後就順利的把 partition 切好了,可以輸入 p 看看狀況。
=================================================================
Command (m for help): p <---------------這個是我輸入的
Disk /dev/sde: 250.1 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xee202071
Device Boot Start End Blocks Id System
/dev/sde1 1 30401 244196001 83 Linux
=================================================================
因為 System 預設是 Linux,所以現在我要把它改成 NTFS,就輸入 t,
然後 Hex code 輸入 7,當然也可以用 L 看有什麼樣的格式可以選,
因為列出來很難排版,所以有興趣的人再自己去看。然後再輸入 p 列出資訊,
已經把 System 改成 NTFS 了。
=================================================================
Command (m for help): t <---------------這個是我輸入的
Selected partition 1
Hex code (type L to list codes): 7 <------這個是我輸入的
Changed system type of partition 1 to 7 (HPFS/NTFS)
Command (m for help): p <---------------這個是我輸入的
Disk /dev/sde: 250.1 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xee202071
Device Boot Start End Blocks Id System
/dev/sde1 1 30401 244196001 7 HPFS/NTFS
=================================================================
然後完成了嗎?還沒。還沒把資訊寫進去,所以要用 w 把資訊寫入,
才是真正的把硬碟改成 NTFS 的。
=================================================================
Command (m for help): w <---------------這個是我輸入的
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
=================================================================
然後就是要格式化它啦,這時可以設定 label 給那 partition,像是我用 Data。
格式化的時間有點長,因為要把 zero 寫入整個 partition 中。
這邊也可以設定 Cluster size,有興趣的自己 man。
=================================================================
sudo mkfs.ntfs -L Data /dev/sde1
Cluster size has been automatically set to 4096 bytes.
Initializing device with zeroes: 3%
=================================================================
等到跑到 100% 了,新硬碟就可以用囉,至於 fstab 那些就自己設定吧。
或者像我用 Ubuntu 的 GUI,可以直接在系統列選 Places,中文翻位置吧,
裡面找到新硬碟,點下去就自動 mount 起來了。
另外要改 label 的話,先把那 partition umount,以我這邊的狀況是。
=================================================================
sudo umount /media/Data
=================================================================
然後用 ntfslabel 改 label,像是改成 Fun。
=================================================================
sudo ntfslabel /dev/sde1 Fun
=================================================================
這樣就把 label 改掉了,然後再重新 mount 起來硬碟又可以用了。
2012年7月17日 星期二
[Latex][固定表格]
有時我們會希望能夠把表格固定在一段文章內容的後面,
不希望由 Latex 來幫我們做動態調整。
這時候就可以用這方法:
\usepackage{float}
然後在宣告表格時
\begin{table}[H]
這樣就可以讓表格固定在你編輯的位置。
不希望由 Latex 來幫我們做動態調整。
這時候就可以用這方法:
\usepackage{float}
然後在宣告表格時
\begin{table}[H]
這樣就可以讓表格固定在你編輯的位置。
2012年7月5日 星期四
[Linux][Ubuntu][一些好用小招]
(1)
在 CLI 時,要達到 clear 這指令的效用,可以直接用 ctrl + l。
(2)
要讓 shell 自動幫你補完(之前有輸入過的)指令時,可以用 ctrl + r。
(3)
與 (2) 類似的功能,是在 .bashrc 裡面 加上以下兩行:
在 CLI 時,要達到 clear 這指令的效用,可以直接用 ctrl + l。
(2)
要讓 shell 自動幫你補完(之前有輸入過的)指令時,可以用 ctrl + r。
(3)
與 (2) 類似的功能,是在 .bashrc 裡面 加上以下兩行:
bind '"\x1b\x5b\x41":history-search-backward'
bind '"\x1b\x5b\x42":history-search-forward'
bind '"\x1b\x5b\x42":history-search-forward'
然後就可以藉由輸入部份指令後按上下鍵來搜尋之前有輸入過的指令並補完。
(4)
在 GUI 時,可以用 ctrl + alt + t 叫出 Terminal,default pwd 為使用者
的 home directory。
(5)
要取一個檔案的 basename 可以用 basename 這條指令。
像是 info coreutils 'tee invocation' 中有給兩個範例:
basename include/stdio.h .h 會得到 stdio 這個結果,也就是說它會取到
路徑的最尾端的 filename,然後依照 argv[2] 所給的 SUFFIX 將其於
filename 中消除並輸出結果。不過測試結果看起來沒支援 *。
(6)
與 basename 相對的是 dirname。
直接舉例,dirname /usr/bin/sort 會得出 /usr/bin 這個結果。
(4)
在 GUI 時,可以用 ctrl + alt + t 叫出 Terminal,default pwd 為使用者
的 home directory。
(5)
要取一個檔案的 basename 可以用 basename 這條指令。
像是 info coreutils 'tee invocation' 中有給兩個範例:
basename include/stdio.h .h 會得到 stdio 這個結果,也就是說它會取到
路徑的最尾端的 filename,然後依照 argv[2] 所給的 SUFFIX 將其於
filename 中消除並輸出結果。不過測試結果看起來沒支援 *。
(6)
與 basename 相對的是 dirname。
直接舉例,dirname /usr/bin/sort 會得出 /usr/bin 這個結果。
2012年7月1日 星期日
[Linux][Ubuntu][gnome-open and xdg-open]
有時我用 command-line 切到某個 directory 底下時,想要開啟 gui 介面。
因為 gui 介面在整理東西時偶爾比較方便。
這時 gnome-open 這個指令就派上用場了。
像是
zqpm@MyMachine:~$gnome-open .
就會打開 zqpm 家目錄的資料夾圖形介面。
It's interesting.
或許改天我可以 bind 一個 key 給它,這樣就不用打一串指令了。
我還是會覺得 gnome-open 很長的,當我很懶時。(攤手)
xdg-open 也可以達到同樣的功能。
不過我沒有 KDE 介面(我是用 GNOME)。
所以不確定 xdg-open 可否在 KDE 時可以達到一樣的效果。(在 GNOME 上可)
Reference:
Domon
因為 gui 介面在整理東西時偶爾比較方便。
這時 gnome-open 這個指令就派上用場了。
像是
zqpm@MyMachine:~$gnome-open .
就會打開 zqpm 家目錄的資料夾圖形介面。
It's interesting.
或許改天我可以 bind 一個 key 給它,這樣就不用打一串指令了。
我還是會覺得 gnome-open 很長的,當我很懶時。(攤手)
xdg-open 也可以達到同樣的功能。
不過我沒有 KDE 介面(我是用 GNOME)。
所以不確定 xdg-open 可否在 KDE 時可以達到一樣的效果。(在 GNOME 上可)
Reference:
Domon
2012年6月14日 星期四
[Linux][Ubuntu][Xfig][Special Text]
Xfig 在 export 成 PDF/Latex 時可以將圖片上的字全部放到輸出的 Latex 檔案中。
這樣可以在被 input 進其他的 pdf 時,使圖跟文章內容的文字同款。
方法是在 Xfig 的操作介面左下角有個 "Edit",點選它後再將那隻手移到圖片上的文字處。
點一下,會出現那個字的 "Edit Panel",裡頭有個 "Special Flag"。
將原本的 "Normal" 改成 "Special",按上頭的 "Apply" 再按 "Done",就儲存設定了。
匯出時會看到生成的 PDF 檔中完全沒有文字,那些文字通通在 Latex 檔裡面。
檔名方面,PDF 會以 .pdf 作結尾,而 Latex 檔則是以 .pdf_t 作結尾。
在其他的 Latex 檔中 input 圖片時,舉例而言,input{fig/test.pdf_t} 時。
test.pdf_t 中有 includegraphics{test.pdf},要注意一下路徑的問題。
不然可能會產生編譯錯誤,找不到 test.pdf 這個檔案的情況。
另外如果不想要一個一個字去設定 "Special Flag" 的話,可以在 command line
輸入 "xfig -specialtext",以這個方法來開啟 Xfig,這樣的話 "Special Flag" 的
預設值就是 "Special" 了。
Reference:
子園
這樣可以在被 input 進其他的 pdf 時,使圖跟文章內容的文字同款。
方法是在 Xfig 的操作介面左下角有個 "Edit",點選它後再將那隻手移到圖片上的文字處。
點一下,會出現那個字的 "Edit Panel",裡頭有個 "Special Flag"。
將原本的 "Normal" 改成 "Special",按上頭的 "Apply" 再按 "Done",就儲存設定了。
匯出時會看到生成的 PDF 檔中完全沒有文字,那些文字通通在 Latex 檔裡面。
檔名方面,PDF 會以 .pdf 作結尾,而 Latex 檔則是以 .pdf_t 作結尾。
在其他的 Latex 檔中 input 圖片時,舉例而言,input{fig/test.pdf_t} 時。
test.pdf_t 中有 includegraphics{test.pdf},要注意一下路徑的問題。
不然可能會產生編譯錯誤,找不到 test.pdf 這個檔案的情況。
另外如果不想要一個一個字去設定 "Special Flag" 的話,可以在 command line
輸入 "xfig -specialtext",以這個方法來開啟 Xfig,這樣的話 "Special Flag" 的
預設值就是 "Special" 了。
Reference:
子園
訂閱:
文章 (Atom)