Over the past week, some users have reported to us that they are experiencing PS shell usage.
Approved: Fortect
Not The Answer You Are Looking For? Check Out Other Questions Called Bash Shell-script Sort Ps, Or Also Refer To Your Own Question.
ps --sort = -pcpu
ps --sort = -pcpu | Head -n -Ao 6
Approved: Fortect
Fortect is the world's most popular and effective PC repair tool. It is trusted by millions of people to keep their systems running fast, smooth, and error-free. With its simple user interface and powerful scanning engine, Fortect quickly finds and fixes a broad range of Windows problems - from system instability and security issues to memory management and performance bottlenecks.
ps user, uid, comm, pid, pcpu, tty --sort = -pcpu | Head -n 6
Note generated by ckujau: --sort
is simply supported by ps
using procps
, other implementations may not offer this option.
answered Aug 20, 2014 at 15:39
2677
Sort by the appropriate range (defaults to going from whitespace to non-whitespace), in my case it’s different:
ps aux | sort -n -k 3
answered Aug 28, 2013 accessed 10:46 pm
28.2k
One of the drawbacks of conventional software is that many column headers are involved in the output. Another problem is that if you start with the -x
switch to ps
it will definitely provide complete command lines for a digital program that can be executed and the nuisance is causing the problem … …
For Example
-
Boring command lines
saml 18174 7.3 3.2 1174896 259756? SL August 27, 132: 38 / opt / google / chrome / chrome –type = renderer –lang = en-US –force-fieldtrials = AsyncDns / AsyncDnsB / ForceCompositingMode / disable / InfiniteCache / No / OmniboxHQPReplaceHUPProhibitTrumpingInlineableResult / Standard / OmniboxSearchSuggestTrialStarted2013Q1 / 7 / OneClick-Trial / Standard / Standard-Standard / Standard-ClickInigner / Standard / Standard-Standard / Standard -5-Procent / group_17 / UMA-Uniformity-Trial-1-Percent / group_20 / UMA-Uniformity-Trial-10-Procent / group_07 / UMA-Uniformity-Trial – 20% / Standard / UMA- Uniformity-Trial -5- Procent / group_04 / UMA-Uniformity-Trial-50-Procent / group_01 / –enable-crash-reporter = 4061BD10D0DC127169CE2132BC3FF8EC,Fedora Release 10 (Laughlin) –extension-process –renderer-print-preview –disable-webgl –disable-pepper-3d –disable-gl-multisampling –disable-accelerated-compositing –disable-accelerated-2d-canvas –channel = 18086 –disable-accelerated-video-decode. 4,1423385819
root 1764 7.7 0.3 163692 28928 tty1 Ss + Aug 21 817: 49 / usr / bin / Xorg : 0 -nr -verbose -auth / var / run / gdm / auth-for-gdm-fADI0V / database -nolisten tcp vt1
The ps command is a flexible tool for identifying running programs based on the system and the resources they have always used. It displays statistics and information about the state of system processes, such as process or thread ID, I / O activity, CPU and memory usage.
Chrome in particular is very annoying when you find
ps
in an output like this! -
By default, the output of your ps command is not sorted. The -style parameter forces ps to sort the result. Ascending or descending order can be specified by prefixing a parameter with + (ascending) and – (descending): rrr ps [OPTIONS] –sort -parameter1, + parameter2, parameter3 ..
Output headers
$ Playstation on | sort -nk 3 | Peak -20...root 1741 0.0 0.0 4140400 tty5 Ss + Aug 21, 0:00 / sbin / mingetty / dev / tty5root 1743 0.0 0.0 4140400 tty6 Ss + Aug21 0:00 / sbin / mingetty / dev / tty6saml 13780 0.0 0.0 115088 4216 points / 13 CC Aug 27, 0:00 beatssaml 20432 0.0 0.0 6308 400 dots / 9 S + Aug 27 0:00 _ inotifywatch -e CREATE / etc.saml 8206 0.0 0.0 115296 1108 points / 6 CC + August 21, 0:03 beatsUSER PID% CPU% MEM VSZ RSS TTY STAT COMMAND START TIMEsaml 29352 0.1 0.5 661848 42960 points / 13 Sl + 17:59 0:18 _ irb...
The mixed title can be recognized by the 7th line of the output.
Alternatives
-
Remove them from headings
Processes in addition to higher CPU utilization are shown above. Alternatively, you can sort your debt adjustments by CPU usage by pressing SHIFT + P.
ps
provides a switch to bypass the display of column headings. It’s pretty easy to use just by adding the--no-heading
switch.$ ps aux --no-heading| Variety -nk 3 | Head -1068 1481 null 0.0 0.0 38 592 2144! ? Ssl Aug 21, 0:28 hald68 1527 0.0 0.0 18016 672? From Aug 21 0:01 / usr / libexec / hald-addon-acpiavahi 1333 0.0 0.0 27872 1172: S August 21, 12:01 avahi-daemon: running [grinchy. local]Avakhi 1334 0.0 0.0 27752 20? ? ? S August 21, 12:00 avahi-daemon: chroot helperdbus 1307 0.0 0.0 22716 1900? SS Aug 21 1:03 dbus-daemon --systemgdm 1879 0.0 0.0 317 220 2740? Wed Aug 21 0:00 / usr / libexec / polkit-gnome-authentication-agent-1ntp 3060 0.0 0.0 32600 2152? Ss 20:05 0:00 ntpd -u ntp: ntp -dom /var/run/ntpd.pid -groot 1 0.0 0. 0 1942 0 1004, SS Aug 21 0:01 / sbin / initroot 1006 0.0 0.0 0 nothing? From August 21, 12:00 [kvm-irqfd-clean]Root 1020 0.0 0.0 0 0? From August 21, 02:02 [kdmflush]
Or similar:
$ ps in --no-heading | Wide range -nk 3 | head -10root 1735 0.0 0.0 4140400 tty2 Ss + Aug 21, 0:00 / sbin / mingetty / dev / tty2root 1737 0.0 0.0 4140500 tty3 Ss + Aug 21 0:00 / sbin / mingetty / dev / tty3root 1739 0.0 0.0 4140700 tty4 Ss + Aug21 / sbin / mingetty 0:00 / dev / tty4root 1741 0.0 0.0 4140400 tty5 Ss + Aug21 0:00 / sbin / mingetty / dev / tty5root 1743 0.0 0.0 4140400 tty6 Ss + Aug21 0:00 / sbin / mingetty / dev / tty6saml 13780 0.0 0.0 115088 4216 points / 13 CC Aug 27, 0:00 beatssaml 20432 0.0 0.0 6308 400 dots / 9 S + Aug27 0:00 _ inotifywatch -e CREATE / etc.Saml 2098 0.0 0.0 115508 3148 points / 9 CC August 22 0:05 beatssaml 27134 0.0 0.0 115496 6768 points / 18 CC August 27, 0:02 racesaml 3248 0.0 0.0 115076 1024 points / 0 Ss + Aug 21, 0:00 bit
-
Control the displayed messages.
This may seem like a tedious undertaking, but if you create the capture script in the same way as the
ps
output script, it doesn’t matter. A really fun command that simulates the output fromps aux
, except that you replace the longer time in theCOMMAND
column with a shorter version that just displays the name of this column of the executable file.$ ps ax --no-headings -o user, pid,% cpu,% mem, vsz, sgi_rss, tname, stat, start_time, time, ucmd
Putting it all together, without matching column headers, which is much easier to work with, should be a scenario.
List of CPU processes with the highest percentage at the lowest%:
$ ps ax --no-headings -o user, pid,% cpu,% mem, vsz, sgi_rss, tname, stat, start_time, time, ucmd | sort -nrk 3 | head -10saml 18086114 6.4 1418852 515236! ! SL August 27 1-10: 53: 31 chromesaml 18536 14.7 4.1 1276240 328636? sl Aug 27 04:29:21 Chromesaml 18558 12.2 3.4 1209712! ? 278228 SL 27 Aug 3:44:22 Chromesaml Speed up your computer's performance now with this simple download.