2011年12月29日 星期四

Linux 各種壓縮與解壓縮指令

.tar

  • 套件:tar
  • 打包:tar cvf FileName.tar DirName
  • 解包: tar xvf FileName.tar

.gz

  • 套件:gzip
  • 壓縮:gzip FileName
  • 解壓1:gunzip FileName.gz
  • 解壓2:gzip -d FileName.gz

.tar.gz

  • 套件:gzip
  • 壓縮:tar zcvf FileName.tar.gz DirName
  • 解壓:tar zxvf FileName.tar.gz

.bz2

  • 套件:bzip2
  • 壓縮: bzip2 -z FileName
  • 解壓1:bzip2 -d FileName.bz2
  • 解壓2:bunzip2 FileName.bz2

.tar.bz2

  • 套件:bzip2
  • 壓縮:tar jcvf FileName.tar.bz2 DirName
  • 解壓:tar jxvf FileName.tar.bz2

bz

  • 壓縮:unkown
  • 解壓1:bzip2 -d FileName.bz
  • 解壓2:bunzip2 FileName.bz

.tar.bz

  • 壓縮:unkown
  • 解壓:tar jxvf FileName.tar.bz

.Z

  • 壓縮:compress FileName
  • 解壓:uncompress FileName.Z

.tar.Z

  • 壓縮:tar Zcvf FileName.tar.Z DirName
  • 解壓:tar Zxvf FileName.tar.Z

.tgz

  • 壓縮:unkown
  • 解壓:tar zxvf FileName.tgz

.tar.tgz

  • 壓縮:tar zcvf FileName.tar.tgz FileName
  • 解壓:tar zxvf FileName.tar.tgz

.zip

  • 套件:zip
  • 壓縮:zip FileName.zip DirName
  • 解壓:unzip FileName.zip

.rar

  • 套件:rar, unrar
  • 壓縮:rar a FileName.rar DirName
  • 解壓1:rar e FileName.rar
  • 解壓2:unrar e FileName.rar

.lha

  • 套件:lha
  • 壓縮:lha -a FileName.lha FileName
  • 解壓:lha -e FileName.lha

.7z

  • 套件:p7zip-full
  • 壓縮:7zr a FileName
  • 解壓:7zr x FileName.7z
Writing by凍仁翔

Ubuntu MYSQL 匯出資料庫程式與星期備份檔名語法用法

1.日期第一行 宣告日期
 now=`/bin/date`

2.MYSQL DB匯出指令
/usr/bin/mysqldump --opt --user=帳號 -p --password=密碼  資料庫名稱  > /mnt/匯出路徑/`echo $now | cut -b 1-3`-檔案定義名稱.sql

3.還原指令

mysqldump --lock-all-tables -u root -p 資料庫名稱 > example.sql


mysql -u root -p 資料庫名稱 < example.sql

Ubuntu之NFS SERVER & Client 安裝及開機自動掛載設定

Server 部份:

1. 安裝 NFS server 套件
 
    sudo apt-get install nfs-common nfs-kernel-server

2. 設定要共享的路徑和使用權限

    sudo vim /etc/exports

    #將 /nfs_root 這個路徑 share 給 all net 使用,但只可讀並且資料會同步寫入到記憶體與硬碟中。
    /nfs_root *(ro,sync,no_subtree_check)

3. 啟動 NFS server

    sudo /etc/init.d/nfs-kernel-server start

4. 檢查 NFS server 是否成功被啟動了

    sudo showmount -e localhost

    #看到底下剛剛設定的共享路徑代表成功了。
    Export list for localhost:
    /nfs_root *


註:
(1) 使用者可以用 showmount -e nfs_server_ip 看這個NFS server有哪些共享路徑。
(2) 使用者可以用 mount -t nfs nfs_server_ip:共享路徑 /mnt 來掛載NFS server提供的共享路徑。




Client 方式一:
1. 安裝 nfs client
$ sudo apt-get install nfs-common
2. 將 nas 分享的資料夾,掛上伺服器
$ sudo mount -t nfs 192.168.0.125:/test/遠端路徑  /mnt/本地端路徑
3. 若要重新開機後,自動掛載,則需修改 /etc/fstab
$ sudo nano fstab
加入
192.168.0.125:/test/遠端路徑     /mnt/本地端路徑   nfs defaults 1 1
即可
Client 方式二:

將 NFS 開機即掛載就寫入 /etc/rc.d/rc.local 即可。

mount -t nfs -o nosuid,noexec,nodev,rw,bg,soft,rsize=32768,wsize=32768 \192.168.100.254遠端IP:/home/public遠端目錄位置   /home/nfs/public本機目錄位置

2011年12月6日 星期二

Ubuntu VSFtp 安裝

我們使用ubuntu預設的 apt-get 套件來做安裝。

sudo apt-get install vsftpd

過程中,它會問你是否要安裝,請你按Y即可。
安裝完成後,我們可以來查看是否安裝成功,可用下列指令。

netstat -tul | grep ftp

下列會顯示一行訊息,最後會有一個LISTEN,表示已運行待命中。



你可以使用root開啟檔案總管,然後開啟/etc/vsftpd.conf,並編輯他
或者是直接在終端機內輸入。

sudo vim /etc/vsftpd.conf

接下來以下為我的參數設定:
#==================================================

# Example config file /etc/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
#
# Run standalone? vsftpd can run either from an inetd or as a standalone
# daemon started from an initscript.
listen=YES
#
# Run standalone with IPv6?
# Like the listen parameter, except vsftpd will listen on an IPv6 socket
# instead of an IPv4 one. This parameter and the listen parameter are mutually
# exclusive.
#listen_ipv6=YES
#
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=NO
#
# Uncomment this to allow local users to log in.
local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
local_umask=022
#
# Uncomment this to allow the anonymous FTP user to upload files. This only
# has an effect if the above global write enable is activated. Also, you will
# obviously need to create a directory writable by the FTP user.
#anon_upload_enable=YES
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
#anon_mkdir_write_enable=YES
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES
#
# Activate logging of uploads/downloads.
xferlog_enable=YES
#
# Make sure PORT transfer connections originate from port 20 (ftp-data).
connect_from_port_20=YES
#
# If you want, you can arrange for uploaded anonymous files to be owned by
# a different user. Note! Using "root" for uploaded files is not
# recommended!
#chown_uploads=YES
#chown_username=whoever
#
# You may override where the log file goes if you like. The default is shown
# below.
xferlog_file=/var/log/vsftpd.log
#
# If you want, you can have your log file in standard ftpd xferlog format
xferlog_std_format=YES
#
# You may change the default value for timing out an idle session.
idle_session_timeout=600
#
# You may change the default value for timing out a data connection.
#data_connection_timeout=120
#
# It is recommended that you define on your system a unique user which the
# ftp server can use as a totally isolated and unprivileged user.
#nopriv_user=ftpsecure
#
# Enable this and the server will recognise asynchronous ABOR requests. Not
# recommended for security (the code is non-trivial). Not enabling it,
# however, may confuse older FTP clients.
#async_abor_enable=YES
#
# By default the server will pretend to allow ASCII mode but in fact ignore
# the request. Turn on the below options to have the server actually do ASCII
# mangling on files when in ASCII mode.
# Beware that on some FTP servers, ASCII support allows a denial of service
# attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd
# predicted this attack and has always been safe, reporting the size of the
# raw file.
# ASCII mangling is a horrible feature of the protocol.
#ascii_upload_enable=YES
#ascii_download_enable=YES
#
# You may fully customise the login banner string:
#ftpd_banner=Welcome to OIpingo FTP service.
#
# You may specify a file of disallowed anonymous e-mail addresses. Apparently
# useful for combatting certain DoS attacks.
#deny_email_enable=YES
# (default follows)
#banned_email_file=/etc/vsftpd.banned_emails
#
# You may restrict local users to their home directories. See the FAQ for
# the possible risks in this before using chroot_local_user or
# chroot_list_enable below.
#chroot_local_user=YES
#
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
chroot_list_enable=YES
# (default follows)
chroot_list_file=/etc/vsftpd.chroot_list
#
# You may activate the "-R" option to the builtin ls. This is disabled by
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
# the presence of the "-R" option, so there is a strong case for enabling it.
#ls_recurse_enable=YES
#
#
# Debian customization
#
# Some of vsftpd's settings don't fit the Debian filesystem layout by
# default. These settings are more Debian-friendly.
#
# This option should be the name of a directory which is empty. Also, the
# directory should not be writable by the ftp user. This directory is used
# as a secure chroot() jail at times vsftpd does not require filesystem
# access.
secure_chroot_dir=/var/run/vsftpd
#
# This string is the name of the PAM service vsftpd will use.
pam_service_name=vsftpd
#
# This option specifies the location of the RSA certificate to use for SSL
# encrypted connections.
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
# This option specifies the location of the RSA key to use for SSL
# encrypted connections.
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key


#可以接受的最大clinet可連線的數目
max_clients=20
#每個ip的最大連線數目
max_per_ip=15#啟用被動式連線pasv_enable=YES
#設定連線的port,可以自訂listen_port=21

Network 修改固定IP

在 Ubuntu Server 更改 IP 。
1. 編輯 ip 設定檔

Goldenmelon@ubuntu:~$ sudo vi /etc/network/interfaces


2. 更改 eth0 設定,將
auto eth0
iface eth0 inet dhcp

改為
auto eth0
iface eth0 inet static
address 192.168.˙˙˙.˙˙˙
netmask 255.255.255.0
gateway 192.168.˙˙˙.˙˙˙


3. 重新連線
GoldenMelon@ubuntu:~$ sudo /etc/init.d/networking restart

2011年12月3日 星期六

結婚紅包行情

轉貼  http://im88.tw/?p=1243
最近好日子很多,因此收到不少朋友寄來請帖為此我希望得知包多少才得體,同時(1)顧及情感程度(2)顧及對方是否好回禮,台灣習俗:回禮不能比當初收到禮金少(至少等價),因此包得好是祝福包不好是負擔,可能是自己的負擔也是對方的負擔。



此圖來自: veryWed討論區






這是PTT網友peegoo7 (瓜瓜瓜)整理出來的價目表




結論(參考朋友的看法):
(1)有分 人到 和 禮到 兩種金額,由於結婚禮金是要補助新人的做法,因此不難看出,扣除每桌費用後多少補貼的做法,好比一桌一萬元,每桌抓5-7個紅包(假設洽好是5對10人),包2000是剛好餐費,則2200到2600甚至更多是較佳的包法,這樣的算法因人、地而異


(2)人到最少得包1600,如果帶的人數太多要酌量多加一點。


(3)由於只用雙數,不用單數!不用「四」和「八」(八有「別」之意) !因此能用的數字只有600、1000、1200、1600、2000、2200、2600、3600、6000、6600等組合。


(4)你包3600給別人,碰上台灣習俗:回禮不能比當初收到禮金少(至少等價),雖可回同樣的禮數,但是由於下個數字是6000,會有你要別人包6000的味道在。



2011年12月2日 星期五

Outlook 2010 起始設定EXCHANGE or POP 錯誤連結解決方式

方式一: http://support.microsoft.com/kb/252304/zh-tw
方式二: http://support.microsoft.com/kb/913843/zh-tw


Outlook 2007

  1. 依序按一下 [開始][執行],在 [開啟] 方塊中輸入 regedit,然後按一下 [確定]
  2. 找出並按一下下列子機碼:
    HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Outlook\RPC
  3. 在 [編輯] 功能表上,指向 [新增],然後按一下 [DWORD 值]
  4. 輸入 DefConnectOpts,再按下 ENTER。
  5. 用滑鼠右鍵按一下 [DefConnectOpts],然後按一下 [修改]
  6. 在 [數值資料] 方塊中,輸入 0,然後按一下 [確定]
  7. 結束 [登錄編輯程式]。

Outlook 2010

  1. 按一下 [開始],按一下 [執行],在 [開啟] 方塊中輸入 regedit,然後按一下 [確定]
  2. 找出下列子機碼並按一下:
    HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Outlook\RPC
  3. 在 [編輯] 功能表上,指向 [新增],然後按一下 [DWORD 值]
  4. 輸入 DefConnectOpts,再按下 ENTER。
  5. 用滑鼠右鍵按一下 [DefConnectOpts],然後按一下 [修改]
  6. 在 [數值資料] 方塊中,輸入 0,然後按一下 [確定]
  7. 結束「登錄編輯程式」。

從 Windows Live Mail 匯入電子郵件 適用: Microsoft Outlook 2010

您可以從 Windows Live Mail 匯出電子郵件,再匯入 Microsoft Outlook 2010。Windows Live Mail 屬於 Windows Live 程式集,是 Outlook Express 和 Windows Live Desktop 的後續產品。
 附註    這些步驟僅會匯入您在 Windows Live Mail 中儲存的郵件,而不會移轉帳戶設定。如需將電子郵件帳戶新增至 Outlook 的詳細資訊,請參閱新增或移除電子郵件帳戶
  1. 啟動 Outlook。
  2. 啟動 Windows Live Mail。
  3. 在 Windows Live Mail 中,按一下 [檔案] 或按 ALT+M 鍵顯示 [檔案] 功能表列。
  4. 指向 [檔案] 功能表上的 [匯出],然後按一下 [郵件]
  5. 按一下 [Windows Live Mail 匯出精靈] 中的 [Microsoft Exchange],然後按 [下一步]
  6. 下列訊息出現時,按一下 [確定]
[這樣將會從 Windows Live Mail 匯出郵件至 Microsoft Outlook 或 Microsoft Exchange]
  1. 若要指定您要匯出的檔案,請按一下 [全部],然後按一下 [確定];或按一下 [選取的資料夾],然後選取您要匯出的資料夾,再按一下 [確定]
  2. 按一下 [匯出完成] 視窗中的 [完成]