在目錄之下,搜尋文件檔名
$ find -iname "[file_name]"
EX: $ fine iname "*.txt"
在目錄之下,搜尋文件關鍵字
$ grep -rin "[keyword]" .
EX: $ grep -rin "HelloWord()" .
2013年11月20日 星期三
2013年11月13日 星期三
[Linux] Ubuntu 12.04的下載來源
若是預設的下載來源會讓平時apt-get install下載時找不到檔案
那麼可以將下載來源換成以下
修改/etc/apt/source.list
那麼可以將下載來源換成以下
修改/etc/apt/source.list
#deb cdrom:[Ubuntu 12.04.1 LTS _Precise Pangolin_ - Release amd64 (20120823.1)]/ dists/precise/main/binary-i386/ #deb cdrom:[Ubuntu 12.04.1 LTS _Precise Pangolin_ - Release amd64 (20120823.1)]/ dists/precise/restricted/binary-i386/ #deb cdrom:[Ubuntu 12.04.1 LTS _Precise Pangolin_ - Release amd64 (20120823.1)]/ precise main restricted # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to # newer versions of the distribution. deb http://tw.archive.ubuntu.com/ubuntu/ precise main restricted deb-src http://tw.archive.ubuntu.com/ubuntu/ precise main restricted ## Major bug fix updates produced after the final release of the ## distribution. deb http://tw.archive.ubuntu.com/ubuntu/ precise-updates main restricted deb-src http://tw.archive.ubuntu.com/ubuntu/ precise-updates main restricted ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team. Also, please note that software in universe WILL NOT receive any ## review or updates from the Ubuntu security team. deb http://tw.archive.ubuntu.com/ubuntu/ precise universe deb-src http://tw.archive.ubuntu.com/ubuntu/ precise universe deb http://tw.archive.ubuntu.com/ubuntu/ precise-updates universe deb-src http://tw.archive.ubuntu.com/ubuntu/ precise-updates universe ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team, and may not be under a free licence. Please satisfy yourself as to ## your rights to use the software. Also, please note that software in ## multiverse WILL NOT receive any review or updates from the Ubuntu ## security team. deb http://tw.archive.ubuntu.com/ubuntu/ precise multiverse deb-src http://tw.archive.ubuntu.com/ubuntu/ precise multiverse deb http://tw.archive.ubuntu.com/ubuntu/ precise-updates multiverse deb-src http://tw.archive.ubuntu.com/ubuntu/ precise-updates multiverse ## N.B. software from this repository may not have been tested as ## extensively as that contained in the main release, although it includes ## newer versions of some applications which may provide useful features. ## Also, please note that software in backports WILL NOT receive any review ## or updates from the Ubuntu security team. deb http://tw.archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse deb-src http://tw.archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse deb http://security.ubuntu.com/ubuntu precise-security main restricted deb-src http://security.ubuntu.com/ubuntu precise-security main restricted deb http://security.ubuntu.com/ubuntu precise-security universe deb-src http://security.ubuntu.com/ubuntu precise-security universe deb http://security.ubuntu.com/ubuntu precise-security multiverse deb-src http://security.ubuntu.com/ubuntu precise-security multiverse ## Uncomment the following two lines to add software from Canonical's ## 'partner' repository. ## This software is not part of Ubuntu, but is offered by Canonical and the ## respective vendors as a service to Ubuntu users. # deb http://archive.canonical.com/ubuntu precise partner # deb-src http://archive.canonical.com/ubuntu precise partner ## This software is not part of Ubuntu, but is offered by third-party ## developers who want to ship their latest software. deb http://extras.ubuntu.com/ubuntu precise main deb-src http://extras.ubuntu.com/ubuntu precise main
2013年10月4日 星期五
[Linux] 製作patch;打patch
1. 製作patch
使用linux的diff指令,diff舊檔案及新檔案的差別,並輸出成.patch
$ diff -Naur [old_file] [new_file] > [patch_name].patch
2. 打patch
使用linux的patch指令,將patch內容更新舊檔案
$ patch -p0 < [patch_name].patch
將檔案復原
$ patch -R -p0 < [patch_name].patch
2013年10月3日 星期四
2013年8月26日 星期一
[Linux] 在Ubuntu上看影片;解決mplayer載入srt字幕亂碼
因為有在Ubuntu看影片的需求,搜尋了一下
在Linux中一個很強大的播放程式--mplayer
安裝
$ sudo apt-get install mplayer
播放
$ mplayer [檔名]
若有字幕,請放在同一個位置,並取與影片檔相同檔名
若srv字幕為繁體中文,通常編碼為big5
容易會有亂碼的情形發生
因此可在家目錄底下的.mplayer中找到config這隻檔案並修改
(若無,請建立$HOME/.mplayer/config)
font可在/usr/share/fonts/truetype搜尋字體並修改
在Linux中一個很強大的播放程式--mplayer
安裝
$ sudo apt-get install mplayer
播放
$ mplayer [檔名]
若有字幕,請放在同一個位置,並取與影片檔相同檔名
若srv字幕為繁體中文,通常編碼為big5
容易會有亂碼的情形發生
因此可在家目錄底下的.mplayer中找到config這隻檔案並修改
(若無,請建立$HOME/.mplayer/config)
font可在/usr/share/fonts/truetype搜尋字體並修改
subcp=cp950 unicode=yes subfont-text-scale=3 font=/usr/share/fonts/truetype/arphic/ukai.ttc
2013年8月13日 星期二
[Linux][Windows] 使用vnc viewer遠端連線
本篇文章介紹兩種遠端連線
1. Linux -> Linux
2. Windows -> Linux
OS:
Ubuntu 12.04
Windows 7
//===========================================================
Linux -> Linux
假使我們要從電腦A連到電腦B
1. (電腦B) 設定可被遠端連線,搜尋桌面分享

2. (電腦B) 設定允許其他使用者觀看桌面,如果需要打密碼則設定密碼

3. (電腦A) 安裝gtk vnc viewer
$ sudo apte-get install gtkvncviewer
4. (電腦A) 搜尋gtk vnc viewer並打開程式

5. (電腦A) 輸入要遠端連線的ip位址,若有密碼則輸入密碼,點選連線

6. (電腦A) 連線的畫面

//===========================================================
Windows -> Linux
假使我們要從電腦A連到電腦B
1. (電腦B) 與上面敘述相同
2. (電腦A) 到官網下載vnc viewer
http://www.realvnc.com/download/viewer/
3. (電腦A) 打開程式並輸入要遠端連線的ip

4. (電腦A) 如果電腦B有設定密碼,在連線之後會跳出輸入密碼的視窗

5. (電腦A) 連線的畫面

1. Linux -> Linux
2. Windows -> Linux
OS:
Ubuntu 12.04
Windows 7
//===========================================================
Linux -> Linux
假使我們要從電腦A連到電腦B
1. (電腦B) 設定可被遠端連線,搜尋桌面分享

2. (電腦B) 設定允許其他使用者觀看桌面,如果需要打密碼則設定密碼

3. (電腦A) 安裝gtk vnc viewer
$ sudo apte-get install gtkvncviewer
4. (電腦A) 搜尋gtk vnc viewer並打開程式

5. (電腦A) 輸入要遠端連線的ip位址,若有密碼則輸入密碼,點選連線

6. (電腦A) 連線的畫面

//===========================================================
Windows -> Linux
假使我們要從電腦A連到電腦B
1. (電腦B) 與上面敘述相同
2. (電腦A) 到官網下載vnc viewer
http://www.realvnc.com/download/viewer/
3. (電腦A) 打開程式並輸入要遠端連線的ip

4. (電腦A) 如果電腦B有設定密碼,在連線之後會跳出輸入密碼的視窗

5. (電腦A) 連線的畫面

2013年8月8日 星期四
[Linux] 強制踢出使用者
1). 搜尋使用者登入的process
$ ps -aux | grep -rin "account1"
2). 砍掉process
$ sudo kill [process_id]
$ ps -aux | grep -rin "account1"
2). 砍掉process
$ sudo kill [process_id]
2013年8月7日 星期三
[Linux][Git][Gerrit] 修改git clone codebase的名字
當從gerrit上git clone codebase時
有些server會檢查用戶name
若name不符合時則無法get code
此時可以在~/.ssh/config設置get code的名字
EX: For gerrit
有些server會檢查用戶name
若name不符合時則無法get code
此時可以在~/.ssh/config設置get code的名字
Hostname ip,ip,ip,ip #若是需要設公司proxy ProxyCommand connect -H ip.ip.ip.ip:port %h %p User account1
EX: For gerrit
hostname ip,ip,ip,ip port 29418 user account1
2013年8月5日 星期一
[Linux] 設定系統proxy
1). 利用command方式設定proxy
$ export http_proxy=http://ip.ip.ip.ip:port/
$ export ftp_proxy=http://ip.ip.ip.ip:port/
2). 寫入bashrc
$ source ~/.bashrc
$ export http_proxy=http://ip.ip.ip.ip:port/
$ export ftp_proxy=http://ip.ip.ip.ip:port/
2). 寫入bashrc
$ source ~/.bashrc
2013年8月2日 星期五
[Linux] 固定ip設定
1. 修改/etc/network/interfaces,僅留下以下資訊
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address ip.ip.ip.ip
netmask 255.255.255.0
gateway ip.ip.ip.254
# dns-nameservers 10.110.15.1
# dns-nameservers 10.110.15.2
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address ip.ip.ip.ip
netmask 255.255.255.0
gateway ip.ip.ip.254
# dns-nameservers 10.110.15.1
# dns-nameservers 10.110.15.2
2. Ubuntu 12.04的dns改位置
舊版本修改/etc/resolv.conf
12.04需改在/etc/network/interfaces
dns-nameservers的部份
舊版本修改/etc/resolv.conf
12.04需改在/etc/network/interfaces
dns-nameservers的部份
2013年7月31日 星期三
[Linux] 架設Gerrit + LDAP auth
建立放置Gerrit的帳戶
1). sudo useradd -m -s /bin/bash gerrit
2). sudo passwd gerrit
安裝MySQL
1). 下載
sudo apt-get install mysql-server libapache2-mod-php5 libapache2-mod-auth-mysql php5-mysql
設定新建帳戶mysql密碼
※ MySQL-server: MySQL Server
※ libapache2-mod-php5: 把 Apache2 跟 PHP5 連接起來用的 Module
※ libapache2-mod-auth-mysql: MySQL for Apache HTTP Server
※ php5-mysql: MySQL for Apache HTTP Server
2). 建立初始值
a). 以root登入
mysql –u root -p
b). 建立gerrit這個使用者帳號,且密碼為0000
CREATE USER 'gerrit'@'localhost' IDENTIFIED BY '0000';
c). 建立reviewdb這個資料庫
CREATE DATABASE reviewdb;
d). 設定資料庫的編碼方式為latin1
ALTER DATABASE reviewdb charset=latin1;
e). 將 reviewdb 資料庫權限,開給 gerrit@localhost
GRANT ALL ON reviewdb.* TO 'gerrit'@'localhost';
f). 載用新設好的權限
FLUSH PRIVILEGES;
安裝Apache
1). 下載
sudo apt-get install apache2
2). 重開
sudo service apache2 restart
安裝PHP
1). 下載
sudo apt-get install php5
2). 測試方法: 在/var/www/中將以下程式碼新增成一隻檔案(.php),測試apache2能不能解讀php
安裝PHPmyAdmin (可有UI方式管理MySQL,網址是http://ip.ip.ip.ip/phpmyadmin)
1). 下載
sudo apt-get install phpmyadmin
2). 因為phpmyadmin並不是放在apache2預設目錄,需將phpmyadmin inclue到apache2,將以下程式碼加在apache2.config檔之後
sudo vi /etc/apache2/apache2.conf
sudo service apache2 restart
安裝postfix mail system (與下面Exim4擇一,此在設定比較單純)
1). 下載
sudo apt-get install postfix
安裝Exim4 mail system (輕量級mail system)
1). 下載
sudo apt-get install exim4
2). 依照公司rule修改/etc/exim4/update-exim4.conf.conf
安裝Gerrit
1). 到官網下載,放在使用者gerrit家目錄
2). 切換到使用者gerrit
sudo su - gerrit
3). 安裝
java -jar gerrit-full-2.5.war init -d review_site
4). review_site/etc/gerrit.conf範本參考,修改完後須重新安裝,並打上LDAP AD帳號密碼及MySQL密碼
1). sudo useradd -m -s /bin/bash gerrit
2). sudo passwd gerrit
安裝MySQL
1). 下載
sudo apt-get install mysql-server libapache2-mod-php5 libapache2-mod-auth-mysql php5-mysql
設定新建帳戶mysql密碼
※ MySQL-server: MySQL Server
※ libapache2-mod-php5: 把 Apache2 跟 PHP5 連接起來用的 Module
※ libapache2-mod-auth-mysql: MySQL for Apache HTTP Server
※ php5-mysql: MySQL for Apache HTTP Server
2). 建立初始值
a). 以root登入
mysql –u root -p
b). 建立gerrit這個使用者帳號,且密碼為0000
CREATE USER 'gerrit'@'localhost' IDENTIFIED BY '0000';
c). 建立reviewdb這個資料庫
CREATE DATABASE reviewdb;
d). 設定資料庫的編碼方式為latin1
ALTER DATABASE reviewdb charset=latin1;
e). 將 reviewdb 資料庫權限,開給 gerrit@localhost
GRANT ALL ON reviewdb.* TO 'gerrit'@'localhost';
f). 載用新設好的權限
FLUSH PRIVILEGES;
安裝Apache
1). 下載
sudo apt-get install apache2
2). 重開
sudo service apache2 restart
安裝PHP
1). 下載
sudo apt-get install php5
2). 測試方法: 在/var/www/中將以下程式碼新增成一隻檔案(.php),測試apache2能不能解讀php
<?php phpinfo(); ?>
安裝PHPmyAdmin (可有UI方式管理MySQL,網址是http://ip.ip.ip.ip/phpmyadmin)
1). 下載
sudo apt-get install phpmyadmin
2). 因為phpmyadmin並不是放在apache2預設目錄,需將phpmyadmin inclue到apache2,將以下程式碼加在apache2.config檔之後
sudo vi /etc/apache2/apache2.conf
Include /etc/phpmyadmin/apache.conf3). 重開apache2
sudo service apache2 restart
安裝postfix mail system (與下面Exim4擇一,此在設定比較單純)
1). 下載
sudo apt-get install postfix
安裝Exim4 mail system (輕量級mail system)
1). 下載
sudo apt-get install exim4
2). 依照公司rule修改/etc/exim4/update-exim4.conf.conf
dc_eximconfig_configtype='smarthost' dc_relay_domains='example.com' dc_relay_nets='ip.ip.ip.ip' dc_smarthost='example.com'
安裝Gerrit
1). 到官網下載,放在使用者gerrit家目錄
2). 切換到使用者gerrit
sudo su - gerrit
3). 安裝
java -jar gerrit-full-2.5.war init -d review_site
4). review_site/etc/gerrit.conf範本參考,修改完後須重新安裝,並打上LDAP AD帳號密碼及MySQL密碼
[gerrit] basePath = git canonicalWebUrl = http://ip.ip.ip.ip:8080/ [database] type = MYSQL hostname = localhost database = reviewdb username = gerrit [auth] type = LDAP emailFormat = {0}@example.com [ldap] server = ldap://ip.ip.ip.ip username = 公司網域\\公司AD帳號 accountBase = OU=xxx,OU=xxx,DC=example,DC=com accountPattern = (&(objectClass=person)(sAMAccountName=${username})) accountFullName = displayName accountEmailAddress = ${mail.toLowerCase} accountMemberField = memberOf referral = follow groupBase = OU=xxx,OU=xxx,DC=example,DC=com groupPattern = (&(objectClass=group)(cn=${groupname})) [sendemail] smtpServer = localhost [container] user = gerrit_test javaHome = /usr/lib/jvm/java-6-sun-1.6.0.26/jre [sshd] listenAddress = *:29418 [httpd] listenUrl = http://*:8080/ [cache] directory = cache
2013年7月29日 星期一
[Linux] 透過scp上傳下載檔案
若要上傳檔案到另外一台電腦
可透過scp的方式簡單的上傳過去
1. 上傳
$ scp [file_name] [account]@[ip]:[path]
EX: scp test.txt testcount@1.2.3.4:~
~為家目錄
將test.txt上傳到ip:1.2.3.4的家目錄中
2. 下載
$ scp [account]@[ip]:[path] [local_path]
EX: scp testcount@1.2.3.4:test.txt ~/temp
將ip:1.2.3.4家目錄的test.txt下載到自己電腦家目錄temp資料夾底下
可透過scp的方式簡單的上傳過去
1. 上傳
$ scp [file_name] [account]@[ip]:[path]
EX: scp test.txt testcount@1.2.3.4:~
~為家目錄
將test.txt上傳到ip:1.2.3.4的家目錄中
2. 下載
$ scp [account]@[ip]:[path] [local_path]
EX: scp testcount@1.2.3.4:test.txt ~/temp
將ip:1.2.3.4家目錄的test.txt下載到自己電腦家目錄temp資料夾底下
2013年7月26日 星期五
[Linux] Ubuntu開機將kernel版本退版
若是當Ubuntu遇到無法開機進入桌面
可藉由在開機選單,選取較舊的kernel版本
使之正常開機
1. 疑似更新的關係,導致開機後變成這個畫面

2. 開機跑完電腦品牌的logo,按shift進入開機選單

3. 點選第三個

4. 選擇較舊的kernel版本

//===========================================
8/1 update
1. 列出現在使用的kernel
$ sudo uname -ra
2. 列出目前系統有的kernel image
$ sudo dpkg --list |grep linux-image
3. 刪除不要的kernel image
$ sudo apt-get purge linux-image-版號
可藉由在開機選單,選取較舊的kernel版本
使之正常開機
1. 疑似更新的關係,導致開機後變成這個畫面
2. 開機跑完電腦品牌的logo,按shift進入開機選單
3. 點選第三個
4. 選擇較舊的kernel版本
//===========================================
8/1 update
1. 列出現在使用的kernel
$ sudo uname -ra
2. 列出目前系統有的kernel image
$ sudo dpkg --list |grep linux-image
3. 刪除不要的kernel image
$ sudo apt-get purge linux-image-版號
2013年7月18日 星期四
[Linux][Android] 在Ubuntu12.04建置build code環境
OS: Ubuntu_12.04_64bit
1. 安裝build code環境
$ sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib mingw32 openjdk-6-jdk tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386
$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
2. gcc 4.4.X
由於新版的gcc會影響build code error,須降版成4.4.X
(code不夠嚴謹,跟不上gcc4.6)
1). 安裝
$ sudo apt-get install gcc-4.4 g++-4.4 gcc-4.4-multilib g++-4.4-multilib
2). 設定gcc及g++的參數
$ sudo update-alternatives --install \
/usr/bin/gcc gcc /usr/bin/gcc-4.6 60 \
--slave /usr/bin/g++ g++ /usr/bin/g++-4.6
$ sudo update-alternatives --install \
/usr/bin/gcc gcc /usr/bin/gcc-4.4 40 \
--slave /usr/bin/g++ g++ /usr/bin/g++-4.4
3). 選擇gcc-4.4
$ sudo update-alternatives --config gcc
3. JDK
Ubuntu12.04預設是open jdk,需指定成sun jdk
可參考:http://qnworknote.blogspot.tw/2012/09/linux-java.html
由於android makefile只支援到1.6.X,建議用1.6.X版本
1). 到官網下載6u45
http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase6-419409.html#jdk-6u45-oth-JPR
2). $ chmod u+x jdk-6u45-linux-x64.bin
$ sudo ./jdk-6u45-linux-x64.bin
$ sudo mkdir /usr/lib/jvm
$ sudo cp -rf jdk1.6.0_45 /usr/lib/jvm/
$ sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.6.0_45/bin/java" 1
$ sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.6.0_45/bin/javac" 1
$ sudo update-alternatives --install "/usr/lib/mozilla/plugins/libjavaplugin.so" "mozilla-javaplugin.so" "/usr/lib/jvm/jdk1.6.0_45/jre/lib/amd64/libnpjp2.so" 1
3). 檢查各項目的優先順序是否正確
//====================================================
※額外補充:
1. 新增repo的環境變數
1). 下載repo (也可以直接從網址下載)
$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > .
2). repo設為可執行
$ chmod a+x repo
3). 設為環境變數
$ cp repo /usr/bin
2. 新增adb的環境變數
1). 下載adt bundle,並取得adb
從Android Developer下載adb bundle:http://developer.android.com/sdk/index.html
adb位置:adt-bundle-linux-x86_64-20130219/sdk/platform-tools/adb
2). 設為環境變數
$ cd [PATH]/adt-bundle-linux-x86_64-20130219/sdk/platform-tools/
$ cp adb /usr/bin
1. 安裝build code環境
$ sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib mingw32 openjdk-6-jdk tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386
$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
2. gcc 4.4.X
由於新版的gcc會影響build code error,須降版成4.4.X
(code不夠嚴謹,跟不上gcc4.6)
1). 安裝
$ sudo apt-get install gcc-4.4 g++-4.4 gcc-4.4-multilib g++-4.4-multilib
2). 設定gcc及g++的參數
$ sudo update-alternatives --install \
/usr/bin/gcc gcc /usr/bin/gcc-4.6 60 \
--slave /usr/bin/g++ g++ /usr/bin/g++-4.6
$ sudo update-alternatives --install \
/usr/bin/gcc gcc /usr/bin/gcc-4.4 40 \
--slave /usr/bin/g++ g++ /usr/bin/g++-4.4
3). 選擇gcc-4.4
$ sudo update-alternatives --config gcc
3. JDK
Ubuntu12.04預設是open jdk,需指定成sun jdk
可參考:http://qnworknote.blogspot.tw/2012/09/linux-java.html
由於android makefile只支援到1.6.X,建議用1.6.X版本
1). 到官網下載6u45
http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase6-419409.html#jdk-6u45-oth-JPR
2). $ chmod u+x jdk-6u45-linux-x64.bin
$ sudo ./jdk-6u45-linux-x64.bin
$ sudo mkdir /usr/lib/jvm
$ sudo cp -rf jdk1.6.0_45 /usr/lib/jvm/
$ sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.6.0_45/bin/java" 1
$ sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.6.0_45/bin/javac" 1
$ sudo update-alternatives --install "/usr/lib/mozilla/plugins/libjavaplugin.so" "mozilla-javaplugin.so" "/usr/lib/jvm/jdk1.6.0_45/jre/lib/amd64/libnpjp2.so" 1
3). 檢查各項目的優先順序是否正確
//====================================================
※額外補充:
1. 新增repo的環境變數
1). 下載repo (也可以直接從網址下載)
$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > .
2). repo設為可執行
$ chmod a+x repo
3). 設為環境變數
$ cp repo /usr/bin
2. 新增adb的環境變數
1). 下載adt bundle,並取得adb
從Android Developer下載adb bundle:http://developer.android.com/sdk/index.html
adb位置:adt-bundle-linux-x86_64-20130219/sdk/platform-tools/adb
2). 設為環境變數
$ cd [PATH]/adt-bundle-linux-x86_64-20130219/sdk/platform-tools/
$ cp adb /usr/bin
[Linux][JAVA] 指定JAVA位址
查看JAVA版本
$ java -version
指定JAVA軟體版本
使用update-alternatives來管理
例如有open jdk及sun jdk兩種版本,使用要使用哪種jdk
1). display,顯示此套件總共存有哪些路徑
sudo update-alternatives --display [name]
EX: sudo update-alternatives --display java
2). install,增加一組此套件
sudo update-alternatives --install [link] [name] [path] [priority]
EX: sudo update-alternatives --install /usr/bin/java java /home/qn_lo/WTS/java/jdk/bin/java 1062
3). remove,移除此套件
sudo update-alternatives --remove [name] [path]
EX: sudo update-alternatives --remove java /home/qn_lo/WTS/java/jdk/bin/java
4). config ,修改套件使用的優先權
sudo update-alternatives --config [name]
EX: sudo update-alternatives --config java

測試JAVA是否正常運作
http://www.java.com/zh_TW/download/testjava.jsp

//======================================
7/18補充
在Ubuntu 12.04建置Android build code環境,java部份
由於android makefile只支援到1.6.X,建議用1.6.X版本
1). 到官網下載6u32
http://www.oracle.com/technetwork/java/javase/downloads/jdk-6u32-downloads-1594644.html
2).
$ chmod u+x jdk-6u32-linux-x64.bin
$ sudo ./jdk-6u32-linux-x64.bin
$ sudo mkdir /usr/lib/jvm
$ sudo cp -rf jdk1.6.0_32 /usr/lib/jvm/
$ sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.6.0_32/bin/java" 1
$ sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.6.0_32/bin/javac" 1
$ sudo update-alternatives --install "/usr/lib/mozilla/plugins/libjavaplugin.so" "mozilla-javaplugin.so" "/usr/lib/jvm/jdk1.6.0_32/jre/lib/x64/libnpjp2.so" 1
3). 檢查各項目的優先權是否正確
EX: sudo update-alternatives --config [name]
指定JAVA軟體版本
使用update-alternatives來管理
例如有open jdk及sun jdk兩種版本,使用要使用哪種jdk
1). display,顯示此套件總共存有哪些路徑
sudo update-alternatives --display [name]
EX: sudo update-alternatives --display java
2). install,增加一組此套件
sudo update-alternatives --install [link] [name] [path] [priority]
EX: sudo update-alternatives --install /usr/bin/java java /home/qn_lo/WTS/java/jdk/bin/java 1062
3). remove,移除此套件
sudo update-alternatives --remove [name] [path]
EX: sudo update-alternatives --remove java /home/qn_lo/WTS/java/jdk/bin/java
4). config ,修改套件使用的優先權
sudo update-alternatives --config [name]
EX: sudo update-alternatives --config java

測試JAVA是否正常運作
http://www.java.com/zh_TW/download/testjava.jsp

//======================================
7/18補充
在Ubuntu 12.04建置Android build code環境,java部份
由於android makefile只支援到1.6.X,建議用1.6.X版本
1). 到官網下載6u32
http://www.oracle.com/technetwork/java/javase/downloads/jdk-6u32-downloads-1594644.html
2).
$ chmod u+x jdk-6u32-linux-x64.bin
$ sudo ./jdk-6u32-linux-x64.bin
$ sudo mkdir /usr/lib/jvm
$ sudo cp -rf jdk1.6.0_32 /usr/lib/jvm/
$ sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.6.0_32/bin/java" 1
$ sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.6.0_32/bin/javac" 1
$ sudo update-alternatives --install "/usr/lib/mozilla/plugins/libjavaplugin.so" "mozilla-javaplugin.so" "/usr/lib/jvm/jdk1.6.0_32/jre/lib/x64/libnpjp2.so" 1
3). 檢查各項目的優先權是否正確
EX: sudo update-alternatives --config [name]
2013年7月17日 星期三
[Linux] 改變Ubuntu桌面資料夾的路徑
Ubuntu在家目錄底下有預設幾個資料夾
可以將這些路徑換成自己想要的
ex: 桌面從中文『桌面』換成英文『desktop』
--
--
refs: https://wiki.ubuntu.com/TIPs_of_use_ubuntu
可以將這些路徑換成自己想要的
ex: 桌面從中文『桌面』換成英文『desktop』
--
將ubuntu桌面資料夾等中文路徑改成英文路徑
cd ~ rm Desktop mv 桌面 Desktop mv 模板 Template mv 公共 Public mv 文件 Document mv 音樂 Music mv 圖片 Picture mv 影片 Video ln -s Desktop 桌面 ln -s Template 模板 ln -s Public 公共 ln -s Document 文件 ln -s Music 音樂 ln -s Picture 圖片 ln -s Video 影片 gedit ~/.config/user-dirs.dirs
將資料更改如下
XDG_DESKTOP_DIR="$HOME/Desktop" XDG_DOWNLOAD_DIR="$HOME/Desktop" XDG_TEMPLATES_DIR="$HOME/Template" XDG_PUBLICSHARE_DIR="$HOME/Public" XDG_DOCUMENTS_DIR="$HOME/Document" XDG_MUSIC_DIR="$HOME/Music" XDG_PICTURES_DIR="$HOME/Picture" XDG_VIDEOS_DIR="$HOME/Video"
重新啟動Xwindow
sudo /etc/init.d/gdm restart
--
refs: https://wiki.ubuntu.com/TIPs_of_use_ubuntu
2013年4月19日 星期五
2013年3月25日 星期一
[Linux] 多檔案一次取代文件字元
find -iname "[file_name]" | xargs sed -i 's/[old_string]/[new_string]/g'
ex: find -iname "note.txt" | xargs sed -i 's/adb/def/g'
訂閱:
意見 (Atom)