Get the App
SLTechnology News&Howtos  ›  Servers  › 

What is the method for Linux ps to specify column names

Shulou Source: shulou.com Published: 2022-05-31 16:19:55 09月17日 Update

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!

Tags: Methods content processes learning output practical deeper one line code interests parameters header integrity delimiters practicality practicality simplicity of operation files more friends Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker macOS Xiaomi Redmi MariaDB