可以使用: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