Birmingham mumbai



Download 15,21 Mb.
Pdf ko'rish
bet226/482
Sana13.01.2022
Hajmi15,21 Mb.
#355107
1   ...   222   223   224   225   226   227   228   229   ...   482
Bog'liq
Mastering Ubuntu Server Gain expertise in the art of deploying, configuring, managing, and troubleshooting Ubuntu Server by Jay LaCroix (z-lib.org)

[
 170 
]
When you run it, you should notice the difference from the 
ps a
 command right 
away. With this variation, you'll see processes listed that are being run by your user 
ID, as well as other users. When I run it, I see processes listed in the output for my 
user (
jay
), as well as one for 
root
. The 
u
 option will be a common option you're 
likely to use, since most of the time while managing servers, you're probably more 
interested in keeping an eye on what kinds of shenanigans your users are getting 
themselves into. But perhaps the most common use of the 
ps
 command is the 
following variation:
ps aux 
With the 
x
 option added, we're no longer limiting our output to processes within 
a TTY (either native or pseudo). The result is that we'll see a lot more processes, 
including system-level processes that are not tied to a process we started ourselves. 
Go ahead and try it. In practice, though, the 
ps aux
 command is most commonly 
used with 
grep
 to look for a particular process or string. For example, let's say 
you want to see a list of all 
nginx
 worker processes. To do that, you may execute a 
command such as the following:
ps aux | grep nginx 
Here, we're executing the 
ps aux
 command as before, but we're piping the output 
into 
grep
, where we're looking only for lines of output that include the string 
nginx

In practice, this is the way I often use 
ps
, as well as the way I've noticed many other 
administrators using it. With 
ps aux
, we are able to see a lot more output, and then 
we can narrow that down with search criteria by piping into 
grep
. However, if all we 
wanted to do was to show processes that have a particular string, we could also do 
the following:
ps u -C nginx 
This would produce output containing a list of processes matching 
nginx
, and 
related details. Another useful variation of the 
ps
 command is to sort the output by 
sorting the processes using the most CPU first:
ps aux --sort=-pcpu 
Unfortunately, that command shows a lot of output, and we would have to scroll 
back to the top in order to see the top processes. Depending on your terminal, you 
may not have the ability to scroll back very far (or at all), so the following command 
will narrow it down further:
ps aux --sort=-pcpu | head -n 5 


Chapter 7

Download 15,21 Mb.

Do'stlaringiz bilan baham:
1   ...   222   223   224   225   226   227   228   229   ...   482




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish