Birmingham mumbai



Download 15,21 Mb.
Pdf ko'rish
bet159/482
Sana13.01.2022
Hajmi15,21 Mb.
#355107
1   ...   155   156   157   158   159   160   161   162   ...   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)

[
 113 
]
The 
less
 command allows you to do the same thing, but also allows you to not only 
use your arrow keys in addition to 
Enter
 to view more output; it also allows you to 
advance forward or backward as well. So essentially, the 
less
 command gives you 
more features than the 
more
 command does.
In addition, we also have the 
grep
 command at our disposal. It's not typically used 
to simply view the contents of a file, but it's definitely a great command to know that 
can help you view specifically what you want to view, rather than the entire file.
If you chose to install the OpenSSH server when you first installed Ubuntu Server, 
you should have the config file for it in your installation, and you can view the 
contents of that file with 
cat
 as we normally would:
cat /etc/ssh/sshd_config
Of course, that's going to dump the contents of that file onto our screen, and the file 
is many more lines than what the typical monitor is able to display all at once. We 
might be interested in a particular line or word, so we'll need to be able to narrow 
down the file to what we actually care about. We'll talk about the OpenSSH server 
in more detail in 
Chapter 10

Connecting to Networks
, so don't worry about what this 
configuration file means yet. Let's just say, hypothetically, we're only interested in 
the port that OpenSSH is listening on. We can use the 
grep
 command to try and 
print only the lines of the 
/etc/ssh/sshd_config
 file that pertain to that specific 
configuration:
grep Port /etc/ssh/sshd_config
This command will produce the following output:
Figure 4.7: Viewing the contents of the /etc/ssh/sshd_config file with grep to find lines containing "Port"
Essentially, what we're doing is instructing 
grep
 to print only the lines of the 
/etc/
ssh/sshd_config
 file that contain the string 
Port
. In the screenshot, two lines contain 
a match for that string, so they're displayed. The first line is the one that's relevant 
to this example, so we didn't need to see the second line. But that output is certainly 
better than scrolling through the 124 lines of text in the file, when we're only 
interested in lines pertaining to the port.


Navigating and Essential Commands

Download 15,21 Mb.

Do'stlaringiz bilan baham:
1   ...   155   156   157   158   159   160   161   162   ...   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