iTerm2 使用筆記


iTerm2 是我在 OS X 上最常用的 Terminal,整理一些使用技巧。


基本操作

  • 開新 Tab: Mac + t
  • 移動 Tab Window:
    • 方法一:Mac + Shift + [ or Mac + Shift + ]
    • 方法二:Mac + 左右
  • 調整字型: Mac + + or Mac + -
  • 全螢幕: Mac + Enter

分割視窗 (Split Window)

這很好用,特別是找問題時,需要同時看多個連線時,根據解析度與螢幕大小,可以同時開很多

  • 垂直分割: Mac + d
  • 水平分割: Mac + Shift + d
  • 移動 Window Focus: Mac + [ or Mac + ]
  • 關閉一個 Windwo: Mac + w

同步 Profiles

iTerm2 支援 Profile,就是可以把 Connection 存起來,分類。我的連線機器滿多的,工作環境除了公司,還有家裡,所以同步 Connection 設定就滿重要的。

我是利用 Cloud Storage,像是 Dropbox, Google Drive 同步 Profile 設定,然後就可以讓每台機器都有一樣的設定。

快速移動

想在 Terminal 快速用單字移動 cursor:

  1. Go to Preferences… > Profiles > Keys
  2. Press Load Preset…
  3. Select Natural Text Editing

設定好之後,用以下移動:

  • move a word backwrods: Option + <-
  • move a word forwards: Option + ->
  • To Start: Apple + <-
  • To End: Apple + ->

參考: https://apple.stackexchange.com/questions/154292/iterm-going-one-word-backwards-and-forwards

開啟新 Session 很慢

這問題困擾我很久了,找了一些資訊,有三種解法:

第一種解法: 刪除 ASL (Apple System Log)

/var/log/asl 底下的東西都刪掉: rm -rf /var/log/asl/*.asl

歸咎原因:

/usr/bin/login 會去 asl 裡面找上次的登入時間,這可能會找很久。唯一解法是讓 login 不要去找這時間,所以要把參數 -q 傳給 login。但是在 iTerm2 啟動 Terminal 時,沒有方法可以傳遞參數。

第二種解法:

修改 Terminal Command: /bin/bash -il

第三種解法:

1
touch ~/.hushlogin

相關討論:



Comments

  • 全站索引
  • 關於這裏
  • 關於作者
  • 學習法則
  • 思考本質
  • 一些領悟
  • 分類哲學
  • ▲ TOP ▲