Birmingham mumbai



Download 15,21 Mb.
Pdf ko'rish
bet197/482
Sana13.01.2022
Hajmi15,21 Mb.
#355107
1   ...   193   194   195   196   197   198   199   200   ...   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)

Keyboard shortcut
Result
Ctrl
 + 
a
Moves the cursor to the beginning of the line
Ctrl
 + 
e
Moves the cursor to the end of the line
Ctrl
 + 
l
Clears the screen
Ctrl
 + 
k
Deletes characters from the cursor to the end of the line
Ctrl
 + 
u
Deletes everything you've typed on that line (also works to clear 
text while entering a password)


Chapter 6
[
 145 
]
Going a bit further into the command history, we can also press 
Ctrl
 + 
r
 on the shell 
to initiate a search. After pressing these keys, we can start typing a command, and 
we'll get a preview of a command that matches what we're typing, which will be 
narrowed down further as we type more characters of it. This is one of those things 
that is hard for me to describe, and screenshots certainly don't help here, so go ahead 
and just give it a shot. For example, press 
Ctrl
 + 
r
 and then start typing 
sudo apt
. The 
last time you used that command should appear, and you can press 
Ctrl
 + 
r
 again, 
and again, and again to see additional examples of commands that you've typed in 
the past that contain those characters. When you get efficient with this, it's actually 
faster than the 
history
 command, but it takes a bit to get used to this.
Another fun trick is editing a command you've previously typed in a text editor. I 
know this sounds strange, but hear me out. Assume you pressed the up arrow, you 
have a very long command, and you just want to edit part of it without having to 
execute the entire thing, perhaps a command like this:
sudo apt update && sudo apt install apache2
Let's assume you want to install 
nginx
 instead of 
apache2
, but the rest of the 
command is right. If you hold 
Ctrl
 and then press 
x
 followed by 
e
, the command 
will open in a text editor. There, you can change the command. Once you're done 
making your changes, the command will execute once you save the file. Admittedly, 
this is usually only useful when you have a very long command and you need to just 
change part of it. It's also a little weird, but so are computers.
Did you notice the two 
&
 symbols in the previous command? This is another useful 
trick; you can actually chain commands together. In the previous example command, 
we're telling the shell to execute 
sudo apt update
. Next, we're telling the shell to 
then execute 
sudo apt install apache2
. The double ampersand is known as the 
logical 
AND
 operator, so the second command is run if the first was successful. If the 
first command was successful, the second command will execute right after. Another 
method to chain commands is this:
sudo apt update; sudo apt install apache2
The difference with the semicolon is that we're telling the shell to execute the second 
command 
regardless
 of whether the first command was successful. You may then 
be wondering, what constitutes success on the shell? An obvious answer to this 
question might be "it's successful if there are no error messages." While that's true, 
the shell utilizes exit codes to programmatically attribute success or failure. You 
can see the exit code of a command by typing this immediately after the previous 
command finishes:
echo $?


Boosting Your Command-line Efficiency

Download 15,21 Mb.

Do'stlaringiz bilan baham:
1   ...   193   194   195   196   197   198   199   200   ...   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