分類
Ubuntu tools

Ubuntu 使用 pppoe 設定 hinet 固定 IP

由於更換新的固定ip, 這邊紀錄在 ubuntu12.04 使用 pppoe 設定 hinet 固定ip
過程相當簡單並沒有什麼太大的問題。

1.安裝 pppoeconfig

sudo apt-get install pppoeconf

2.照著畫面操作(基本上都是選Yes)

Note: 注意在 “輸入使用者名稱” 畫面
固定ip為 xxxxxxxx@ip.hinet.net
非固定ip為 xxxxxxxx@hinet.net

3.完成之後重新啟動電腦,/etc/network/interfaces 的內容應該會類似 e.g.

auto lo
iface lo inet loopback
auto dsl-provider
iface dsl-provider inet ppp
pre-up /sbin/ifconfig eth1 up # line maintained by pppoeconf
provider dsl-provider
auto eth1
iface eth1 inet manual

4.使用 ifconfig 應該可以看到多出 ppp0 裝置 e.g.

ppp0      Link encap:Point-to-Point Protocol
          inet addr:xxx.xxx.xxx.xxx  P-t-P:168.95.98.254  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1492  Metric:1
          RX packets:27060 errors:0 dropped:0 overruns:0 frame:0
          TX packets:21000 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3
          RX bytes:24596503 (24.5 MB)  TX bytes:3591481 (3.5 MB)

 
 

分類
Ubuntu tools

Install Gradle for Ubuntu12.04, 14.04, 14.10

For Ubuntu 14.10, Ubuntu 14.04, Ubuntu 12.04

$ sudo add-apt-repository ppa:cwchien/gradle
$ sudo apt-get update
$ sudo apt-get install gradle
remove gradle
$ sudo apt-get remove gradle

 
 
 

分類
Ubuntu tools

安裝並設定 autojump

1.安裝 autojump

可以先安裝 zsh  以及 oh-my-zsh 再來安裝 autojump
直接使用 apt-get 來安裝。
sudo apt-get install autojump
 

2.安裝完成後設定shell 的配置檔

zsh: 到~/.zshrc 加入以下設定

...
plugins=(git copydir copyfile autojump)
...
...
[[ -s ~/.autojump/etc/profile.d/autojump.zsh ]] && . ~/.autojump/etc/profile.d/autojump.zsh

 

3.重新啟動 zsh,輸入以下指令並重新啟動 terminal

. ~/.zshrc

 

分類
Ubuntu tools

安裝並設定tmux

1.安裝 tmux

sudo apt-get install tmux

若出現

Package 'xclip' has no installation candidate

請輸入以下指令以更新apt

sudo apt-get update

完成後應該可以繼續安裝xclip了。

2.設定 tmux 配置檔(config file)

配置檔位於~/.tmux.conf

參考以下設定

setw -g mode-keys vi
set -g default-terminal "screen-256color"
bind r source-file ~/.tmux.conf \; display "Reloaded!"
set -g status-fg white
set -g status-bg black
setw -g window-status-fg cyan
setw -g window-status-bg default
setw -g window-status-attr dim
set -g status-justify centre
setw -g monitor-activity on
set -g visual-activity on
bind a run " tmux save-buffer - | xclip -i -sel clipboard"
bind v run " tmux set-buffer \"$(xclip -o -sel clipboard)\"; tmux paste-buffer"

3.讓 tmux 剪貼簿和系統剪貼簿(ubuntu)相通

tmux剪貼簿和系統剪貼簿並不一樣,相連的方式藉由 xclip 來達成

3-1.首先安裝 xclip

sudo apt-get install xclip

3-2.在 tmux config file 加入以下2行

bind a run " tmux save-buffer - | xclip -i -sel clipboard"
bind v run " tmux set-buffer \"$(xclip -o -sel clipboard)\"; tmux paste-buffer"

3-3. 複製 tmux 剪貼簿內容到系統剪貼簿內容的步驟為

3-3-1.
已在tmux 複製相關內容

3-3-2.
ctrl + b -> a

3-3-3.
在系統任一部分進行貼上動作。

3-4. 複製系統剪貼簿內容到 tmux剪貼簿內容

3-4-1.
已在系統複製相關內容

3-4-2.
到 tmux 中,ctrl + b -> v

4.Tmux的操作請參考以下兩篇

http://www.ruanyifeng.com/blog/2019/10/tmux.html

http://louiszhai.github.io/2017/09/30/tmux/

分類
Ubuntu tools

ubuntu 安裝 java(oracle and sun) 及切換使用的jdk

update 2016/01/27
安裝ubuntu 後,建議安裝 oracle java

sudo apt-get install python-software-properties
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java6-installer
sudo apt-get install oracle-java6-set-default

 


 
若 oracle java 運作正常,不須安裝open-jdk
安裝open-jdk

sudo apt-get install default-jdk

再安裝sun-java-6-jdk
照著AOSP 官網的教學操作

sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo apt-get update
sudo apt-get install sun-java6-jdk

 
第3步驟會出現錯誤 “找不到套件之類的….”
修正方式:

sudo add-apt-repository ppa:ferramroberto/java
or sudo add-apt-repository ppa:flexiondotorg/java
sudo apt-get update
sudo apt-get install sun-java6-jdk

即可成功安裝,過程中會要求設定 DLJ ,按確定即可
完成後使用以下指令切換 java 版本
終端機輸入

update-alternatives --config java

出現

Selection    Path                                      優先級  Status
------------------------------------------------------------
* 0            /usr/lib/jvm/java-6-openjdk/jre/bin/java   1061      auto mode
  1            /usr/lib/jvm/java-6-openjdk/jre/bin/java   1061      manual mode
  2            /usr/lib/jvm/java-6-sun/jre/bin/java       63        manual mode
0為預設的選項(openjdk),2為剛剛安裝的sunjdk,輸入數字切換
分類
Ubuntu tools

ubuntu 解壓縮 出現亂碼

安裝 p7zip ,可解決解壓縮檔出現亂碼問題
打開終端機輸入

sudo apt-get install p7zip-rar

使用終端機解壓縮

7z e 檔名.rar

更多的使用方法請參考官網吧
7-zip官網

分類
Ubuntu tools

putty psftp使用記錄

Putty
1.到官網下載 putty

2.執行 putty 依序輸入 遠端主機id , 選擇 ssh , 點擊連線

3. login as : 遠端主機帳號
    password : 遠端主機帳號密碼

psftp
1.到官網下載 psftp

2.執行 psftp 輸入 open 遠端主機id 按enter

3.輸入遠端主機帳號

4.再輸入密碼

ps.使用指令類似 sftp

分類
Ubuntu tools

ubuntu 使用 ssh sftp 記錄

ubuntu 10.04 預設沒有安裝 ssh-server, 若想遠端使用ssh登入主機就必須安裝ssh server
 
SSH
1.  安裝 ssh server
終端機輸入

sudo apt-get install openssh-server openssh-client

2. 啟動 ssh server
終端機輸入

sudo /etc/init.d/ssh start

 
3. 遠端連線
終端機輸入

ssh 遠端主機帳號@遠端主機id
輸入密碼

 
SFTP
1. 遠端連線
終端機輸入

sftp 遠端主機帳號@遠端主機id
輸入密碼

 
2. 可使用在遠端主機指令

pwd , cd , ls , dir , mkdir , rmdir , rm , rename , chmod , chgrp , chown

 
3. 可使用在本機端指令

lcd , lls , lmkdir , lpwd , lrmdir

 
4. 本機上傳檔案到遠端

put 本機檔案 遠端路徑

 
5. 從遠端下載檔案到本機

get 遠端檔案 本機路徑
分類
Ubuntu tools

ubuntu gcin 輸入法

開啟終端機輸入

apt-get install gcin

安裝完成後重開機即可使用
調整設定
系統 -> 偏好設定  -> gcin 輸入法設定 -> 內定輸入法 開啟&關閉

分類
Ubuntu tools

ubuntu10.04 調整解析度

安裝好 ubuntu 之後解析度只有 800×600 和 640×480,如何調整更大的解析度呢
參考此篇
解法:
1.
終端機輸入

gtf 1280 1024 60 -x

2.
再輸入

sudo gedit /etc/X11/xorg.conf


把以下內容全部貼到 xorg.conf裡面

Section "InputDevice"
Identifier "Generic Keyboard"
Driver "kbd"
Option "XkbRules" "xorg"
Option "XkbModel" "pc105"
Option "XkbLayout" "us"
EndSection
Section "InputDevice"
Identifier "Configured Mouse"
Driver "mouse"
Option "CorePointer"
EndSection
Section "Device"
Identifier "Configured Video Device"
EndSection
Section "Monitor"
Identifier "Configured Monitor"
Vendorname "Generic LCD Display"
Modelname "LCD Panel 1280x1024"
Horizsync 31.5-64.0
Vertrefresh 56.0 - 65.0
modeline "640x480@60" 25.2 640 656 752 800 480 490 492 525 -vsync -hsync
modeline "800x600@56" 36.0 800 824 896 1024 600 601 603 625 +hsync +vsync
modeline "800x600@60" 40.0 800 840 968 1056 600 601 605 628 +hsync +vsync
modeline "1024x768@60" 65.0 1024 1048 1184 1344 768 771 777 806 -vsync -hsync
modeline "1280x960@60" 102.1 1280 1360 1496 1712 960 961 964 994 -hsync +vsync
modeline "1280x1024@60" 108.0 1280 1328 1440 1688 1024 1025 1028 1066 +hsync +vsync
Gamma 1.0
EndSection
Section "Screen"
Identifier "Default Screen"
Monitor "Configured Monitor"
Device "Configured Video Device"
Defaultdepth 24
SubSection "Display"
Depth 24
Virtual 1280 1024
Modes "1280x1024@60" "1280x960@60" "1024x768@60" "800x600@60" "800x600@56" "640x480@60"
EndSubSection
EndSection
Section "ServerLayout"
Identifier "Default Layout"
screen 0 "Default Screen" 0 0
EndSection
Section "Module"
Load "dri"
Load "v4l"
EndSection
Section "ServerFlags"
EndSection