導航:首頁 > 編程系統 > linux查看堆棧

linux查看堆棧

發布時間:2023-03-09 20:16:36

『壹』 linux如何查找到某一個進程在調用哪些文件

可以使用:ps -fe|grep filename,
也可以使用:fuser filename查看
然後可以看這個進程跟哪裡東西有關聯專,使用了哪些埠屬
只查看該進程:ps -ef | grep ID
查看該進程打開的文件:lsof -p ID
查看內存分配:lcat /proc/ID/maps
查看堆棧:pstack 11ID
查看發出的系統調用:strace -p ID
查看調用庫函數:ltrace -p ID

『貳』 如何查看linux進程佔用的內容

1.只查看該進程:ps
-ef
|
grep
11345
2.查看該進程打開的文件:專lsof
-p
11345
3.查看內存分配:lcat
/proc/11345/maps
4.查看堆棧:pstack
11345
5.查看發出的系統屬調用:strace
-p
11345
6.查看調用庫函數:ltrace
-p
11345

『叄』 linux 怎麼查看segmentation fault堆棧

gdb ExeName
(gdb)core core.xx
(gdb)bt

core mp 一般是在segmentation fault(段來錯誤)的情源況下產生的文件,需要通過ulimit來設置才會得到的。關於Linux命令的介紹,看看《linux就該這么學》,具體關於這一章地址3w(dot)linuxprobe/chapter-02(dot)html.

『肆』 linux ps命令顯示一個特定的進程信息,如下說明

ps

ps(即進程狀態)命令用於提供有關當前正在運行的進程的信息,包括其進程標識號(PID)。

進程,也稱為任務,是程序的執行(即,運行)實例。系統為每個進程分配一個唯一的PID。

ps的基本語法是

ps [options]

當沒有任何選項使用ps時,它會發送到標准輸出,默認情況下是顯示監視器,系統上當前至少有兩個進程的四項信息:shell和ps。shell是一個程序,它在類Unix操作系統中提供傳統的純文本用戶界面,用於發出命令並與系統交互,默認情況下在Linux上是bash。ps本身是一個進程,一旦顯示輸出它就會死掉(即終止)。

使用ps獲取有關系統當前進程的更完整信息的常用方便方法是使用以下方法:

ps -aux | less

ps顯示的進程可以限制為屬於任何給定用戶的進程,方法是通過grep(一種用於搜索文本的過濾器)輸出輸出。例如,屬於具有用戶名adam的用戶的進程可以使用以下內容顯示:

ps -ef | grep adam

Linux 下 取進程佔用 cpu 最高的前10個進程

ps aux|head -1;ps aux|grep -v PID|sort -rn -k +3|head

linux 下 取進程佔用內存(MEM)最高的前10個進程

ps aux|head -1;ps aux|grep -v PID|sort -rn -k +4|head

其中rsz是是實際內存

$ ps -e -o 'pid,comm,args,pcpu,rsz,vsz,stime,user,uid'
$ ps -e -o 'pid,comm,args,pcpu,rsz,vsz,stime,user,uid' | grep oracle | sort -nrk5

其中rsz為實際內存,上例實現按內存排序,由大到小

5個命令檢查Linux中內存使用情況,含PS

『伍』 Linux 怎麼查看一個進程的堆棧

方法一:pstack pid
NAME
pstack - print a stack trace of a running process
SYNOPSIS
pstack pid
DESCRIPTION
pstack attaches to the active process named by the pid on the command line, and prints out an execution stack trace. If ELF symbols exist in the binary (usually the case
unless you have run strip(1)), then symbolic addresses are printed as well.
If the process is part of a thread group, then pstack will print out a stack trace for each of the threads in the group.
SEE ALSO
nm(1), ptrace(2), gdb(1)
方法二:gstack pid
NAME
gstack - print a stack trace of a running process
SYNOPSIS
gstack pid
DESCRIPTION
gstack attaches to the active process named by the pid on the command line, and prints out an execution stack trace. If ELF symbols exist in the binary (usually the case
unless you have run strip(1)), then symbolic addresses are printed as well.
If the process is part of a thread group, then gstack will print out a stack trace for each of the threads in the group.
SEE ALSO
nm(1), ptrace(2), gdb(1)
方法三:
使用gdb 然後 進程ID,然後再使用命令 thread apply all bt。
方法一和方法二一樣,方法三可以查看更多的信息。

『陸』 linux 查看文件被哪個進程打開

可以使用:ps -fe|grep filename,
也可以使用:fuser filename查看
然後可以看這個進程跟哪裡東西有關聯,使用了哪些埠
只查看該進程:ps -ef | grep ID
查看該進程打開的文件:lsof -p ID
查看內存分配:lcat /proc/ID/maps
查看堆棧:pstack 11ID
查看發出的系統調用:strace -p ID
查看調用庫函數:ltrace -p ID

『柒』 linux查看文件被哪個進程佔用

可以使用ps -fe|grep filename,也可以使用fuser filename查看
1.只查看該進程:ps -ef | grep 11345
2.查看該進程打開版的文件:lsof -p 11345
3.查看內存權分配:lcat /proc/11345/maps
4.查看堆棧:pstack 11345
5.查看發出的系統調用:strace -p 11345
6.查看調用庫函數:ltrace -p 11345

閱讀全文

與linux查看堆棧相關的資料

熱點內容
專題學習網站源碼 瀏覽:163
jsphead什麼 瀏覽:88
gps串口數據怎麼發送 瀏覽:968
win10文件主頁共享查看 瀏覽:411
中國聯通有哪些app是免流的 瀏覽:176
邊做邊保存的文件找不到了 瀏覽:858
win10照片應用文件夾名稱 瀏覽:966
編程如何解決資金的原子性 瀏覽:638
如何製作廣角鏡頭矯正文件 瀏覽:513
在網頁開發中應該選用哪個資料庫 瀏覽:742
iphone5移動卡貼 瀏覽:990
電腦文件的格式 瀏覽:127
extjs的xtype 瀏覽:959
suse11iso文件要u盤安裝 瀏覽:153
如何將報表統計數據轉化為圖形 瀏覽:444
如何寄快遞材料文件 瀏覽:265
java構造方法private 瀏覽:475
手機文件找回恢復 瀏覽:516
word怎麼把u盤里的文件拔掉 瀏覽:976
港版蘋果用的插排 瀏覽:1000

友情鏈接