4ING 的航海日誌

你的理性與熱情,是你航行的靈魂的舵與帆 by Kahlil Gibran。把人生當成在海上航行,保持理性與熱情,這是我的航海日誌。

Vim 常用套件與指令

| Comments

視窗

將目前視窗放到最大

1
Ctrl + w + _ 

移動到上/下面視窗

1
Ctrl + w + up/down

套件管理

從 vimrc 自動安裝 Vundle

Git 常用命令

| Comments

將其他分支的某個檔案合併到目前分支

1
$git checkout other_branch target_file

顯示其他分支的檔案

1
$git show other_branch:path

比較兩個 commit 之間的差別

1
$git diff revision_1:file_1 revision_2:file_2

修改 commit 訊息

1
$git commit --amend

獲取遠端分支

1
2
$git fetch
$git checkout branch

刪除本地分支

1
$git branch -d branch_name

刪除遠端分支

1
$git push repository_name --delete branch_name

將檔案從 git 版本控制中移除(會導致其他 repository 將該檔案刪除)

1
$git rm --cached file_name

回復到上一個 commit 的狀態

1
$git reset --hard

回復某個檔案到上一個 commit 的狀態

1
$git checkout HEAD -- file_name

Octopress 常用命令

| Comments

新增文章

1
$bundle exec rake new_post['post_title']

編輯文章

1
$vim source/_posts/post_file

預覽網站

1
$bundle exec rake preview

生成網站

1
$bundle exec rake generate

發佈網站

1
$bundle exec rake deploy

Postgresql 常用命令

| Comments

1
$createdb [database_name]
1
$pg_dump [database_name] -f [backup_filename]
1
$psql -f [backup_filename] [database_name]
1
$dropdb [database_name]

Ubuntu 常用命令

| Comments

解壓縮

解壓縮 tar.gz 檔

1
$tar zxvf file_name.tar.gz

解壓縮 tar 檔

1
$tar xvf file_name.tar

壓縮成 gz 檔

1
$gzip -c input_file > output_file.gz

解壓縮 gz 檔

1
$gzip -d file_name.gz

解壓縮 zip 檔

1
$unzip file_name -d dir_path

搜尋

察看檔案完整路徑

1
$readlink -f [file_name]

搜尋檔名關鍵字

1
$find [path] -name "*keyword*"

搜尋檔案內關鍵字

1
$grep -inR --exclude-dir={dir1,dir2} [keyword] [path]

Bash Keyboard Shortcuts

移動到最前面

1
Ctrl + A

移動到最後面

1
Ctrl + E

清除游標前的所有文字

1
Ctrl + U

清除游標前一個文字

1
Ctrl + W

Tmux

detach

1
[Ctrl + B] + D

attach

1
$tmux attach