2011-02-18

[Linux] ln 製作 Linux 上的捷徑

ln - make links between files
要在 Linux 底下建立捷徑,只要用 ln 這個指令就 OK 啦


$ ln [參數] 來源檔案或資料夾 要建立的 link 名稱

沒有參數的時候是建立 hard link,沒辦法跨 file system,沒辦法 link directory
-s : symbolic link
-f : 要建立的 link 如果存在,會先移除掉再建立


比較常用的似乎是 symbolic link

在修改 link 裡的資料時,實際上就是去修改 link 所指向的原資料


鳥哥的 Linux 私房菜 - 實體連結與符號連結: ln
凍仁的 Ubuntu 筆記 - 【Ubuntu】ln - Linux 上的捷徑

2011-02-14

[Linux] 釋放虛擬記憶體

Linux Kernel 2.6.16 之後新加入了 drop caches 的機制,可以讓系統空出大量的記憶體

Freeing the page cache:
$ echo 1 > /proc/sys/vm/drop_caches
$ sysctl -w vm.drop_caches=1


Free dentries and inodes:
$ echo 2 > /proc/sys/vm/drop_caches

Free the page cache, dentries and the inodes:
$ echo 3 > /proc/sys/vm/drop_caches

這使 kernel 更勤於回收 cache
$ sysctl -w vm.vfs_cache_pressure=n (n > 100)

Tsung's Blog - Linux 手動回收 已經被 Cache 的記憶體