Birmingham mumbai



Download 15,21 Mb.
Pdf ko'rish
bet183/482
Sana13.01.2022
Hajmi15,21 Mb.
#355107
1   ...   179   180   181   182   183   184   185   186   ...   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)

[
 134 
]
This concept can be a bit confusing at first, but if you keep practicing it, it will 
definitely make sense. Let's look at another example, so we can understand standard 
error (
stderr
) as well:
find / -name "syslog"
The 
find
 command allows you to find files that match particular criteria, such as 
looking for files that are named 
syslog
 in this example. Here, we're searching the 
entire filesystem, because we used 
/
 to start the search from. The problem is, I don't 
have permission to read all the files on the filesystem, and I didn't use 
sudo
. This is 
going to result in quite a few errors being printed to the screen, errors such as these:
find: '/var/lib/netdata/health': Permission denied
find: '/var/lib/netdata/registry': Permission denied
find: '/var/lib/netdata/cloud.d': Permission denied
find: '/var/lib/udisks2': Permission denied
Since the 
find
 command was used to search the entire filesystem, including places I 
don't have permission to look, our terminal will be flooded with errors. These errors 
are displayed using standard error, which has a file descriptor of 2. If we want to 
hide these errors, we can do this:
find / -name "syslog" 2> /dev/null
With that command, no errors will show up when we run it. That's because we 
instructed the interpreter to capture standard error and redirect it to 
/dev/null

/
dev/null
 is a special device where things disappear forever. If you move or redirect 
something there, it's effectively deleted. Since a standard error has a file descriptor 
of 2, we combined that with the 
greater-than
 symbol to form 
2>
, which basically 
instructs the shell to do a redirect, but to only redirect standard error and leave 
standard output alone. We can also choose to redirect more than one stream to 
different places within a single command:
find / -name "syslog" 1> stdout.txt 2> stderr.txt
With that variation, I'm redirecting successful output to 
stdout.txt
, and the errors 
to 
stderr.txt
. This allows us full control over where successful and unsuccessful 
messages are printed. This also helps us quite a bit when it comes to troubleshooting, 
because we may want to focus on only the errors, and getting rid of the success 
output may trim the number of lines we'll have to look through.
I recommend that you go ahead and practice this concept as much as you can; it's 
definitely something you'll want to commit to memory. You don't have to master this 
concept right now, but knowing the basics will provide a great foundation.


Chapter 5

Download 15,21 Mb.

Do'stlaringiz bilan baham:
1   ...   179   180   181   182   183   184   185   186   ...   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