Ten Linux Develop Command
From Richliu's wiki
原文在Linux Journal Manazine九月號
- ctags
vi 下:ta foo. 或是在Function 按 Ctrl+右鍵 製做 ctags 的index 只要用指令 ctags -x *.c*
- strace
讓開發者不需要 Debugger 就可以追蹤程式的問題. 例: strace -o strace.out rm -f /etc/yp.conf 甚至是執行中程式 例: strace -c -p mypid . [怎麼覺得像是 performance tuning]
- fuser
可以砍掉所有正在開啟某個檔案的 Process 例如: 一堆程式在讀 /etc/make.file 就可以用 fuser -f /etc/make.file 程式會幫你砍掉這些使用者
- ps
很少人用 ps debug, 但是 ps 是很強大的 Debug 工具 ps -e -o pid,state,cmd 可以看出那些程式有問題
- time
用 time 可以看出你的程式的 Performance
- nm
可以取得 object file 和 executeable file 的 symbol name information
- strings
可以將 binary file 內的字串取出來 strings -f /usr/lib/lib* | grep cryptic message"
- od,xxd
od 將檔案用 16 進位輸出 xxd 是輸出十六進位外, 也輸出文字 xxd 也可以將 16 進位轉成 C code xxd -i foo.bin
- file
file 可以偵測檔案的類型
- objdump
可以 Dump assembly code 和 source code 1. 要先 gcc -g 2. objdump --demangle --source myobject.o
原來的文章在 Ten Handy Commands Every Linux Developer should know
--Richliu 14:00 2004年十二月24日 (CST)
