惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

N
News | PayPal Newsroom
P
Proofpoint News Feed
Cyberwarzone
Cyberwarzone
C
Cisco Blogs
SecWiki News
SecWiki News
Know Your Adversary
Know Your Adversary
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Vercel News
Vercel News
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
罗磊的独立博客
NISL@THU
NISL@THU
WordPress大学
WordPress大学
Hacker News - Newest:
Hacker News - Newest: "LLM"
T
Threat Research - Cisco Blogs
AI
AI
Simon Willison's Weblog
Simon Willison's Weblog
Security Archives - TechRepublic
Security Archives - TechRepublic
有赞技术团队
有赞技术团队
L
LINUX DO - 热门话题
Hacker News: Ask HN
Hacker News: Ask HN
V
V2EX
G
GRAHAM CLULEY
TaoSecurity Blog
TaoSecurity Blog
Hugging Face - Blog
Hugging Face - Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
F
Fortinet All Blogs
博客园 - 叶小钗
博客园 - 三生石上(FineUI控件)
云风的 BLOG
云风的 BLOG
Recorded Future
Recorded Future
Latest news
Latest news
The Hacker News
The Hacker News
aimingoo的专栏
aimingoo的专栏
T
Troy Hunt's Blog
S
Schneier on Security
I
Intezer
Google DeepMind News
Google DeepMind News
A
Arctic Wolf
Apple Machine Learning Research
Apple Machine Learning Research
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
Threatpost
爱范儿
爱范儿
The Register - Security
The Register - Security
S
SegmentFault 最新的问题
Blog — PlanetScale
Blog — PlanetScale
博客园 - 聂微东
宝玉的分享
宝玉的分享
Recent Commits to openclaw:main
Recent Commits to openclaw:main
美团技术团队
B
Blog RSS Feed

WangDeer

非机动车交通规则测验 微软 50 周年壁纸是在 macOS上设计的? 「转」西二旗折叠:蜂巢经济学启示录 难得空明 Ubuntu Clean ApidocJs apigroup Support Chinese int(10)里面的10是什么意思? 5-3 会话 2021-03-25 「PHP架构师」面试准备 Laravel 上传 Docx 文件,表单验证不通过 4-4 发送信号 4-3 信号集 4-2 编写中断信号处理程序 2022-03-10 面试复盘 4-1 什么是中断信号(软中断) 3-6 SUID特权进程 3-5多进程编写 3-4进程调度 3-3进程exec 3-2进程退出和回收 3-1进程标识与fork 2-3解释器文件 2-2命令行参数与环境参数表 2-1程序与进程 1-1课程介绍 终极复盘 第八章 传承篇 第七章 自由篇 第六章 品牌篇 第五章 作品篇 第四章 定位篇 第三章 金钱篇 第二章 富人篇 第一章 财务自由篇 财富思维觉醒课前作业 This Set Cookie Was Blocked Because It Was Not Sent Over a Secure Connection 「转」Windows11右键恢复至Windows10模式 Ecshop 4.0 微信登录 一直循环授权登录 PHP判断指定日期是否为工作日 PHP Ajax 跨域请求允许多个域名 返回键劫持,强制跳转到指定链接 Chromium Adobe Flash Player下载 批量检查并清除BOM头 Ecshop之smarty与js冲突问题 Ecshop 广告位宽度值必须在1 1024之间 修改方法 PHP获取指定时区当前时间-PHP获取世界时钟 phpcms 更新栏目缓存 `PHP Has Encountered a Stack Overflow` 解决办法 php判断是否手机访问-php判断访问终端类型 丢了 如果昨天是明天的话就好了,这样今天就周五了 Ecshop自定义调用指定广告位 Destoon修改商务便签文字 Ecshop首页获取指定分类的推荐商品 QQ空间如何屏蔽好友刷屏广告 Css实现文字竖排 英尺(inch)、厘米(cm) JS转换 网页禁止鼠标右键 Destoon 选择支付方式 可单独关闭对联广告两枚 网页打开不是在最顶部,而是跳到中间位置解决方法 Ecmall iis 伪静态规则 Destoon 复制商城模块 QQ在线客服设置 QQ开启临时会话教程 Ecshop加入购物车js报错 IE浏览器“浏览器模式”和“文本模式” 网站图片在IE浏览器下不显示 Ecshop 去掉头部版权信息 echsop “transport.js/run() error:'process_request' 未定义”-解决方法 Ecshop Deprecated:Assigning the Return Value of New by Reference Is Deprecated in 报错解决方法 PHPCMS全局循环调用二级类目导航 如何使EditPlus打开tpl文件高亮显示代码 Ecshop前台英文后台中文实现方法 Ecshop安装报错warning:date_default_timezone_get() 1970年1月1日(00:00:00 GMT)Unix时间戳(Unix Timestamp) 黑莓bb微信 2.6 for os5 黑莓微信内测版问题总结及开发建议 360安全卫士卸载过程 管理距离AD值(Administrative Distance) 思科在中国的总代及金牌、银牌代理商 黑莓7100T拆机全程实录 CCNA静态路由配置实例 8700G国产壳白色,太粗糙了 黑莓7100T玉照曝光 黑莓手机电池的正确使用和保养 51啦统计不能打开,求分析,求解释 处女作,黑莓8707G4.2主题出炉 我的2011 Xweibo手机版底部版权修改 常用ping地址,逗逗搜索引擎,SEO必备 飞飞影视系统快播播放列表前缀修改 飞飞影视系统title修改 这才整明白啥叫被跨省,上网有风险,发帖需谨慎 为emlog添加Gravatar头像服务功能 三层交换机实现VLAN间通信 路由器的基本配置 路由器接口类型及连接方式 19岁双IE 谈Cisco认证 Secondary IP-Address 用途 儿童节NA战报 CCNA疑难解析之network x.x.x.x
3-7 进程查看
王二 · 2022-03-08 · via WangDeer

一个程序启动之后就是一个进程,进程的数据在内存中,包括正文段和数据段,内存中的一些数据也会写入到proc文件系统中。


$ ll /proc/
total 4
dr-xr-xr-x 447 root     root        0 Mar  8 06:31 ./
drwxr-xr-x   1 root     root     4096 Mar  1 07:45 ../
dr-xr-xr-x   9 root     root        0 Mar  8 11:43 1/
dr-xr-xr-x   9 root     root        0 Mar  8 11:47 12/
dr-xr-xr-x   9 root     root        0 Mar  8 11:47 21/
dr-xr-xr-x   9 root     root        0 Mar  8 11:47 22/
dr-xr-xr-x   9 root     root        0 Mar  8 11:47 23/
dr-xr-xr-x   9 root     root        0 Mar  8 11:47 24/
dr-xr-xr-x   9 root     root        0 Mar  8 11:47 3252/
dr-xr-xr-x   9 laradock laradock    0 Mar  8 11:47 499/
dr-xr-xr-x   9 root     root        0 Mar  8 11:47 983/

top

top - display Linux processes.

The top program provides a dynamic real-time view of a running system.

It can display system summary information as well as a list of processes or threads currently being managed by the Linuxkernel.

The types of system summary information shown and the types, order and size of information displayed for processes are all user configurable and that configuration can be made persistent across restarts.

The program provides a limited interactive interface for process manipulation as well as a much more extensive interface for personal configuration – encompassing every aspect of its operation.

And while top is referred to throughout thisdocument, you are free to name the program anything you wish.

That new name, possibly an alias, will then be reflected on top’s display and used when reading and writing a configuration file.

top - 23:28:59 up 13:13,  1 user,  load average: 0.30, 1.20, 1.61
任务: 386 total,   1 running, 385 sleeping,   0 stopped,   0 zombie
%Cpu(s):  2.8 us,  1.7 sy,  0.1 ni, 95.3 id,  0.0 wa,  0.0 hi,  0.2 si,  0.0 st
MiB Mem :   5855.6 total,    664.6 free,   3875.4 used,   1315.7 buff/cache
MiB Swap:    976.0 total,    364.7 free,    611.3 used.   1379.6 avail Mem 

进程号 USER      PR  NI    VIRT    RES    SHR    %CPU  %MEM     TIME+ COMMAND                                                                        
7305  wanger    20   0  4956504   454380 52432 S  4.6   7.6  28:24.62 gnome-shell

...

pstree 查看 Linux 进程间的关系,显示进程树。

pstree shows running processes as a tree.

The tree is rooted at either pid or init if pid is omitted.

If a user name is specified, all process trees rooted at processes owned by that user are shown.

pstree -ap

    ├─sshd,9408
    │   └─sshd,444836    
    │       └─bash,444875
    │           └─pstree,444893 -ap

ps

ps displays information about a selection of the active processes.

If you want a repetitive update of the selection and the displayed information, use top instead.


$ ps ejx
   PPID     PID    PGID     SID TTY        TPGID STAT   UID   TIME COMMAND
      0       1       1       1 pts/0          1 Ss+      0   0:00 /usr/bin/python3 -u /sbin/my_init PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/us
      1      12      12       1 pts/0          1 S        0   0:01 /usr/sbin/syslog-ng --pidfile /var/run/syslog-ng.pid -F --no-caps LC_ALL=en_US.UTF-
      1      21       1       1 pts/0          1 S+       0   0:00 /usr/bin/runsvdir -P /etc/service AST_VERSION=1.0.10 BLACKFIRE_CLIENT_ID="<client_i
     21      22      22      22 ?             -1 Ss       0   0:00 runsv cron AST_VERSION=1.0.10 BLACKFIRE_CLIENT_ID="<client_id>" BLACKFIRE_CLIENT_TO
     21      23      23      23 ?             -1 Ss       0   0:00 runsv sshd AST_VERSION=1.0.10 BLACKFIRE_CLIENT_ID="<client_id>" BLACKFIRE_CLIENT_TO
     22      24      22      22 ?             -1 S        0   0:00 /usr/sbin/cron -f NPM_FETCH_RETRY_MINTIMEOUT=10000 LANGUAGE=en_US.UTF-8 NPM_FETCH_R
      0     983     983     983 pts/1       3354 Ss       0   0:00 bash PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/larado
    983    3354    3354     983 pts/1       3354 R+       0   0:00 ps ejx LC_ALL=en_US.UTF-8 NVM_DIR=/home/laradock/.nvm LS_COLORS=no=00:fi=00:di=01;3

Linux 系统中一般会把进程/线程称为任务Task。 TTY 是一个物理终端|伪终端pts/0 ssh / telnet

proc文件系统

process information pseudo-filesystem.(进程信息伪文件系统)

The proc filesystem is a pseudo-filesystem which provides an interface to kernel data structures. It is commonly mounted at /proc.

Typically, it is mounted automatically by the system, but it can also be mounted manually using a command such as:

Most of the files in the proc filesystem are read-only, but some files are writable, allowing kernel variables to be changed.


/proc/983# ll
total 0
dr-xr-xr-x   9 root root 0 Mar  8 11:56 ./
dr-xr-xr-x 460 root root 0 Mar  8 06:31 ../
-r--r--r--   1 root root 0 Mar  8 11:56 arch_status
dr-xr-xr-x   2 root root 0 Mar  8 11:56 attr/
-rw-r--r--   1 root root 0 Mar  8 11:56 autogroup
-r--------   1 root root 0 Mar  8 11:56 auxv
-r--r--r--   1 root root 0 Mar  8 11:56 cgroup
--w-------   1 root root 0 Mar  8 11:56 clear_refs
-r--r--r--   1 root root 0 Mar  8 11:56 cmdline
-rw-r--r--   1 root root 0 Mar  8 11:56 comm
-rw-r--r--   1 root root 0 Mar  8 11:56 coredump_filter
-r--r--r--   1 root root 0 Mar  8 11:56 cpu_resctrl_groups
-r--r--r--   1 root root 0 Mar  8 11:56 cpuset
lrwxrwxrwx   1 root root 0 Mar  8 11:56 cwd -> /proc/983/
-r--------   1 root root 0 Mar  8 11:56 environ
lrwxrwxrwx   1 root root 0 Mar  8 11:56 exe -> /bin/bash*
dr-x------   2 root root 0 Mar  8 11:56 fd/
dr-x------   2 root root 0 Mar  8 11:56 fdinfo/
-rw-r--r--   1 root root 0 Mar  8 11:56 gid_map
-r--------   1 root root 0 Mar  8 11:56 io
-r--r--r--   1 root root 0 Mar  8 11:56 limits
-rw-r--r--   1 root root 0 Mar  8 11:56 loginuid
dr-x------   2 root root 0 Mar  8 11:56 map_files/
-r--r--r--   1 root root 0 Mar  8 11:56 maps
-rw-------   1 root root 0 Mar  8 11:56 mem
-r--r--r--   1 root root 0 Mar  8 11:56 mountinfo
-r--r--r--   1 root root 0 Mar  8 11:56 mounts
-r--------   1 root root 0 Mar  8 11:56 mountstats
dr-xr-xr-x  53 root root 0 Mar  8 11:56 net/
dr-x--x--x   2 root root 0 Mar  8 11:56 ns/
-r--r--r--   1 root root 0 Mar  8 11:56 numa_maps
-rw-r--r--   1 root root 0 Mar  8 11:56 oom_adj
-r--r--r--   1 root root 0 Mar  8 11:56 oom_score
-rw-r--r--   1 root root 0 Mar  8 11:56 oom_score_adj
-r--------   1 root root 0 Mar  8 11:56 pagemap
-r--------   1 root root 0 Mar  8 11:56 patch_state
-r--------   1 root root 0 Mar  8 11:56 personality
-rw-r--r--   1 root root 0 Mar  8 11:56 projid_map
lrwxrwxrwx   1 root root 0 Mar  8 11:56 root -> //
-rw-r--r--   1 root root 0 Mar  8 11:56 sched
-r--r--r--   1 root root 0 Mar  8 11:56 schedstat
-r--r--r--   1 root root 0 Mar  8 11:56 sessionid
-rw-r--r--   1 root root 0 Mar  8 11:56 setgroups
-r--r--r--   1 root root 0 Mar  8 11:56 smaps
-r--r--r--   1 root root 0 Mar  8 11:56 smaps_rollup
-r--------   1 root root 0 Mar  8 11:56 stack
-r--r--r--   1 root root 0 Mar  8 11:56 stat
-r--r--r--   1 root root 0 Mar  8 11:56 statm
-r--r--r--   1 root root 0 Mar  8 11:56 status
-r--------   1 root root 0 Mar  8 11:56 syscall
dr-xr-xr-x   3 root root 0 Mar  8 11:56 task/
-rw-r--r--   1 root root 0 Mar  8 11:56 timens_offsets
-r--r--r--   1 root root 0 Mar  8 11:56 timers
-rw-rw-rw-   1 root root 0 Mar  8 11:56 timerslack_ns
-rw-r--r--   1 root root 0 Mar  8 11:56 uid_map
-r--r--r--   1 root root 0 Mar  8 11:56 wchan