<delect id="sj01t"></delect>
  1. <em id="sj01t"><label id="sj01t"></label></em>
  2. <div id="sj01t"></div>
    1. <em id="sj01t"></em>

            <div id="sj01t"></div>

            Linux系統專家必學的20個命令

            時間:2024-06-14 10:15:26 Linux認證 我要投稿
            • 相關推薦

            Linux系統專家必學的20個命令

              Linux系統專家必學的命令有哪些?Linux系統有哪些命令非常有用呢?下面跟yjbys小編一起來看看吧!

              1. 命令: ifconfig

              ifconfig用來配置常駐內核的網絡接口信息。在系統啟動必要時用來設置網絡適配器的信息。之后,它通常是只需要在調試時或當系統需要調整時使用。

              檢查活動網絡適配器

              [avishek@tecmint ~]$ 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)

              檢查所有的網絡適配器

              “-a”參數用來顯示所有網絡適配器(網卡)的詳細信息,包括那些停用的適配器。

              [avishek@tecmint ~]$ 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)

              停用網絡適配器

              [avishek@tecmint ~]$ ifconfig eth0 down

              啟用網絡適配器

              [avishek@tecmint ~]$ ifconfig eth0 up

              指定IP地址到網絡適配器

              為網絡適配器eth0設定IP地址“192.168.1.12”.

              [avishek@tecmint ~]$ ifconfig eth0 192.168.1.12

              更改網絡適配器eth0的子網掩碼

              [avishek@tecmint ~]$ ifconfig eth0 netmask 255.255.255.

              更改網絡適配器eth0的廣播地址

              [avishek@tecmint ~]$ ifconfig eth0 broadcast 192.168.1.255

              為網絡適配器eth0指定IP地址,子網掩碼,廣播地址

              [avishek@tecmint ~]$ ifconfig eth0 192.168.1.12 netmask 255.255.255.0 broadcast 192.168.1.255

              注Note:如果你設置一塊無線網卡的信息,你可以使用的命令是“iwconfig”.欲知更多ifconfig命令的例子和使用方法,讀“15個有用的ifconfig 命令”.

              2. 命令: netstat

              netstat命令顯示各種網絡相關的信息,如網絡連接,路由表,接口統計,偽裝連接,組播成員身份等….

              列出所有的網絡端口

              [avishek@tecmint ~]$ 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

              ....

              顯示所有tcp相關端口

              [avishek@tecmint ~]$ 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

              ...

              顯示所有連接的統計信息

              [avishek@tecmint ~]$ netstat -s

              Ip:

              994239 total packets received

              0 forwarded

              0 incoming packets discarded

              165741 incoming packets delivered

              3248924 requests sent out

              8 outgoing packets dropped

              Icmp:

              29460 ICMP messages received

              166 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

              1870 failed connection attempts

              7194 connection resets received

              ....

              好的!由于某些原因如果你不想解析netstat 輸出的主機、端口和用戶名稱的話 。

              [avishek@tecmint ~]$ netstat -an

              好,你可能需要獲取的 netstat 持續輸出的動態信息,通過傳遞中斷輸出指令 (ctrl + c)來停止。

              [avishek@tecmint ~]$ netstat -c

              更多關于“netstat”的例子和使用方法,瀏覽文章“20個netstat 的使用案例”。

              3. 命令: nslookup

              網絡實用程序,用于獲得互聯網服務器的信息。顧名思義,該實用程序將發現通過查詢 DNS 域的名稱服務器信息。

              [avishek@tecmint ~]$ nslookup tecmint.com

              Server: 192.168.1.1

              Address: 192.168.1.1

              #53

              Non-authoritative answer:

              Name: tecmint.com

              Address: 50.16.67.239

              查詢郵件交換器記錄

              [avishek@tecmint ~]$ nslookup -query=mx tecmint.com

              Server: 192.168.1.1

              Address: 192.168.1.1

              #53

              Non-authoritative answer:

              tecmint.com mail exchanger = 0 smtp.secureserver.net.

              tecmint.com mail exchanger = 10 mailstore1.secureserver.net.

              Authoritative answers can be found from:

              查詢域名服務器

              [avishek@tecmint ~]$ nslookup -type=ns tecmint.com

              Server: 192.168.1.1

              Address: 192.168.1.1

              #53

              Non-authoritative answer:

              tecmint.com nameserver = ns3404.com.

              tecmint.com nameserver = ns3403.com.

              Authoritative answers can be found from:

              查詢DNS記錄

              [avishek@tecmint ~]$ nslookup -type=any tecmint.com

              Server: 192.168.1.1

              Address: 192.168.1.1

              #53

              Non-authoritative answer:

              tecmint.com mail exchanger = 10 mailstore1.secureserver.net.

              tecmint.com mail exchanger = 0 smtp.secureserver.net.

              tecmint.com nameserver = ns06.domaincontrol.com.

              tecmint.com nameserver = ns3404.com.

              tecmint.com nameserver = ns3403.com.

              tecmint.com nameserver = ns05.domaincontrol.com.

              Authoritative answers can be found from:

              查詢起始授權機構

              [avishek@tecmint ~]$ nslookup -type=soa tecmint.com

              Server: 192.168.1.1

              Address: 192.168.1.1

              #53

              Non-authoritative answer:

              tecmint.com

              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:

              查詢端口號

              更改使用你想要連接的端口號

              [avishek@tecmint ~]$ nslookup -port 56 tecmint.com

              Server: tecmint.com

              Address: 50.16.76.239

              #53

              Name: 56

              Address: 14.13.253.12

              4. 命令: dig

              dig是查詢DNS 域名服務器的工具,可以查詢的主機地址、 郵件交流、 域名服務器相關的信息。在任何 Linux (Unix) 或 Macintosh OS X 操作系統上,都可以使用該工具。dig的最典型的用法是單個主機的查詢。

              [avishek@tecmint ~]$ dig tecmint.com

              ; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6 <<>> tecmint.com

              ;; global options: +cmd

              ;; Got answer:

              ;; ->>HEADER<

              關閉注釋行

              [avishek@tecmint ~]$ dig tecmint.com +nocomments

              ; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6 <<>> tecmint.com +nocomments

              ;; global options: +cmd

              ;tecmint.com. IN A

              tecmint.com. 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

              關閉認證塊

              [avishek@tecmint ~]$ dig tecmint.com +noauthority

              ; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6 <<>> tecmint.com +noauthority

              ;; global options: +cmd

              ;; Got answer:

              ;; ->>HEADER<

              關閉 其他 塊

              [avishek@tecmint ~]$ dig tecmint.com +noadditional

              ; <<>> DiG 9.9.2-P1 <<>> tecmint.com +noadditional

              ;; global options: +cmd

              ;; Got answer:

              ;; ->>HEADER<

              關閉 統計塊

              [avishek@tecmint ~]$ dig tecmint.com +nostats

              ; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6 <<>> tecmint.com +nostats

              ;; global options: +cmd

              ;; Got answer:

              ;; ->>HEADER<

              關閉回復塊

              [avishek@tecmint ~]$ dig tecmint.com +noanswer

              ; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6 <<>> tecmint.com +noanswer

              ;; global options: +cmd

              ;; Got answer:

              ;; ->>HEADER<

              關閉所有塊

              [avishek@tecmint ~]$ dig tecmint.com +noall

              ; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6 <<>> tecmint.com +noall

              ;; global options: +cmd

              閱讀更多10 個LinuxDig 命令實例

              1.命令: uptime

              你連接到你的Linux 服務器時發現一些不尋常或惡意的東西,你會做什么?猜測……不,絕不!你可以運行uptime來驗證當服務器無人值守式到底發生了什么事情。

              [avishek@tecmint ~]$ uptime

              14:37:10 up 4:21, 2 users, load average: 0.00, 0.00, 0.04

              6. 命令: wall

              對系統管理員來說一個最重要的命令.wall發送一條消息到大家登錄端將其mesg權限設置為”yes”。這條信息可以被wall作為參數,或者可以將它作為wall的標準輸入。

              [avishek@tecmint ~]$ wall "we will be going down for maintenance for one hour sharply at 03:30 pm"

              Broadcast message from root@localhost.localdomain (pts/0) (Sat Jun 29 14:44:02 2013):

              we will be going down for maintenance for one hour sharply at 03:30 pm

              7. 命令: mesg

              其他人們可以使用”wtrite”命令,將在在向您發送文本到屏幕上。你可以控制是否顯示。

              mesg [n|y] n - prevents the message from others popping up on the screen. y – Allows messages to appear on your screen.

              8. 命令: write

              如果 ‘mesg’ 是 ‘y’,讓你的文本直接發送到另一臺 Linux 機器的屏幕。.

              [avishek@tecmint ~]$ write ravisaive

              9. 命令: talk

              增強的write命令,talk命令可讓你與其他登錄的用戶交談。

              [avishek@tecmint ~]$ talk ravisaive

              注釋: 如果talk命令沒安裝的話,可以通過apt或yum 安裝所需的包.

              [avishek@tecmint ~]$ yum install talk

              OR

              [avishek@tecmint ~]$ apt-get install talk

              10. 命令:w

              是否覺得命令’w'很滑稽?但是事實上不是的。它是一個命令,盡管只有一個字符長!命令”w“是uptime和who命令,以前后的順序組合在一起。

              [avishek@tecmint ~]$ w

              15:05:42 up 4:49, 3 users, load average: 0.02, 0.01, 0.00

              USER TTY FROM LOGIN@ 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

              11. 命令: rename

              見名知意,這個命令重命名文件。rename將會通過從文件名的首字符開始替換,重命名為指定的文件名。

              Give the file names a1, a2, a3, a4.....1213

              僅僅寫這些命令:[@Lesus 注: 在Ubuntu上不支持這種格式, rename與mv不同的是,rename可以批量修改,如同帶了while的mv操作。]

              rename a1 a0 a

              rename a1 a0 a

              12. 命令: top

              顯示CPU進程信息。這個命令自動刷新,默認是持續顯示CPU進程信息,除非使用了中斷指令。

              [avishek@tecmint ~]$ 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

              另查看12 TOP命令例子·[@Lesus 注:htop比top命令更好用,不過需要自己安裝

            【Linux系統專家必學的20個命令】相關文章:

            Linux文件系統操作命令大全07-03

            關于dd命令備份Linux系統的6個例子01-06

            linux常用基本命令(文件處理命令)11-29

            Linux硬件信息命令大全10-10

            Linux中常用操作命令10-17

            java開發必會的Linux命令10-07

            Linux認證系統管理:linuxmail命令發送郵件失敗09-21

            Linux常用命令匯總07-28

            Linux入門常用命令08-08

            <delect id="sj01t"></delect>
            1. <em id="sj01t"><label id="sj01t"></label></em>
            2. <div id="sj01t"></div>
              1. <em id="sj01t"></em>

                      <div id="sj01t"></div>
                      黄色视频在线观看