Linux 開發常用知識雜談
1.如何使用命令的方式確定進程
命令解釋:
ps -ef 查詢系統進程
| 管道符 輸出作爲輸入
grep -v grep 排除帶grep字符串的進程
wc -l 統計函數
2.如何查詢linux 文件或者目錄大小 - du
3.內存佔用情況-df
4.十六進制顯示文件內容-hexdump
5.在程序中如何調用且有輸出結果
command 爲命令
fp = popen(command,“r”) //打開命令執行結果,輸出流
fgets(buf, sizeof(buf), fp) //從流中獲取輸出結果
linux系統時間獲取文中有過使用例程。
6.關於高通平臺有關知識小結
.inc 控制是否編譯
.bb 編譯控制
啓動腳本 xxxxx代碼啓動腳本名
set -e
case "$1" in
start)
echo -n "Starting xxxxxx: " //打印log
for LINE in $(cat /data/xxxx.conf)
do
echo read xxxx.conf : $LINE //獲取配置文件值
if [ 1 -eq $LINE ]
then
echo "Starting xxxxxx..."
start-stop-daemon -S -b -a /usr/bin/xxxxxx //啓動控制
fi
done
echo "done"
;;
stop)
echo -n "Stopping xxxxxx: "
start-stop-daemon -K -n xxxxxx
echo "done"
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: xxxxxx { start | stop | restart }" >&2
exit 1
;;
7.nm 命令使用
可以從靜態庫中查找我們的函數接口有沒有編譯進去
例:nm *.a |grep function(某個函數)