Many Debian newbies often have to reinstall Windows on the same machine on where Debian is installed. Usually the Windows installation does not take care of our Debian system booting process, overwriting the master boot record with Windows.
To get back our grub first stage boot, here a procedure you can use.
* Boot from debian CD choosing linux2.4 kernel (default)
* Change to console 2 with alt + F2 keystrokes
* Make a new dir to mount the boot partition, for example /disk
* mount the root partition on /disk.
* Do a chroot to the root partition: issuing chroot /disk
* Run grub command to enter grub shell
* Type in the root disk for grub, for example root (hd0,1). This is /dev/hda2 on my system
* Type the following command to install grub on /dev/hda: setup (hd0).
* Last step, type quit, exit from chroot, unmount all disks and reboot
Some notes:
The boot partition is where you put the boot files, normally newbies use only one partition that is mounted on /. Some advanced users store boot files in a separate partition and mount it under /boot. In that case, is the partition that is mounted under /boot the known-to-grub root partition.
from:http://www.debian-administration.org/articles/325
2010年4月3日 星期六
2010年3月31日 星期三
2010年3月26日 星期五
解決putty 在vim下無法送出數字鍵區的鍵
"In the configuration, go to Terminal->Features and check "Disableapplication keypad mode". Save the settings and enjoy a numeric padthat works!"
彩色化命令列
只要做一個簡單的微調,命令列就可以成為彩色,輸出結果也更容易閱讀。
首用gedit編輯目錄的.bashrc文件,鍵入命令如下:
$ gedit ~/.bashrc
然後在文件末端加入下行文字:
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
在你打完整行字後,手指頭可能會有點抽筋;然後仔細校對沒有打錯字,讓眼睛也抽筋一下!不過,自此之後,終端機視窗和虛擬平臺都會成為彩色。
改變顏色看似複雜,其實不太難。先檢視上述命令,特別是01;32m和01;34m。前者是username@hostname的文字顏色,後者為路徑的文字顏色。可接受的文字型式及顏色參數如下:
型式:
* 00 -- 正常 (沒有彩色、沒有粗體)
* 01 –- 粗體
文字顏色
* 30 -- 黑
* 31 -- 紅
* 32 -- 綠
* 33 -- 黃
* 34 -- 藍
* 35 -- 紫
* 36 -- 天藍
* 37 -- 白
背景顏色
* 40 -- 黑
* 41 -- 紅
* 42 -- 綠
* 43 -- 黃
* 44 -- 藍
* 45 -- 紫
* 46 -- 天藍
* 47 –– 白
參數的順序沒有關係,並且可以自由組合,以分號(;)隔開。例如,若使用者想將username@hostname的背景設置為紫色,字體為白色,路徑的背景顏色為預設,字體為綠色,可以將命令修改為:
PS1='${debian_chroot:+($debian_chroot)}\[\033[45;37m\]\u@\h\[\033[00m\]:\[\033[32m\]\w\[\033[00m\]\$ '
如果希望全部提示號都是斜體,沒有顏色,將命令修改為:
PS1='${debian_chroot:+($debian_chroot)}\[\033[01m\]\u@\h\[\033[01m\]:\[\033[01m\]\w\[\033[00m\]\$ '
此外,虛擬平臺是無法顯示粗體字的。還有,要避免自設的文字顏色和背景顏色相同,那就什麼都看不出來了。
首用gedit編輯目錄的.bashrc文件,鍵入命令如下:
$ gedit ~/.bashrc
然後在文件末端加入下行文字:
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
在你打完整行字後,手指頭可能會有點抽筋;然後仔細校對沒有打錯字,讓眼睛也抽筋一下!不過,自此之後,終端機視窗和虛擬平臺都會成為彩色。
改變顏色看似複雜,其實不太難。先檢視上述命令,特別是01;32m和01;34m。前者是username@hostname的文字顏色,後者為路徑的文字顏色。可接受的文字型式及顏色參數如下:
型式:
* 00 -- 正常 (沒有彩色、沒有粗體)
* 01 –- 粗體
文字顏色
* 30 -- 黑
* 31 -- 紅
* 32 -- 綠
* 33 -- 黃
* 34 -- 藍
* 35 -- 紫
* 36 -- 天藍
* 37 -- 白
背景顏色
* 40 -- 黑
* 41 -- 紅
* 42 -- 綠
* 43 -- 黃
* 44 -- 藍
* 45 -- 紫
* 46 -- 天藍
* 47 –– 白
參數的順序沒有關係,並且可以自由組合,以分號(;)隔開。例如,若使用者想將username@hostname的背景設置為紫色,字體為白色,路徑的背景顏色為預設,字體為綠色,可以將命令修改為:
PS1='${debian_chroot:+($debian_chroot)}\[\033[45;37m\]\u@\h\[\033[00m\]:\[\033[32m\]\w\[\033[00m\]\$ '
如果希望全部提示號都是斜體,沒有顏色,將命令修改為:
PS1='${debian_chroot:+($debian_chroot)}\[\033[01m\]\u@\h\[\033[01m\]:\[\033[01m\]\w\[\033[00m\]\$ '
此外,虛擬平臺是無法顯示粗體字的。還有,要避免自設的文字顏色和背景顏色相同,那就什麼都看不出來了。
Vim session 與 狀態列 修改
Vim 的狀態列 只要將下述新增至~/.vimrc 即可見到效果~
set laststatus=2
set statusline=%4*%<\ %1*[%F]
set statusline+=%4*\ %5*[%{&encoding}, " encoding
set statusline+=%{&fileformat}%{\"\".((exists(\"+bomb\")\ &&\ &bomb)?\",BOM\":\"\").\"\"}]%m
set statusline+=%4*%=\ %6*%y%4*\ %3*%l%4*,\ %3*%c%4*\ \<\ %2*%P%4*\ \>
highlight User1 ctermfg=red
highlight User2 term=underline cterm=underline ctermfg=green
highlight User3 term=underline cterm=underline ctermfg=yellow
highlight User4 term=underline cterm=underline ctermfg=white
highlight User5 ctermfg=cyan
highlight User6 ctermfg=white
set laststatus=2
set statusline=%4*%<\ %1*[%F]
set statusline+=%4*\ %5*[%{&encoding}, " encoding
set statusline+=%{&fileformat}%{\"\".((exists(\"+bomb\")\ &&\ &bomb)?\",BOM\":\"\").\"\"}]%m
set statusline+=%4*%=\ %6*%y%4*\ %3*%l%4*,\ %3*%c%4*\ \<\ %2*%P%4*\ \>
highlight User1 ctermfg=red
highlight User2 term=underline cterm=underline ctermfg=green
highlight User3 term=underline cterm=underline ctermfg=yellow
highlight User4 term=underline cterm=underline ctermfg=white
highlight User5 ctermfg=cyan
highlight User6 ctermfg=white
Samba for Ubuntu
sudo apt-get install samba
安裝完畢後,先暫停服務修改設定檔...
/etc/init.d/samba stop
編輯設定檔...
基本上如果你用視窗來使用是比較方便與直覺....
vim /etc/samba/smb.conf
以下是設定檔的部份介紹
workgroup = WORKGROUP <= 預設WORKGROUP,你可以改成自己喜歡的工作群組
server string = %h server (Samba, Ubuntu) <=自己電腦的名稱,自己改自己喜歡的,%h就是hostname
security = user <= 預設要輸入帳號密碼,如果不想這麼麻煩可以改成share...
在尾巴加上你要的分享資料夾
[SHARE]
path = /var/lib/share ;分享路徑
browseable = yes ;是否可瀏覽
read only = no ;是否唯讀
create mask = 0644 ;檔案遮罩
directory mask = 0755 ;資料夾遮罩
記得要打開分享路徑的權限喔chmod 777 /var/lib/share
或者設定user以及group...在改成chmod 770 /var/lib/share
編輯完後,存檔並重新啟動samba
/etc/init.d/samba start
如果你需要設定帳號密碼才能使用,除了在smn.conf把security設定成user外
請作以下命令來新增使用者...
sudo smbpasswd -a 帳號
另外請記得養成好習慣,每次編輯完smb.conf的時候請用testparm來檢查是否有問題
執行..testparm
結果..
Load smb config files from /etc/samba/smb.conf
Processing section "[printers]"
Processing section "[print$]"
Processing section "[SHARE]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions
安裝完畢後,先暫停服務修改設定檔...
/etc/init.d/samba stop
編輯設定檔...
基本上如果你用視窗來使用是比較方便與直覺....
vim /etc/samba/smb.conf
以下是設定檔的部份介紹
workgroup = WORKGROUP <= 預設WORKGROUP,你可以改成自己喜歡的工作群組
server string = %h server (Samba, Ubuntu) <=自己電腦的名稱,自己改自己喜歡的,%h就是hostname
security = user <= 預設要輸入帳號密碼,如果不想這麼麻煩可以改成share...
在尾巴加上你要的分享資料夾
[SHARE]
path = /var/lib/share ;分享路徑
browseable = yes ;是否可瀏覽
read only = no ;是否唯讀
create mask = 0644 ;檔案遮罩
directory mask = 0755 ;資料夾遮罩
記得要打開分享路徑的權限喔chmod 777 /var/lib/share
或者設定user以及group...在改成chmod 770 /var/lib/share
編輯完後,存檔並重新啟動samba
/etc/init.d/samba start
如果你需要設定帳號密碼才能使用,除了在smn.conf把security設定成user外
請作以下命令來新增使用者...
sudo smbpasswd -a 帳號
另外請記得養成好習慣,每次編輯完smb.conf的時候請用testparm來檢查是否有問題
執行..testparm
結果..
Load smb config files from /etc/samba/smb.conf
Processing section "[printers]"
Processing section "[print$]"
Processing section "[SHARE]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions
好用可以分割視窗的終端機 Terminator
HOW TO INSTALL FOR UBUNTU:
Linksudo add-apt-repository ppa:gnome-terminator
sudo apt-get update
sudo apt-get install terminator
訂閱:
文章 (Atom)
How to repair and clone disk with ddrescue
ddrescue is a tool that can be used to repair and clone disks on a Linux system . This includes hard drives, partitions, DVD discs, flas...
-
From: http://blog.chinaaet.com/justlxy/p/5100064818 SMI:串行管理接口(Serial Management Interface),通常直接被稱為MDIO接口(Management Data Input/Output I...
-
from: https://www.wpgdadatong.com/tw/blog/detail?BID=B0594 一. PHY包含的各個子層 : PCS:編碼和解碼 PMA:串行器和反序列化器 PMD:取決於物理介質 Firgure 1: OSI模型裡示意...
-
在 前面我們所談的那些可以說是比較基本的東西,但是對於一份文件來說,光有前面所介紹的游標移動、刪除等等功能是不足夠的。面對一份文件我們通常會因為某些 緣故而使得我們必須去修改當中固定出現的字串樣式(pattern)成我們想要的樣子。最常遇到的就像中文文件的標點符號問題,或是 un...