20 uzlabotas komandas Linux ekspertiem
Paldies par visiem patīk, labie vārdi un atbalsts, ko jūs mums sniedzāt šī raksta pirmajās divās daļās. Pirmajā rakstā mēs apspriedām komandas tiem lietotājiem, kuri tikko ir pārgājuši uz Linux un kuriem sākumā vajadzīgas nepieciešamās zināšanas.
- 20 noderīgas komandas iesācējiem Linux
Otrajā rakstā mēs apspriedām komandas, kas vidēja līmeņa lietotājam nepieciešamas, lai pārvaldītu savu sistēmu.
- 20 uzlabotas komandas vidēja līmeņa Linux lietotājiem
Kas tālāk? Šajā rakstā es izskaidrošu komandas, kas nepieciešamas Linux Server administrēšanai.
41. Komanda: ifconfig
ifconfig tiek izmantots kodola-rezidenta tīkla saskarņu konfigurēšanai. Tas tiek izmantots sāknēšanas laikā, lai pēc vajadzības izveidotu saskarnes. Pēc tam tas parasti ir vajadzīgs tikai atkļūdošanas laikā vai tad, kad nepieciešama sistēmas iestatīšana.
[[email ~]$ ifconfig eth0 Link encap:Ethernet HWaddr 40:2C:F4:EA:CF:0E inet addr:192.168.1.3 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::422c:f4ff:feea:cf0e/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:163843 errors:0 dropped:0 overruns:0 frame:0 TX packets:124990 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:154389832 (147.2 MiB) TX bytes:65085817 (62.0 MiB) Interrupt:20 Memory:f7100000-f7120000 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:78 errors:0 dropped:0 overruns:0 frame:0 TX packets:78 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:4186 (4.0 KiB) TX bytes:4186 (4.0 KiB)
Parādīt visu interfeisu informāciju, ieskaitot atspējotās saskarnes, izmantojot argumentu “-a”.
[[email ~]$ ifconfig -a eth0 Link encap:Ethernet HWaddr 40:2C:F4:EA:CF:0E inet addr:192.168.1.3 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::422c:f4ff:feea:cf0e/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:163843 errors:0 dropped:0 overruns:0 frame:0 TX packets:124990 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:154389832 (147.2 MiB) TX bytes:65085817 (62.0 MiB) Interrupt:20 Memory:f7100000-f7120000 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:78 errors:0 dropped:0 overruns:0 frame:0 TX packets:78 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:4186 (4.0 KiB) TX bytes:4186 (4.0 KiB) virbr0 Link encap:Ethernet HWaddr 0e:30:a3:3a:bf:03 inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0 UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
[[email ~]$ ifconfig eth0 down
[[email ~]$ ifconfig eth0 up
Piešķiriet “192.168.1.12” kā interfeisa eth0 IP adresi.
[[email ~]$ ifconfig eth0 192.168.1.12
[[email ~]$ ifconfig eth0 netmask 255.255.255.
[[email ~]$ ifconfig eth0 broadcast 192.168.1.255
[[email ~]$ ifconfig eth0 192.168.1.12 netmask 255.255.255.0 broadcast 192.168.1.255
Piezīme: Ja izmantojat bezvadu tīklu, jums jāizmanto komanda “iwconfig”. Lai iegūtu vairāk komandu “ifconfig” piemēru un lietojumu, izlasiet 15 noderīgas komandas “ifconfig”.
42. Komanda: netstat
komanda netstat parāda dažādu ar tīklu saistītu informāciju, piemēram, tīkla savienojumus, maršrutēšanas tabulas, saskarnes statistiku, masku savienojumus, multiraides abonementus utt.,
[[email ~]$ netstat -a Active UNIX domain sockets (servers and established) Proto RefCnt Flags Type State I-Node Path unix 2 [ ACC ] STREAM LISTENING 741379 /run/user/user1/keyring-I5cn1c/gpg unix 2 [ ACC ] STREAM LISTENING 8965 /var/run/acpid.socket unix 2 [ ACC ] STREAM LISTENING 18584 /tmp/.X11-unix/X0 unix 2 [ ACC ] STREAM LISTENING 741385 /run/user/user1/keyring-I5cn1c/ssh unix 2 [ ACC ] STREAM LISTENING 741387 /run/user/user1/keyring-I5cn1c/pkcs11 unix 2 [ ACC ] STREAM LISTENING 20242 @/tmp/dbus-ghtTjuPN46 unix 2 [ ACC ] STREAM LISTENING 13332 /var/run/samba/winbindd_privileged/pipe unix 2 [ ACC ] STREAM LISTENING 13331 /tmp/.winbindd/pipe unix 2 [ ACC ] STREAM LISTENING 11030 /var/run/mysqld/mysqld.sock unix 2 [ ACC ] STREAM LISTENING 19308 /tmp/ssh-qnZadSgJAbqd/agent.3221 unix 2 [ ACC ] STREAM LISTENING 436781 /tmp/HotShots unix 2 [ ACC ] STREAM LISTENING 46110 /run/user/ravisaive/pulse/native unix 2 [ ACC ] STREAM LISTENING 19310 /tmp/gpg-zfE9YT/S.gpg-agent ....
[[email ~]$ netstat -at Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 localhost:mysql *:* LISTEN tcp 0 0 *:5901 *:* LISTEN tcp 0 0 *:5902 *:* LISTEN tcp 0 0 *:x11-1 *:* LISTEN tcp 0 0 *:x11-2 *:* LISTEN tcp 0 0 *:5938 *:* LISTEN tcp 0 0 localhost:5940 *:* LISTEN tcp 0 0 ravisaive-OptiPl:domain *:* LISTEN tcp 0 0 ravisaive-OptiPl:domain *:* LISTEN tcp 0 0 localhost:ipp *:* LISTEN tcp 0 0 ravisaive-OptiPle:48270 ec2-23-21-236-70.c:http ESTABLISHED tcp 0 0 ravisaive-OptiPle:48272 ec2-23-21-236-70.c:http TIME_WAIT tcp 0 0 ravisaive-OptiPle:48421 bom03s01-in-f22.1:https ESTABLISHED tcp 0 0 ravisaive-OptiPle:48269 ec2-23-21-236-70.c:http ESTABLISHED tcp 0 0 ravisaive-OptiPle:39084 channel-ecmp-06-f:https ESTABLISHED ...
[[email ~]$ netstat -s Ip: 4994239 total packets received 0 forwarded 0 incoming packets discarded 4165741 incoming packets delivered 3248924 requests sent out 8 outgoing packets dropped Icmp: 29460 ICMP messages received 566 input ICMP message failed. ICMP input histogram: destination unreachable: 98 redirects: 29362 2918 ICMP messages sent 0 ICMP messages failed ICMP output histogram: destination unreachable: 2918 IcmpMsg: InType3: 98 InType5: 29362 OutType3: 2918 Tcp: 94533 active connections openings 23 passive connection openings 5870 failed connection attempts 7194 connection resets received ....
LABI! Kādu iemeslu dēļ, ja jūs nevēlaties atrisināt resursdatoru, portu un lietotāja vārdu kā netstat izeju.
[[email ~]$ netstat -an
Lieliski, jums, iespējams, vajadzēs nepārtraukti iegūt netstat izvadi, līdz tiek nodota pārtraukšanas instrukcija (ctrl+c).
[[email ~]$ netstat -c
Plašākus “netstat” komandu piemērus un lietošanu skatiet rakstā 20 Netstat komandu piemēri.
43. Komanda: nslookup
Tīkla utilītu programma, ko izmanto, lai iegūtu informāciju par interneta serveriem. Kā norāda nosaukums, lietderība atrod vaicājumu DNS, domēnu nosaukuma servera informāciju.
[[email ~]$ nslookup linux-console.net Server: 192.168.1.1 Address: 192.168.1.1#53 Non-authoritative answer: Name: linux-console.net Address: 50.16.67.239
[[email ~]$ nslookup -query=mx linux-console.net Server: 192.168.1.1 Address: 192.168.1.1#53 Non-authoritative answer: linux-console.net mail exchanger = 0 smtp.secureserver.net. linux-console.net mail exchanger = 10 mailstore1.secureserver.net. Authoritative answers can be found from:
[[email ~]$ nslookup -type=ns linux-console.net Server: 192.168.1.1 Address: 192.168.1.1#53 Non-authoritative answer: linux-console.net nameserver = ns3404.com. linux-console.net nameserver = ns3403.com. Authoritative answers can be found from:
[[email ~]$ nslookup -type=any linux-console.net Server: 192.168.1.1 Address: 192.168.1.1#53 Non-authoritative answer: linux-console.net mail exchanger = 10 mailstore1.secureserver.net. linux-console.net mail exchanger = 0 smtp.secureserver.net. linux-console.net nameserver = ns06.domaincontrol.com. linux-console.net nameserver = ns3404.com. linux-console.net nameserver = ns3403.com. linux-console.net nameserver = ns05.domaincontrol.com. Authoritative answers can be found from:
[[email ~]$ nslookup -type=soa linux-console.net Server: 192.168.1.1 Address: 192.168.1.1#53 Non-authoritative answer: linux-console.net origin = ns3403.hostgator.com mail addr = dnsadmin.gator1702.hostgator.com serial = 2012081102 refresh = 86400 retry = 7200 expire = 3600000 minimum = 86400 Authoritative answers can be found from:
Mainiet porta numuru, izmantojot kuru vēlaties izveidot savienojumu
[[email ~]$ nslookup -port 56 linux-console.net Server: linux-console.net Address: 50.16.76.239#53 Name: 56 Address: 14.13.253.12
44. Komanda: rakt
dig ir rīks, lai vaicātu DNS vārda serveriem, lai iegūtu informāciju par resursdatora adresēm, pasta apmaiņu, nosaukumu serveriem un saistīto informāciju. Šo rīku var izmantot no jebkuras Linux (Unix) vai Macintosh OS X operētājsistēmas. Tipiskākais dig izmantošanas veids ir vienkārši vaicāt vienam resursdatoram.
[[email ~]$ dig linux-console.net ; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6 <<>> linux-console.net ;; global options: +cmd ;; Got answer: ;; ->>HEADER<
[[email ~]$ dig linux-console.net +nocomments ; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6 <<>> linux-console.net +nocomments ;; global options: +cmd ;linux-console.net. IN A linux-console.net. 14400 IN A 40.216.66.239 ;; Query time: 418 msec ;; SERVER: 192.168.1.1#53(192.168.1.1) ;; WHEN: Sat Jun 29 13:53:22 2013 ;; MSG SIZE rcvd: 45
[[email ~]$ dig linux-console.net +noauthority ; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6 <<>> linux-console.net +noauthority ;; global options: +cmd ;; Got answer: ;; ->>HEADER<
[[email ~]$ dig linux-console.net +noadditional ; <<>> DiG 9.9.2-P1 <<>> linux-console.net +noadditional ;; global options: +cmd ;; Got answer: ;; ->>HEADER<
[[email ~]$ dig linux-console.net +nostats ; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6 <<>> linux-console.net +nostats ;; global options: +cmd ;; Got answer: ;; ->>HEADER<
[[email ~]$ dig linux-console.net +noanswer ; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6 <<>> linux-console.net +noanswer ;; global options: +cmd ;; Got answer: ;; ->>HEADER<
[[email ~]$ dig linux-console.net +noall ; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6 <<>> linux-console.net +noall ;; global options: +cmd
45. Komanda: darbības laiks
Jūs tikko izveidojāt savienojumu ar savu Linux Server Machine un atradāt kaut ko neparastu vai ļaunprātīgu, ko jūs darīsit? Guessing… NĒ, noteikti nē, jūs varētu palaist uptime, lai pārbaudītu, kas faktiski notika, kad serveris bija bez uzraudzības.
[[email ~]$ uptime 14:37:10 up 4:21, 2 users, load average: 0.00, 0.00, 0.04
46. Komanda: siena
viena no vissvarīgākajām administratora komandām, siena nosūta ziņojumu visiem, kas pieteikušies, ar savu tīkla atļauju kā “jā”. Ziņojumu var norādīt kā argumentu uz sienu vai nosūtīt uz sienas standarta ievadi.
[[email ~]$ wall "we will be going down for maintenance for one hour sharply at 03:30 pm" Broadcast message from [email (pts/0) (Sat Jun 29 14:44:02 2013): we will be going down for maintenance for one hour sharply at 03:30 pm
47. komanda: mesg
Ļauj kontrolēt, vai cilvēki var izmantot komandu “rakstīt”, lai nosūtītu jums tekstu pa ekrānu.
mesg [n|y] n - prevents the message from others popping up on the screen. y – Allows messages to appear on your screen.
48. Komanda: rakstiet
Ļaujiet jums nosūtīt tekstu tieši uz citas Linux ierīces ekrānu, ja ‘mesg’ ir ‘y’.
[[email ~]$ write ravisaive
49. Komanda: saruna
Komandas, sarunas rakstīšanas uzlabojums ļauj sarunāties ar pieteicies lietotājiem.
[[email ~]$ talk ravisaive
Piezīme: Ja sarunu komanda nav instalēta, jūs vienmēr varat apt vai nepieciešamās pakotnes.
[[email ~]$ yum install talk OR [[email ~]$ apt-get install talk
50. Komanda: w
kāda komanda ‘w’ tev šķiet smieklīga? Bet patiesībā tā nav. t ir komanda, pat ja tā ir tikai viena burta gara! Komanda “w” ir darbības laika kombinācija un tas, kurš komandām dod secību uzreiz pēc otra, tādā secībā.
[[email ~]$ w 15:05:42 up 4:49, 3 users, load average: 0.02, 0.01, 0.00 USER TTY FROM [email IDLE JCPU PCPU WHAT server tty7 :0 14:06 4:43m 1:42 0.08s pam: gdm-passwo server pts/0 :0.0 14:18 0.00s 0.23s 1.65s gnome-terminal server pts/1 :0.0 14:47 4:43 0.01s 0.01s bash
51. Komanda: pārdēvēt
Kā norāda nosaukums, šī komanda pārdēvē failus. pārdēvējot pārdēvēs norādītos failus, aizstājot pirmo no faila nosaukuma.
Give the file names a1, a2, a3, a4.....1213
Vienkārši ierakstiet komandu.
rename a1 a0 a? rename a1 a0 a??
52. Komanda: augšā
Parāda procesora procesus. Pēc noklusējuma šī komanda tiek automātiski atsvaidzināta un turpina rādīt procesora procesus, ja vien netiek dota pārtraukuma instrukcija.
[[email ~]$ top top - 14:06:45 up 10 days, 20:57, 2 users, load average: 0.10, 0.16, 0.21 Tasks: 240 total, 1 running, 235 sleeping, 0 stopped, 4 zombie %Cpu(s): 2.0 us, 0.5 sy, 0.0 ni, 97.5 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st KiB Mem: 2028240 total, 1777848 used, 250392 free, 81804 buffers KiB Swap: 3905532 total, 156748 used, 3748784 free, 381456 cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 23768 ravisaiv 20 0 1428m 571m 41m S 2.3 28.9 14:27.52 firefox 24182 ravisaiv 20 0 511m 132m 25m S 1.7 6.7 2:45.94 plugin-containe 26929 ravisaiv 20 0 5344 1432 972 R 0.7 0.1 0:00.07 top 24875 ravisaiv 20 0 263m 14m 10m S 0.3 0.7 0:02.76 lxterminal 1 root 20 0 3896 1928 1228 S 0.0 0.1 0:01.62 init 2 root 20 0 0 0 0 S 0.0 0.0 0:00.06 kthreadd 3 root 20 0 0 0 0 S 0.0 0.0 0:17.28 ksoftirqd/0 5 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/0:0H 7 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/u:0H 8 root rt 0 0 0 0 S 0.0 0.0 0:00.12 migration/0 9 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcu_bh 10 root 20 0 0 0 0 S 0.0 0.0 0:26.94 rcu_sched 11 root rt 0 0 0 0 S 0.0 0.0 0:01.95 watchdog/0 12 root rt 0 0 0 0 S 0.0 0.0 0:02.00 watchdog/1 13 root 20 0 0 0 0 S 0.0 0.0 0:17.80 ksoftirqd/1 14 root rt 0 0 0 0 S 0.0 0.0 0:00.12 migration/1 16 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/1:0H 17 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 cpuset 18 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 khelper 19 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kdevtmpfs 20 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 netns 21 root 20 0 0 0 0 S 0.0 0.0 0:00.04 bdi-default 22 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kintegrityd 23 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kblockd 24 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 ata_sff
Lasiet arī: 12 TOP komandu piemēri
53. Komanda: mkfs.ext4
Šī komanda izveido jaunu ext4 failu sistēmu norādītajā ierīcē, ja pēc šīs komandas tiek izmantota nepareiza ierīce, viss bloks tiks izdzēsts un formatēts, tāpēc tiek ieteikts šo komandu nedarbināt, kamēr vien jūs nesaprotat, ko darāt.
Mkfs.ext4 /dev/sda1 (sda1 block will be formatted) mkfs.ext4 /dev/sdb1 (sdb1 block will be formatted)
Lasīt vairāk: Kas ir Ext4 un kā izveidot un pārveidot
54. Komanda: vi/emacs/nano
vi (visual), emacs, nano ir daži no visbiežāk izmantotajiem redaktoriem Linux. Tos bieži izmanto, lai rediģētu tekstu, konfigurāciju un ... failus. Īss ceļvedis darbam ap vi un nano ir tas, ka emacs ir a.
[[email ~]$ touch a.txt (creates a text file a.txt) [[email ~]$ vi a.txt (open a.txt with vi editor)
[nospiediet taustiņu i, lai ievadītu ievietošanas režīmu, pretējā gadījumā jūs nevarēsiet neko ievadīt]
echo "Hello" (your text here for the file)
- alt + x (izejiet no ievietošanas režīma, atcerieties, ka starp pēdējo burtu ir jāpaliek atstarpei.
- komanda ctrl+x, vai arī pēdējais vārds tiks izdzēsts).
- : wq! (saglabā failu ar pašreizējo tekstu, atcerieties, ka “!” ir jāignorē).
[[email ~]$ nano a.txt (open a.txt file to be edited with nano)
edit, with the content, required
ctrl+x (lai aizvērtu redaktoru). Tas parādīs izvadi kā:
Save modified buffer (ANSWERING "No" WILL DESTROY CHANGES) ? Y Yes N No ^C Cancel
Noklikšķiniet uz “y” uz jā un ievadiet faila nosaukumu, un tas ir paveikts.
55. Komanda: rsync
Rsync kopē failus, un progresa joslai ir -P slēdzis. Tātad, ja jums ir instalēts rsync, varat izmantot vienkāršu aizstājvārdu.
alias cp='rsync -aP'
Tagad mēģiniet terminālā kopēt lielu failu un redzēt izvadi ar atlikušajiem vienumiem, līdzīgi kā progresa joslā.
Turklāt dublējuma saglabāšana un uzturēšana ir viens no vissvarīgākajiem un garlaicīgākajiem darbiem, kas jāveic sistēmas administratoram. Rsync ir ļoti jauks rīks (pastāv, vairāki citi), lai izveidotu un uzturētu rezerves kopijas terminālā.
[[email ~]$ rsync -zvr IMG_5267\ copy\=33\ copy\=ok.jpg ~/Desktop/ sending incremental file list IMG_5267 copy=33 copy=ok.jpg sent 2883830 bytes received 31 bytes 5767722.00 bytes/sec total size is 2882771 speedup is 1.00
Piezīme: -z saspiešanai, -v daudzbalsīgai un -r rekursīvai.
56. Komanda: brīva
Atmiņas un resursu uzskaite ir tikpat svarīga kā jebkurš cits administratora veiktais uzdevums, un šeit glābšanai nāk komanda “bezmaksas”.
[[email ~]$ free total used free shared buffers cached Mem: 2028240 1788272 239968 0 69468 363716 -/+ buffers/cache: 1355088 673152 Swap: 3905532 157076 3748456
[[email ~]$ free -b total used free shared buffers cached Mem: 2076917760 1838272512 238645248 0 71348224 372670464 -/+ buffers/cache: 1394253824 682663936 Swap: 3999264768 160845824 3838418944
[[email ~]$ free -k total used free shared buffers cached Mem: 2028240 1801484 226756 0 69948 363704 -/+ buffers/cache: 1367832 660408 Swap: 3905532 157076 3748456
[[email ~]$ free -m total used free shared buffers cached Mem: 1980 1762 218 0 68 355 -/+ buffers/cache: 1338 641 Swap: 3813 153 3660
[[email ~]$ free -g total used free shared buffers cached Mem: 1 1 0 0 0 0 -/+ buffers/cache: 1 0 Swap: 3 0 3
[[email ~]$ free -h total used free shared buffers cached Mem: 1.9G 1.7G 208M 0B 68M 355M -/+ buffers/cache: 1.3G 632M Swap: 3.7G 153M 3.6G
[[email ~]$ free -s 3 total used free shared buffers cached Mem: 2028240 1824096 204144 0 70708 364180 -/+ buffers/cache: 1389208 639032 Swap: 3905532 157076 3748456 total used free shared buffers cached Mem: 2028240 1824192 204048 0 70716 364212 -/+ buffers/cache: 1389264 638976 Swap: 3905532 157076 3748456
57. Komanda: mysqldump
Labi, līdz šim jūs no šīs komandas nosaukuma būtu sapratuši, ko šī komanda īsti nozīmē. Mysqldump komandas izlaiž visus (vai dublējumkopijas) visus vai konkrētos datubāzes datus dotajā failā. Piemēram,
[[email ~]$ mysqldump -u root -p --all-databases > /home/server/Desktop/backupfile.sql
Piezīme: mysqldump prasa, lai mysql darbotos, un autorizācijai ir pareiza parole. Mēs esam iekļāvuši dažas noderīgas “mysqldump” komandas Database Backup ar mysqldump komandu
58. Komanda: mkpasswd
Izveidojiet grūti uzminamu, nejaušu paroli, kura garums ir noteikts.
[[email ~]$ mkpasswd -l 10 zI4+Ybqfx9
[[email ~]$ mkpasswd -l 20 w0Pr7aqKk&hmbmqdrlmk
Piezīme: -l 10 ģenerē nejaušu paroli ar 10 rakstzīmēm, savukārt -l 20 - paroli ar 20. rakstzīmi. To var iestatīt uz jebko, lai iegūtu vēlamo rezultātu. Šī komanda ir ļoti noderīga un bieži tiek izmantota skriptu valodā, lai ģenerētu nejaušas paroles. Lai izmantotu šo komandu, jums, iespējams, vajadzēs yum vai apt pakotni ‘várható’.
yum install expect OR apt-get install expect
59. Komanda: ielīmēt
Apvienojiet divus vai vairākus teksta failus uz līnijām, izmantojot. Piemērs. Ja faila1 saturs bija:
1 2 3 and file2 was: a b c d the resulting file3 would be: 1 a 2 b 3 c d
60. Komanda: lsof
lsof nozīmē “sarakstu ar atvērtajiem failiem” un parāda visus failus, kurus jūsu sistēma pašlaik ir atvērusi. Ir ļoti noderīgi noskaidrot, kuros procesos tiek izmantots noteikts fails, vai parādīt visus failus vienam procesam. Daži noderīgi 10 lsof komandu piemēri, jūs varētu interesēt lasīšana.
[[email ~]$ lsof COMMAND PID TID USER FD TYPE DEVICE SIZE/OFF NODE NAME init 1 root cwd DIR 8,1 4096 2 / init 1 root rtd DIR 8,1 4096 2 / init 1 root txt REG 8,1 227432 395571 /sbin/init init 1 root mem REG 8,1 47080 263023 /lib/i386-linux-gnu/libnss_files-2.17.so init 1 root mem REG 8,1 42672 270178 /lib/i386-linux-gnu/libnss_nis-2.17.so init 1 root mem REG 8,1 87940 270187 /lib/i386-linux-gnu/libnsl-2.17.so init 1 root mem REG 8,1 30560 263021 /lib/i386-linux-gnu/libnss_compat-2.17.so init 1 root mem REG 8,1 124637 270176 /lib/i386-linux-gnu/libpthread-2.17.so init 1 root mem REG 8,1 1770984 266166 /lib/i386-linux-gnu/libc-2.17.so init 1 root mem REG 8,1 30696 262824 /lib/i386-linux-gnu/librt-2.17.so init 1 root mem REG 8,1 34392 262867 /lib/i386-linux-gnu/libjson.so.0.1.0 init 1 root mem REG 8,1 296792 262889 /lib/i386-linux-gnu/libdbus-1.so.3.7.2 init 1 root mem REG 8,1 34168 262840 /lib/i386-linux-gnu/libnih-dbus.so.1.0.0 init 1 root mem REG 8,1 95616 262848 /lib/i386-linux-gnu/libnih.so.1.0.0 init 1 root mem REG 8,1 134376 270186 /lib/i386-linux-gnu/ld-2.17.so init 1 root 0u CHR 1,3 0t0 1035 /dev/null init 1 root 1u CHR 1,3 0t0 1035 /dev/null init 1 root 2u CHR 1,3 0t0 1035 /dev/null init 1 root 3r FIFO 0,8 0t0 1714 pipe init 1 root 4w FIFO 0,8 0t0 1714 pipe init 1 root 5r 0000 0,9 0 6245 anon_inode init 1 root 6r 0000 0,9 0 6245 anon_inode init 1 root 7u unix 0xf5e91f80 0t0 8192 @/com/ubuntu/upstart init 1 root 8w REG 8,1 3916 394 /var/log/upstart/teamviewerd.log.1 (deleted)
Tas nav beigas, sistēmas administrators veic daudz lietu, lai nodrošinātu jums tik jauku saskarni, pie kuras jūs strādājat. Sistēmas administrēšana faktiski ir mācīšanās un ieviešanas māksla ļoti perfektā veidā. Mēs centīsimies iegūt jūs ar visu pārējo nepieciešamo, kas Linux profesionālim jāapgūst, patiesībā pats Linux ir mācību un mācīšanās process. Jūsu labie vārdi vienmēr tiek meklēti, kas mūs mudina pielikt vairāk pūļu, lai sniegtu jums zinošu rakstu. “Patīk un dalies ar mums, lai palīdzētu mums izplatīties”.