2012年1月30日 星期一
2012年1月28日 星期六
2012年1月10日 星期二
2011年7月12日 星期二
編輯登入訊息檔 (Ubuntu Server)
以下操作必須在 Ubuntu Server 系統中操作
登入前訊息顯示
登入後訊息顯示
[註] Message of the Day (motd)
/etc/motd 這個檔案內容, 是由 /etc/update-motd.d/ 目錄中的所有程式所產生的, 你自己也可以在此目錄, 增加程式來顯示自己的資訊
顯示 /etc/update-motd.d/ 目錄內容
這目錄中的程式, 是在 登入前 會被執行
顯示 00-header 程式內容
顯示 50-landscape-sysinfo 程式內容
直接執行 /etc/update-motd.d/50-landscape-sysinfo 程式, 顯示如下 :
自製訊息程式
登入前訊息顯示
$ cat /etc/issue Ubuntu 10.04.1 LTS \n \l # 由此訊息也可以知道所使用 Ubuntu 的版本
登入後訊息顯示
$ cat /etc/motd Linux oncloud9 2.6.32-21-generic-pae #32-Ubuntu SMP Fri Apr 16 09:39:35 UTC 2010 i686 GNU/Linux Ubuntu 10.04.1 LTS Welcome to Ubuntu! * Documentation: https://help.ubuntu.com/ Your CPU appears to be lacking expected security protections. Please check your BIOS settings, or for more information, run: /usr/bin/check-bios-nx --verbose System information as of Mon Aug 9 23:28:00 CST 2010 System load: 0.45 Processes: 91 Usage of /: 3.0% of 47.81GB Users logged in: 1 Memory usage: 7% IP address for lo: 127.0.0.1 Swap usage: 0% IP address for eth0: 192.168.56.128 Graph this data and manage this system at https://landscape.canonical.com/
[註] Message of the Day (motd)
/etc/motd 這個檔案內容, 是由 /etc/update-motd.d/ 目錄中的所有程式所產生的, 你自己也可以在此目錄, 增加程式來顯示自己的資訊
顯示 /etc/update-motd.d/ 目錄內容
這目錄中的程式, 是在 登入前 會被執行
$ ls -al /etc/update-motd.d/ 總計 36 drwxr-xr-x 2 root root 4096 2010-08-04 17:06 . drwxr-xr-x 88 root root 4096 2010-08-05 22:46 .. -rwxr-xr-x 1 root root 57 2010-04-23 17:45 00-header -rwxr-xr-x 1 root root 248 2010-04-23 17:45 10-help-text -rwxr-xr-x 1 root root 65 2010-04-14 04:45 20-cpu-checker lrwxrwxrwx 1 root root 46 2010-08-04 17:06 50-landscape-sysinfo -> /usr/share/landscape/landscape-sysinfo.wrapper -rwxr-xr-x 1 root root 71 2010-04-14 04:45 90-updates-available -rwxr-xr-x 1 root root 61 2010-04-24 03:13 91-release-upgrade -rwxr-xr-x 1 root root 69 2010-04-14 04:45 98-reboot-required -rwxr-xr-x 1 root root 261 2010-04-23 17:45 99-footer
顯示 00-header 程式內容
$ cat /etc/update-motd.d/00-header #!/bin/sh uname -a printf "%s\n" "$(lsb_release -s -d)"
顯示 50-landscape-sysinfo 程式內容
$ cat /etc/update-motd.d/50-landscape-sysinfo #!/bin/sh echo echo -n " System information as of " /bin/date echo /usr/bin/landscape-sysinfo
直接執行 /etc/update-motd.d/50-landscape-sysinfo 程式, 顯示如下 :
$ /etc/update-motd.d/50-landscape-sysinfo System information as of 四 8月 5 23:04:56 CST 2010 System load: 0.0 Processes: 72 Usage of /: 2.7% of 47.81GB Users logged in: 1 Memory usage: 6% IP address for lo: 127.0.0.1 Swap usage: 0% IP address for eth0: 192.168.56.128 Graph this data and manage this system at https://landscape.canonical.com/
自製訊息程式
$ cd /etc/update-motd.d $ sudo nano 99-zhi #!/bin/bash echo hi $ sudo chmod +x 99-zhi $ sudo reboot
取消登入後的訊息顯示
在你的家目錄產生以下檔案 :
$ touch .hushlogin
2011年6月29日 星期三
快速備份 Ubuntu 系統
使用命令模式, 就算沒有安裝桌面,也可以直接透過 SSH 來完成系統備份, 方法很簡單,你只需執行一行命令, 就可以搞定, 如下 :
進行備份:
tar 命令參數說明 :
c – 新建一個備份檔
v – 詳細模式, tar 程式將在螢幕上即時輸出所有資訊。
p – 保存權限,並應用到所有檔。
z – 採用 ‘gzip’ 壓縮備份檔案,以減小備份檔案體積。
f – 指定備份檔案名稱。
進行還原:
在你沒有對 Linux 系統架構很熟前,千萬不要輕易的把一台 Server 的備分 "直接" 覆蓋到另一台上。
另一個備份命令, 可參考以下網址 :
Ubuntu Linux backup of a laptop using a USB enclosure and the dump utility
如需圖形備份軟體, 可參考以下網址 :
http://www.debianadmin.com/backup-and-restore-your-ubuntu-system-using-sbackup.html
進行備份:
$ tar -cvpzf /backup/kvmbackup.tgz -exclude=/proc -exclude=/lost+found
-exclude=/mnt -exclude=/sys -exclude=/media /
tar 命令參數說明 :
c – 新建一個備份檔
v – 詳細模式, tar 程式將在螢幕上即時輸出所有資訊。
p – 保存權限,並應用到所有檔。
z – 採用 ‘gzip’ 壓縮備份檔案,以減小備份檔案體積。
f – 指定備份檔案名稱。
進行還原:
$ tar -xvpzf /backup/kvmbackup.tgz -C /
在你沒有對 Linux 系統架構很熟前,千萬不要輕易的把一台 Server 的備分 "直接" 覆蓋到另一台上。
另一個備份命令, 可參考以下網址 :
Ubuntu Linux backup of a laptop using a USB enclosure and the dump utility
如需圖形備份軟體, 可參考以下網址 :
http://www.debianadmin.com/backup-and-restore-your-ubuntu-system-using-sbackup.html
2011年6月8日 星期三
sudo 不要來亂 - 二部曲
在 Ubuntu 桌面版系統中, 可使用 gksudo 命令, 啟動 [檔案瀏覽器], 如下圖 :
一旦啟動此工具, 檔案刪除一律會放入 root 帳號的垃圾桶, 解決此一問題, 就是直接刪除檔案, 而不放入垃圾桶, 設定步驟如下 :
1. 設定滑鼠右鍵選單, 增加刪除 [選項]
2. 選取檔案或目錄, 然後按右鍵, 在選單中選 [刪除], 刪除選取項目
一旦啟動此工具, 檔案刪除一律會放入 root 帳號的垃圾桶, 解決此一問題, 就是直接刪除檔案, 而不放入垃圾桶, 設定步驟如下 :
1. 設定滑鼠右鍵選單, 增加刪除 [選項]
2. 選取檔案或目錄, 然後按右鍵, 在選單中選 [刪除], 刪除選取項目
2011年5月28日 星期六
sudo 不要來亂 - 首部曲
使用一般使用者帳號(可執行 sudo 命令) 登入Linux 系統, 如要執行系統命令 (shutdown, reboot,...), 可透過 sudo 命令, 獲得 root 權限, 來完成. 但如果使用 sudo 執行檔案刪除, 這時被刪除的檔案, 不會被丟到目前登入使用者的垃圾筒, 而是丟到 root 的垃圾筒 (/root/.local/share/Trash).
要刪除 root 的垃圾筒, 請執行以下步驟 :
1. 將 root 的垃圾筒所有檔案的擁有者, 改成目前使用者 (student)
$ sudo chown -R student /root/.local/share/Trash
2. 清除 root 的垃圾筒所有檔案
$ sudo rm -rf /root/.local/share/Trash
要刪除 root 的垃圾筒, 請執行以下步驟 :
1. 將 root 的垃圾筒所有檔案的擁有者, 改成目前使用者 (student)
$ sudo chown -R student /root/.local/share/Trash
2. 清除 root 的垃圾筒所有檔案
$ sudo rm -rf /root/.local/share/Trash
訂閱:
文章 (Atom)



