Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the method for Linux ps to specify column names

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "what is the method of specifying column names by Linux ps". Friends who are interested may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "what is the method for Linux ps to specify a list?"

Count the number of local lines of code

Find. -type f-name "* .java"-print0 | xargs-0 wc-l

Simple encryption and decryption

➜~ echo 123456 | tr'0-9''9876543210'

876543

➜~ echo 123456 | tr '9876543210'' 0-9'

876543

➜~ echo 876543 | tr '9876543210'' 0-9'

123456

Md5 file integrity check

[root@ngtoken ~] # md5sum nohup.out > test.md5

[root@ngtoken ~] # md5sum-c test.md5

Nohup.out: OK

[root@ngtoken ~] # cat test.md5

F413d9f22030d966eb2be7cd6961de0e nohup.out

[root@ngtoken ~] #

Ps-o custom output column, available parameters

E.g

[root@ngtoken ~] # ps-eo pcpu,pid,pmem,nice,time,etime,stat,cmd,comm,ppid | head

CPU PID MEM NI TIME ELAPSED STAT CMD COMMAND PPID

0.0 1 0.2 00:00:45 93-04:12:48 Ss / usr/lib/systemd/systemd-- systemd 0

0.02 0.000 00:00:00 93-04:12:48 S [kthreadd] kthreadd 0

0.03 0.000 00:00:13 93-04:12:48 S [ksoftirqd/0] ksoftirqd/0 2

0.050.0-20 00:00:00 93-04:12:48 S < [kworker/0:0H] kworker/0:0H 2

0.07 0.0-00:00:00 93-04:12:48 S [migration/0] migration/0 2

0.08 0.0000 00:00:00 93-04:12:48 S [rcu_bh] rcu_bh 2

0.09 0.000 00:04:23 93-04:12:48 R [rcu_sched] rcu_sched 2

0.0100.0-00:00:33 93-04:12:48 S [watchdog/0] watchdog/0 2

0.0 12 0.0 00:00:00 93-04:12:48 S [kdevtmpfs] kdevtmpfs 2

[root@ngtoken ~] #

Sort according to the specified column

[root@ngtoken] # ps-eo comm,pcpu-- sort-pcpu

COMMAND CPU

AliYunDun 0.1

Docker-containe 0.1

Remove the header title of the process list

[root@ngtoken] # ps-C java-o pid

PID

8029

[root@ngtoken] # ps-C java-o pid=

8029

[root@ngtoken ~] #

Specify delimiter, output process ID, is one line

[root@ngtoken ~] # pgrep bash-d ":"

26068:26097:26122:26145

[root@ngtoken ~] #

At this point, I believe you have a deeper understanding of "what is the method of specifying column names by Linux ps". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report