Linux

[Mac] Useful commands

  • Open finder in current working directory
open .

[Linux] Vim pasting causes extra spaces

When you pasting text from other sources into Vim using mouse right-click, the format may be messed up due to auto-indenting. Use the following command to enable pasting mode:

:set paste

After the pasting is done, revert to normal mode:

:set nopaste

[Linux] NTFS、 FAT32、exFAT檔案系統比較

檔案系統FAT32NTFSextFAT
作業系統Win, Linux, MacWin
Linux, Mac: Read-only
Win, Linux, Mac
單檔大小 4GB 16TB 64ZB
速度SlowestFastestMiddle
穩定性GoodBestWorst

[Unix] Unix, Linux, macOS之關係

Unix-like作業系統關係圖

  • Unix-like作業系統,包含了Unix的衍生系統以及與Unix類似的系統
    • Unix的直系衍生系統:FreeBSD, macOS…
    • Unix類似的系統(獨立開發):Linux, Minix…
  • 因此Linux及macOS都是Unix-like作業系統,但Linux是獨立於Unix開發,而macOS是基於BSD開發的系統

*資料來源

[Linux] Screen enable mouse scrolling

To enable mouse scrolling for screen sessions, just put this line into your ~/.screenrc file:

termcapinfo xterm* ti@:te@

To test if it works, you must re-attach your sessions.

[Linux] Useful SSH tunnel commands

  • 開啟本機的8888 port,通過此port的請求會全部交給remote-host處理(藉由兩者的ssh連線),此時再把本機的proxy設定成SOCKS localhost:8888,可以達到完全的proxy效果。
ssh -D 8888 -N user@remote-host
  • 開啟本機的8888 port,通過此port的請求會全部通過remote-host到達target-host:80
ssh -N -L 8888:target-host:80 user@remote-host

[Linux] Screen 常用指令

Start a new session

screen
or
screen -S session_name

List session

screen -ls

Resume session

screen -r session_name

Detach session

screen -d session_name

Shortcuts

Ctrl+a c Create a new window (with shell)
Ctrl+a " List all window
Ctrl+a 0 Switch to window 0 (by number )
Ctrl+a A Rename the current window
Ctrl+a S Split current region horizontally into two regions
Ctrl+a | Split current region vertically into two regions
Ctrl+a tab Switch the input focus to the next region
Ctrl+a Ctrl+a Toggle between the current and previous region
Ctrl+a Q Close all regions but the current one
Ctrl+a X Close the current region
Ctrl+a k Kill the current window
Ctrl+a M Show window monitor