Linux 現在系統都使用 UUID 來做辨認, 要如何查詢目前硬碟磁區使用的 UUID 是哪個呢?
標籤: linux
Linux 的 /dev/random 產生原理
random 的亂數產生要如何實作? 看到此篇: "數學及演算法與安全工程相遇 - 第一講" 的討論才知道有這種作法, 作點筆記.
原來噪音是可以拿來做亂數產生用~
使用 formail 來切分 Linux Mailbox 郵件
Linux Mail 放在 /var/mail/username, username 多大, 信佔用的容量就多大, 檔案裡面有多封郵件的話, 要如何做分割?
使用 xjobs 同時平行多工的執行程式
於 Linux 想要多工、同時非同步執行, 一般都會寫 Thread、Fork 或者利用 & 等等來做, 有沒有偷懶的方法, 可以直接把參數丟給程式後, 自動平行產生多個 Process 來處理呢?
- Linux 可以安裝 xjobs 來使用看看: apt-get install xjobs
- xjobs is most useful on multi-processor/core machines when one needs to execute several time consuming command several that could possibly be run in parallel.
- xjobs - construct command line and execute jobs in parallel
註: Linux 還有 parallel 可以達成類似的事情.
查看 Linux TCP Port 被哪隻程式(Process)佔用
Linux 查到 TCP Port 有開啟, 但是不知道是什麼程式佔用的, 要怎麼查出是被哪隻程式使用呢?
註: netstat -tln # 可以看到有哪些 IP:Port 開啟
Linux 設定 Samba 445 Port 使用的網路卡
檢查 netstat -tln 發現不太熟悉的 Port - 445, 查查看才知道這是 Samba 用的(一直以為只會用到 139 Port), 重點是這個 Port 居然是對外開放. XD
來看看如何把這個設定綁進內部網路.
Tmux 出現 protocol version mismatch 解法
Debian / Ubuntu Linux 做 Package Upgrade 後, Tmux 很常遇到下述問題:
- $ tmux attach # 出現下述錯誤訊息
protocol version mismatch (client 7, server 6)
- 於是就無法進入 tmux 了~
解法很簡單: 只要把 tmux server 的 process pid 全部 kill 掉, 重新開始就可以正常使用.
但是如果是 tmux 明明還在某些無法停止的事情, 但是需要進去又進不去的狀況, 要如何先暫時解決?
Linux Gnome3 內建影片錄影功能要如何使用
Ubuntu Linux 13.10 的 Unity 實在是一場悲劇, 但是又懶得重灌的狀況下, 改裝 Gnome3 來用.
Ubuntu Linux 桌面送通知訊息
Ubuntu Linux 桌面環境(使用 Unity、Gnome3), 程式要送通知訊息, 可以用下述方式傳送: (apt-get install notify-osd)
- $ notify-send "hello world"
- $ notify-send Title "hello world"
- $ notify-send Date "`date`"
- $ notify-send "Message Title" "The message body is shown here" -i /usr/share/pixmaps/sm.xpm -t 5000
- $ notify-send Title "`tail /var/log/syslog`"
- $ tail -n0 -f /var/log/syslog | while read line; do notify-send "System Message" "$line"; done
- $ notify-send -i face-wink "Hello! January" # notify-send -i <icon> <Message>
- $ notify-send -t 0 "Bringing down the system" # 會彈出需要確認、取消的視窗
- $ DISPLAY=:0.0 /usr/bin/notify-send "TITLE" "MESSAGE" # 加入 crontab 需要另外顯示
- $ notify-send -u critical -i "notification-message-IM" 'Boss !!' 'Am done with the execution' # 緊急
- $ command && notify-send # 程式完成時,呼叫 notify-send 傳送
- $ notify-send --help # 可以查看更多參數
註: 通知訊息於 Unity 會從上角出現, Gnome3 會從正下方出現 通知訊息.
除了提醒外,想要有出現視窗確認的,可以使用 zenity,如下述:
- $ zenity --info --text "STRING"
- 可於 .bashrc 加入此 function,就可以 ls | notify "done" 完成通知
- function notify() {
- zenity --info --text "$1"
- }
將 GitLab 架設 於 Ubuntu 12.04 (Precise)
關於 GitLab 的文章、說明, 之前的文章已經有寫過, 在此就不再詳述, 詳細可見此篇: 將 GitLab 架設 於 Debian Wheezy
註: 關於 GitLab 安裝詳細說明、Debug 等訊息, 也都於上述文章記錄, 在此就不再多加撰寫.