1. 程式人生 > >一天一條Linux指令-ping

一天一條Linux指令-ping

用途說明

ping命令是常用的網路命令,它通常用來測試與目標主機的連通性,我們經常會說“ping一下某機器,看是不是開著”、不能開啟網頁時會說“你先ping閘道器地址192.168.1.1試試”。它通過傳送ICMP ECHO_REQUEST資料包到網路主機(send ICMP ECHO_REQUEST to network hosts),並顯示響應情況,這樣我們就可以根據它輸出的資訊來確定目標主機是否可訪問(但這不是絕對的)。有些伺服器為了防止通過ping探測到,通過防火牆設定了禁止ping或者在核心引數中禁止ping,這樣就不能通過ping確定該主機是否還處於開啟狀態。

man ping 寫道 ping uses the ICMP protocol’s mandatory ECHO_REQUEST datagram to elicit an ICMP ECHO_RESPONSE from a host or
gateway. ECHO_REQUEST datagrams (‘‘pings’’) have an IP and ICMP header, followed by a struct timeval and then
an arbitrary number of ‘‘pad’’ bytes used to fill out the packet.

ping命令用於:
  * 確定網路和各外部主機的狀態。
  * 跟蹤和隔離硬體和軟體問題。
  * 測試、評估和管理網路。

維基百科上關於ping的說明

ping - 維基百科,自由的百科全書 寫道 ping是:一個電腦網路工具,用來測試特定主機能否通過IP到達。ping的運作原理是:向目標主機傳出一個ICMPecho要求分組,等待接收echo迴應分組。程式會按時間和反應成功的次數,估計失去分組率(丟包率)和分組來回時間(網路時延)(Round-trip delay time)。

1983年12月,Mike Muuss寫了這個程式,在IP網路出問題時方便找出其根源。因為這個程式的運作和潛水艇的聲納相似,他便用聲納的聲音來為程式取名。David L. Mills曾提出另一個取名:Packet Internet Grouper/Gopher(後者指地鼠)。

網路管理員之間通常把ping用作動詞,如“ping一下計算機X,看他是否開著。”

根據ping輸出的ttl值,可以大體確定目標系統的作業系統型別:

TTL=32 Windows 9x/Me
TTL=64 LINUX
TTL=128 Windows 200x/XP
TTL=255 Unix

常用引數

格式:ping {IP}

格式:ping {HOST}

測試與指定ip地址{IP}或者主機名{HOST}的目標主機的連通性。按Ctrl+C終止,否則會一直執行下去。

友情提示:在Windows的cmd中要想達到同樣的效果,要加上-t引數,如 ping -t 192.168.1.103

格式:ping -b {BROADCAST-ADDRESS}

ping廣播地址(Allow pinging a broadcast address)。可以大體確定本網路中有哪些主機能訪問。

廣播地址{BROADCAST-ADDRESS}的形式如:192.168.1.255,192.168.255.255。

格式:ping -c {n} {IP_OR_HOST}

增加-c引數用於指定次數{n},這樣在傳送了{n}次ICMP資料包後,如果收到了響應或者超時就終止執行。

格式:ping -i {INTERVAL} {IP_OR_HOST}

增加-i引數用於指定傳送ICMP資料包的時間間隔,以秒為單位,可以為小數,普通使用者最小為0.2秒,只有root使用者才能指定比0.2秒小的間隔。如果不指定此引數,則預設的時間間隔是1秒。

man ping 寫道 Wait interval seconds between sending each packet. The default is to wait for one second between each
packet normally, or not to wait in flood mode. Only super-user may set interval to values less 0.2 sec-
onds.

格式:ping -f {IP_OR_HOST}

指定flood-ping,只有root使用者才能幹。flood-ping,顧名思義,就是像洪水一樣的傳送ICMP資料包。Ping淹沒是一種Ping廣播風暴,淹沒整個目標系統,以至於該系統不能響應合法的通訊。

man 寫道 -f Flood ping. For every ECHO_REQUEST sent a period ‘‘.’’ is printed, while for ever ECHO_REPLY received a
backspace is printed. This provides a rapid display of how many packets are being dropped. If interval
is not given, it sets interval to zero and outputs packets as fast as they come back or one hundred
times per second, whichever is more. Only the super-user may use this option with zero interval.

使用示例

示例一 ping得通的例子

[[email protected] ~]# ping 192.168.1.181 
PING 192.168.1.181 (192.168.1.181) 56(84) bytes of data.
64 bytes from 192.168.1.181: icmp_seq=1 ttl=64 time=0.235 ms
64 bytes from 192.168.1.181: icmp_seq=2 ttl=64 time=0.127 ms
64 bytes from 192.168.1.181: icmp_seq=3 ttl=64 time=0.126 ms

--- 192.168.1.181 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1999ms
rtt min/avg/max/mdev = 0.126/0.162/0.235/0.053 ms
[[email protected] ~]#

示例二 ping不通的例子

[[email protected] ~]# ping 192.168.1.1 
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
From 192.168.1.191 icmp_seq=2 Destination Host Unreachable 
From 192.168.1.191 icmp_seq=3 Destination Host Unreachable
From 192.168.1.191 icmp_seq=4 Destination Host Unreachable

--- 192.168.1.1 ping statistics ---
7 packets transmitted, 0 received, +3 errors, 100% packet loss, time 5999ms, pipe 3
[[email protected] ~]#

示例三 ping廣播地址

[[email protected] ~]# ping -b 192.168.1.255 
WARNING: pinging broadcast address 
PING 192.168.1.255 (192.168.1.255) 56(84) bytes of data.
64 bytes from 192.168.1.186: icmp_seq=1 ttl=64 time=0.214 ms
64 bytes from 192.168.1.178: icmp_seq=1 ttl=64 time=0.299 ms (DUP!)
64 bytes from 192.168.1.181: icmp_seq=1 ttl=64 time=0.305 ms (DUP!)
64 bytes from 192.168.1.189: icmp_seq=1 ttl=64 time=0.328 ms (DUP!)
64 bytes from 192.168.1.189: icmp_seq=2 ttl=64 time=0.156 ms
64 bytes from 192.168.1.181: icmp_seq=2 ttl=64 time=0.162 ms (DUP!)
64 bytes from 192.168.1.186: icmp_seq=2 ttl=64 time=0.164 ms (DUP!)
64 bytes from 192.168.1.178: icmp_seq=2 ttl=64 time=0.298 ms (DUP!)
64 bytes from 192.168.1.189: icmp_seq=3 ttl=64 time=0.153 ms
64 bytes from 192.168.1.181: icmp_seq=3 ttl=64 time=0.158 ms (DUP!)
64 bytes from 192.168.1.186: icmp_seq=3 ttl=64 time=0.161 ms (DUP!)
64 bytes from 192.168.1.178: icmp_seq=3 ttl=64 time=0.163 ms (DUP!)
64 bytes from 192.168.1.189: icmp_seq=4 ttl=64 time=0.158 ms
64 bytes from 192.168.1.181: icmp_seq=4 ttl=64 time=0.168 ms (DUP!)
64 bytes from 192.168.1.178: icmp_seq=4 ttl=64 time=0.171 ms (DUP!)
64 bytes from 192.168.1.186: icmp_seq=4 ttl=64 time=0.174 ms (DUP!)
64 bytes from 192.168.1.189: icmp_seq=5 ttl=64 time=0.154 ms
64 bytes from 192.168.1.181: icmp_seq=5 ttl=64 time=0.159 ms (DUP!)
64 bytes from 192.168.1.186: icmp_seq=5 ttl=64 time=0.162 ms (DUP!)
64 bytes from 192.168.1.178: icmp_seq=5 ttl=64 time=0.164 ms (DUP!)
64 bytes from 192.168.1.189: icmp_seq=6 ttl=64 time=0.145 ms
64 bytes from 192.168.1.181: icmp_seq=6 ttl=64 time=0.151 ms (DUP!)
64 bytes from 192.168.1.186: icmp_seq=6 ttl=64 time=0.154 ms (DUP!)
64 bytes from 192.168.1.178: icmp_seq=6 ttl=64 time=0.240 ms (DUP!)
64 bytes from 192.168.1.189: icmp_seq=7 ttl=64 time=0.146 ms
64 bytes from 192.168.1.181: icmp_seq=7 ttl=64 time=0.152 ms (DUP!)
64 bytes from 192.168.1.186: icmp_seq=7 ttl=64 time=0.155 ms (DUP!)
64 bytes from 192.168.1.178: icmp_seq=7 ttl=64 time=0.211 ms (DUP!)
64 bytes from 192.168.1.181: icmp_seq=8 ttl=64 time=0.147 ms
64 bytes from 192.168.1.189: icmp_seq=8 ttl=64 time=0.156 ms (DUP!)
64 bytes from 192.168.1.186: icmp_seq=8 ttl=64 time=0.159 ms (DUP!)
64 bytes from 192.168.1.178: icmp_seq=8 ttl=64 time=0.272 ms (DUP!)
64 bytes from 192.168.1.189: icmp_seq=9 ttl=64 time=0.150 ms
64 bytes from 192.168.1.181: icmp_seq=9 ttl=64 time=0.156 ms (DUP!)
64 bytes from 192.168.1.186: icmp_seq=9 ttl=64 time=0.159 ms (DUP!)
64 bytes from 192.168.1.178: icmp_seq=9 ttl=64 time=0.210 ms (DUP!)
64 bytes from 192.168.1.189: icmp_seq=10 ttl=64 time=0.157 ms
64 bytes from 192.168.1.181: icmp_seq=10 ttl=64 time=0.163 ms (DUP!)
64 bytes from 192.168.1.186: icmp_seq=10 ttl=64 time=0.165 ms (DUP!)
64 bytes from 192.168.1.178: icmp_seq=10 ttl=64 time=0.168 ms (DUP!)
64 bytes from 192.168.1.189: icmp_seq=11 ttl=64 time=0.134 ms
64 bytes from 192.168.1.181: icmp_seq=11 ttl=64 time=0.140 ms (DUP!)
64 bytes from 192.168.1.186: icmp_seq=11 ttl=64 time=0.172 ms (DUP!)
64 bytes from 192.168.1.178: icmp_seq=11 ttl=64 time=0.241 ms (DUP!)

--- 192.168.1.255 ping statistics ---
11 packets transmitted, 11 received, +33 duplicates, 0% packet loss, time 10000ms
rtt min/avg/max/mdev = 0.134/0.181/0.328/0.049 ms
[[email protected] ~]#

示例四 ping指定次數

[[email protected] ~]# ping -c 1 192.168.1.1 
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
From 192.168.1.191 icmp_seq=1 Destination Host Unreachable

--- 192.168.1.1 ping statistics ---
1 packets transmitted, 0 received, +1 errors, 100% packet loss, time 0ms

[[email protected] ~]# ping -c 1 192.168.1.181 
PING 192.168.1.181 (192.168.1.181) 56(84) bytes of data.
64 bytes from 192.168.1.181: icmp_seq=1 ttl=64 time=1.06 ms

--- 192.168.1.181 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 1.061/1.061/1.061/0.000 ms
[[email protected] ~]#

[[email protected] ~]# ping -c 4 192.168.1.1 
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
From 192.168.1.191 icmp_seq=1 Destination Host Unreachable
From 192.168.1.191 icmp_seq=2 Destination Host Unreachable
From 192.168.1.191 icmp_seq=3 Destination Host Unreachable
From 192.168.1.191 icmp_seq=4 Destination Host Unreachable

--- 192.168.1.1 ping statistics ---
4 packets transmitted, 0 received, +4 errors, 100% packet loss, time 2999ms, pipe 4
[[email protected] ~]#

示例五 ping不可達的網路地址

[[email protected] ~]# ping -c 4 192.168.100.123 
PING 192.168.100.123 (192.168.100.123) 56(84) bytes of data.

--- 192.168.100.123 ping statistics ---
4 packets transmitted, 0 received, 100% packet loss, time 3008ms

為了達到網路不可達的效果,我們增加一條拒絕路由。 
[[email protected] ~]# route add -net 192.168.100.0 netmask 255.255.255.0 reject 
[[email protected] ~]# route 
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
211.103.28.0    *               255.255.255.224 U     0      0        0 eth0
192.168.100.0   -               255.255.255.0   !     0      -        0 - 
192.168.1.0     *               255.255.255.0   U     0      0        0 eth1
169.254.0.0     *               255.255.0.0     U     0      0        0 eth1
10.0.0.0        -               255.0.0.0       !     0      -        0 -
default         211.103.28.1    0.0.0.0         UG    0      0        0 eth0
[[email protected] ~]# ping -c 4 192.168.100.123                                 
connect: Network is unreachable 
[[email protected] ~]#

示例六 flood-ping測試

ping -f 指定 flood-ping 選項。 -f 標誌“傾倒”或輸出資訊包,在它們回來時或每秒 100 次,選擇較快一個。每一次傳送 ECHO_REQUEST,都列印一個句號,而每接收到一個 ECHO_REPLY 訊號,就列印一個退格。這就提供了一種對多少資訊包被丟棄的資訊的快速顯示。僅僅 root 使用者可以使用這個選項。

[[email protected] ~]# ping -f 192.168.8.1 
PING 192.168.8.1 (192.168.8.1) 56(84) bytes of data.
.................................................................................................................................................................................................................................................................................................................................................................................................................................................
--- 192.168.8.1 ping statistics ---
433 packets transmitted, 0 received, 100% packet loss, time 4672ms

[[email protected] ~]# ping -f 192.168.1.8 
PING 192.168.1.8 (192.168.1.8) 56(84) bytes of data.
...................................................................................................................................................................................................................................................................................................E.........................................................................................................................................................................................................................................................................................................
--- 192.168.1.8 ping statistics ---
589 packets transmitted, 0 received, +3 errors, 100% packet loss, time 5995ms
, pipe 3
[[email protected] ~]# 
[[email protected] ~]# ping -f 192.168.1.181 
PING 192.168.1.181 (192.168.1.181) 56(84) bytes of data.

--- 192.168.1.181 ping statistics ---
18959 packets transmitted, 18958 received, 0% packet loss, time 2986ms
rtt min/avg/max/mdev = 0.093/0.103/1.084/0.017 ms, pipe 2, ipg/ewma 0.157/0.100 ms
[[email protected] ~]#

示例七 傳送時間間隔測試

[[email protected] ~]# ping -c 10 -i 0.5 www.g.cn 
PING www.g.cn (203.208.46.145) 56(84) bytes of data.
64 bytes from 203.208.46.145: icmp_seq=1 ttl=50 time=48.6 ms
64 bytes from 203.208.46.145: icmp_seq=2 ttl=50 time=29.7 ms
64 bytes from 203.208.46.145: icmp_seq=3 ttl=50 time=61.9 ms
64 bytes from 203.208.46.145: icmp_seq=4 ttl=50 time=33.1 ms
64 bytes from 203.208.46.145: icmp_seq=5 ttl=50 time=44.3 ms
64 bytes from 203.208.46.145: icmp_seq=6 ttl=50 time=37.0 ms
64 bytes from 203.208.46.145: icmp_seq=7 ttl=50 time=37.5 ms
64 bytes from 203.208.46.145: icmp_seq=8 ttl=50 time=48.0 ms
64 bytes from 203.208.46.145: icmp_seq=9 ttl=50 time=37.0 ms
64 bytes from 203.208.46.145: icmp_seq=10 ttl=50 time=45.3 ms

--- www.g.cn ping statistics ---
10 packets transmitted, 10 received, 0% packet loss, time 4502ms
rtt min/avg/max/mdev = 29.762/42.303/61.908/8.885 ms
[[email protected] ~]# ping -c 10 -i 0.01 www.g.cn 
PING www.g.cn (203.208.46.144) 56(84) bytes of data.
64 bytes from 203.208.46.144: icmp_seq=2 ttl=50 time=30.5 ms
64 bytes from 203.208.46.144: icmp_seq=1 ttl=50 time=45.1 ms
64 bytes from 203.208.46.144: icmp_seq=3 ttl=50 time=30.9 ms
64 bytes from 203.208.46.144: icmp_seq=4 ttl=50 time=42.6 ms
64 bytes from 203.208.46.144: icmp_seq=5 ttl=50 time=42.7 ms
64 bytes from 203.208.46.144: icmp_seq=7 ttl=50 time=30.1 ms
64 bytes from 203.208.46.144: icmp_seq=6 ttl=50 time=41.2 ms
64 bytes from 203.208.46.144: icmp_seq=8 ttl=50 time=34.3 ms
64 bytes from 203.208.46.144: icmp_seq=9 ttl=50 time=45.4 ms
64 bytes from 203.208.46.144: icmp_seq=10 ttl=50 time=41.3 ms

--- www.g.cn ping statistics ---
10 packets transmitted, 10 received, 0% packet loss, time 158ms
rtt min/avg/max/mdev = 30.163/38.468/45.439/5.926 ms, pipe 5
[[email protected] ~]# su - mike 
[[email protected]fht ~]$ ping -c 10 -i 0.01 www.g.cn 
PING www.g.cn (203.208.46.148) 56(84) bytes of data.
ping: cannot flood; minimal interval, allowed for user, is 200ms 
[[email protected] ~]$ exit 
logout

[[email protected] ~]#

示例八 一個探測區域網中哪些機器能ping通的指令碼

下面展示了一個指令碼,用來探測區域網中哪些主機能ping通。來自鳥哥的私房菜,稍作了修改。

[[email protected] ~]# cat >ping.sh 
#!/bin/bash
for siteip in $(seq 1 254)
do
        site="192.168.1.${siteip}"
        ping -c1 -W1 ${site} &> /dev/null
        if [ "$?" == "0" ]; then
                echo "$site is UP"
        else
                : #echo "$site is DOWN"
        fi
done
 

[[email protected] ~]# chmod +x ping.sh 
[[email protected] ~]# ./ping.sh 
192.168.1.178 is UP
192.168.1.181 is UP
192.168.1.186 is UP
192.168.1.189 is UP
192.168.1.191 is UP
192.168.1.193 is UP
192.168.1.194 is UP
[[email protected] ~]#

示例九 ping一下公網上的主機

在不能上網的時候,可以通過ping公網主機來確定能否上網。可以確定域名是否能解析,遠端主機是否可訪問等。

[[email protected] ~]# ping -c 4 en.wikipedia.org 
PING text.pmtpa.wikimedia.org (208.80.152.2) 56(84) bytes of data.
64 bytes from rr.pmtpa.wikimedia.org (208.80.152.2): icmp_seq=1 ttl=43 time=258 ms
64 bytes from rr.pmtpa.wikimedia.org (208.80.152.2): icmp_seq=2 ttl=43 time=265 ms
64 bytes from rr.pmtpa.wikimedia.org (208.80.152.2): icmp_seq=3 ttl=43 time=266 ms
64 bytes from rr.pmtpa.wikimedia.org (208.80.152.2): icmp_seq=4 ttl=43 time=264 ms

--- text.pmtpa.wikimedia.org ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 2998ms
rtt min/avg/max/mdev = 258.492/263.998/266.927/3.315 ms
[[email protected] ~]# ping -c 4 zh.wikipedia.org 
PING text.pmtpa.wikimedia.org (208.80.152.2) 56(84) bytes of data.
64 bytes from rr.pmtpa.wikimedia.org (208.80.152.2): icmp_seq=1 ttl=43 time=258 ms
64 bytes from rr.pmtpa.wikimedia.org (208.80.152.2): icmp_seq=2 ttl=43 time=258 ms
64 bytes from rr.pmtpa.wikimedia.org (208.80.152.2): icmp_seq=3 ttl=43 time=259 ms
64 bytes from rr.pmtpa.wikimedia.org (208.80.152.2): icmp_seq=4 ttl=43 time=257 ms

--- text.pmtpa.wikimedia.org ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3000ms
rtt min/avg/max/mdev = 257.679/258.435/259.326/0.590 ms
[[email protected] ~]# ping -c 4 www.google.com 
PING www.l.google.com (74.125.71.147) 56(84) bytes of data.
64 bytes from hx-in-f147.1e100.net (74.125.71.147): icmp_seq=1 ttl=48 time=74.6 ms
64 bytes from hx-in-f147.1e100.net (74.125.71.147): icmp_seq=2 ttl=48 time=74.4 ms
64 bytes from hx-in-f147.1e100.net (74.125.71.147): icmp_seq=3 ttl=48 time=74.3 ms
64 bytes from hx-in-f147.1e100.net (74.125.71.147): icmp_seq=4 ttl=48 time=77.4 ms

--- www.l.google.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3003ms
rtt min/avg/max/mdev = 74.358/75.236/77.467/1.335 ms
[[email protected] ~]# ping -c 4 www.google.com.hk 
PING www-hk.l.google.com (74.125.71.99) 56(84) bytes of data.
64 bytes from hx-in-f99.1e100.net (74.125.71.99): icmp_seq=1 ttl=48 time=74.5 ms
64 bytes from hx-in-f99.1e100.net (74.125.71.99): icmp_seq=2 ttl=48 time=74.3 ms
64 bytes from hx-in-f99.1e100.net (74.125.71.99): icmp_seq=3 ttl=48 time=74.7 ms
64 bytes from hx-in-f99.1e100.net (74.125.71.99): icmp_seq=4 ttl=48 time=74.9 ms

--- www-hk.l.google.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3002ms
rtt min/avg/max/mdev = 74.366/74.657/74.987/0.411 ms
[[email protected] ~]# ping -c 4 www.g.cn 
PING www.g.cn (203.208.46.144) 56(84) bytes of data.
64 bytes from 203.208.46.144: icmp_seq=1 ttl=50 time=109 ms
64 bytes from 203.208.46.144: icmp_seq=2 ttl=50 time=110 ms
64 bytes from 203.208.46.144: icmp_seq=3 ttl=50 time=95.5 ms
64 bytes from 203.208.46.144: icmp_seq=4 ttl=50 time=114 ms

--- www.g.cn ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 95.566/107.616/114.506/7.195 ms
[[email protected] ~]#

相關推薦

天一Linux指令-ping

用途說明 ping命令是常用的網路命令,它通常用來測試與目標主機的連通性,我們經常會說“ping一下某機器,看是不是開著”、不能開啟網頁時會說“你先ping閘道器地址192.168.1.1試試”。它通過傳送ICMP ECHO_REQUEST資料包到網路主機(send I

天一Linux指令-add-apt-repository

add-apt-repository ppa: xxx/ppa  這句話的意思是獲取最新的個人軟體包檔案源,將其新增至當前apt庫中,並自動匯入公鑰。 例如: sudo add-apt-repository ppa:shutter/ppa sudo apt-get up

天一Linux指令-ifconfig

用途說明 ifconfig命令常用來顯示系統中的網路介面(網絡卡)資訊,也可以用來配置網路介面(configure a network interface),如啟用、關閉、設定地址等。在Linux系統中,網絡卡命名規律:eth0為第一塊乙太網卡(Ethernet Car

天一LINUX 之 tail -f filenamey

在伺服器部署時,我們經常把專案日誌輸出到一個檔案中,那麼怎麼方便地檢視該日誌檔案的內容呢? tail 這個命令可以很好的幫助我們。 只想檢視最後幾句的時候使用 tail -n number filename 比如 tail -n 20 my.log 列印該日

天一linux命令 學習-- cd和pwd命令

今天學的cd命令 其實不用學 語法和DOS基本一樣,引數方面 .表示當前目錄,../表示上級目錄 ~表示當前使用者根目錄,/表示系統根目錄 學了一個新引數 !$ 表示用上一條命令的引數作為cd的引數 例如:你上條執行的是pwd 那麼再執行cd !$ ,就等於執行了cd pw

天一linux命令---chgrp命令

change group 就是改變檔案或者資料夾所屬的群組 ll 命令顯示一下 跟在所有者後面的選項就是群組 具體有哪些群組 要看/etc/group 檔案: mysql:x:499---> mysql就是群組名 499就是群組代號 例如: 將test資料夾的所

按日期統計收益,天的收益數據合並為天一數據

arc count output tab row name varchar col ble --統計今日金額合並為一條。一天一條數據 create proc sp_TableName @uid int, @bid int as begin S

linux天一個腳印:進程的管理

linux基礎命令進程進程: 運行在內存中程序實例 , 進程是程序運行的一種狀態 , 是內存中的概念,進程與進程之間無法訪問對方私有的內存區域。線程: 程序運行的最小單元,一個進程可以派生出多個線程,同一個進程內的線程之間可以相互訪問彼此內存區域,並且可以共享同一進程的共享內存區域。進程編號:pid父進程編號

linux指令、目錄與檔案)

一、文件與目錄 1.Linux檔案屬性 第一個字元代表這個檔案是『目錄、檔案或連結檔等等』: 當為[ d ]則是目錄; 當為[ - ]則是檔案; 若是[ l ]則表示為連結檔(

天一個命令之--Linux組(groupmod、groupadd)

Linux組的內容比較少,一塊兒總結了吧! 一、組檔案詳細說明。 /etc/group檔案包含系統上用到的每個組的資訊: root:x:0:root test:x:504: 可以看到該檔案有四個欄位: 1、組名 2、組密碼 3、GID 4、屬於該組的使用者列表。這個欄

Mysql語句+Linux指令步入門

MySQL基礎 登入MySQL mysql -h 127.0.0.1 -u root -p 分別表示需要登入的主機名 使用者名稱 以密碼登入 基於Navicat for Mac 實操MySqL 重要概念 進入Navicat後,會要求連線到一個已有的伺服

平時工作中一定會用到的Linux指令

一、find指令——查詢指令最常用引數:【-name】   根據名稱查詢【-iname】  根據名稱查詢,且忽略大小寫差異最常用命令:【find 目錄名 -name 檔案或目錄名】     根據檔名在指

懶人的python——次執行多linux命令

今天在公司搞了半天EE2I,一直在敲相同的命令累死了。每次執行ee2i.sh temp命令後,都要到cd到某個目錄下執行下一個shell指令碼。做完一次後又要刪除臨時檔案。總之,重複工作很多,我的指甲都敲累了。所以晚上回到家就寫了個類似的python指令碼來自動化執行這些討厭

如何通過ssh登入伺服器執行linux指令-ganymed的簡單使用()

ganymed是用java實現的一個ssh協議包.通過他可以直接在java程式中連線ssh伺服器並執行指令. 使用步驟如下: 1.建立Connection:   Connection connection = new Connection("192.168.73.246")

linux天一個命令

一. 檔案目錄操作命令: ls -l 顯示更多資訊ls -tl 根據時間降序顯示 -r則逆序ls -R列出所有子目錄層ls顯示顏色  在/etc/bashrc, 加入:alias ls="ls --c

你有linux命令學習之解壓縮.tar .gz .xz .bz .zip

下載的包解壓還是壓縮本地的包,都要用到解壓縮命令。 1 .tar tar命令生成的壓縮包 1). 命令語法 tar [-xcfvzjJ] pathname.tar file 2).引數 -c

天一linux命令(22) wall,write使用者間傳送資訊

wall命令 這個命令的功能是對全部已登入的使用者傳送資訊,使用者可以先把要傳送的資訊寫好存入一個檔案中,然後輸入: # wall < 檔名 這樣就能對所有的使用者傳送資訊了。 在上面的例子中符號“<”表示輸入重定向,有關它的含義和用法請參閱第十章的有關內容。 例如: # wall

linux指令

堆棧 占用 顯示 clas pen cpu dsn baidu 條件 1.只查看該進程:ps -ef | grep 113452.查看該進程打開的文件:lsof -p 113453.查看內存分配:lcat /proc/11345/maps4.查看堆棧:pstack 1134

LNMP1.3鍵安裝Linux環境,配置Nginx運行ThinkPHP3.2

搜索 最終 ati 兼容 access eal inf pic enter LNMP1.3一鍵安裝Linux環境,配置Nginx運行ThinkPHP3.2 你是否遇見過:安裝LNMP1.3環境後,運行ThinkPHP 3.2,只能打開首頁,不能訪問控制器,報404

怎樣又次編譯linux內核

聲卡 class 補丁 相關 穩定 主板 inux 系統 內容 linux作為自由軟件。在廣大愛好者的支持下,內核版本號不斷更新。新的內核修訂了就得內核的bug,並添加了很多新的特性。假設用戶須要使用這些新的特性或者依據自己的系統量身定做一個更高效或更穩定的內核,就須要