Linux中/proc目錄下檔案詳解(三)__Linux

來源:互聯網
上載者:User
/proc/net子目錄

此目錄下的檔案描述或修改了連網代碼的行為。可以通過使用arp,netstat,route和ipfwadm命令設定或查詢這些特殊檔案中的許多檔案。

樣本:
[root@localhost /]# ls /proc/net
anycast6       ip_conntrack         mcfilter6  rt6_stats     tcp
arp            ip_conntrack_expect  netlink    rt_acct       tcp6
dev            ip_mr_cache          netstat    rt_cache      udp
dev_mcast      ip_mr_vif            packet     snmp          udp6
dev_snmp6      ip_tables_matches    psched     snmp6         unix
if_inet6       ip_tables_names      raw        sockstat      wireless
igmp           ip_tables_targets    raw6       sockstat6
igmp6          ipv6_route           route      softnet_stat
ip6_flowlabel  mcfilter             rpc        stat
--------------------------------------------------------------------------------


以下摘要介紹此目錄下檔案的功能:

arp
轉儲每個網路介面的arp表中dev包的統計

dev
來自網路裝置的統計

dev_mcast
列出二層(資料連結層)多播組

igmp
加入的IGMP多播組

netlink
netlink套介面的資訊

netstat
網路流量的多種統計。第一行是資訊頭,帶有每個變數的名稱。接下來的一行儲存相應變數的值

raw
原始套介面的套介面表

route
靜態路由表

rpc
包含RPC資訊的目錄

rt_cache
路由緩衝

snmp
snmp agent的ip/icmp/tcp/udp協議統計;各行交替給出欄位名和值

sockstat
列出使用的tcp/udp/raw/pac/syc_cookies的數量

tcp
TCP串連的套介面

udp
UDP串連的套介面表

unix
UNIX域套介面的套介面表
--------------------------------------------------------------------------------


樣本:[root@localhost /]# cat /proc/net/route
Iface   Destination     Gateway         Flags   RefCnt  Use     Metric  Mask   MTU      Window  IRTT
eth0    0035C2DA        00000000        0001    0       0       0       80FFFFF0
eth0    0000FEA9        00000000        0001    0       0       0       0000FFF0
eth0    00000000        0135C2DA        0003    0       0       0       00000000
--------------------------------------------------------------------------------


[root@localhost /]# cat /proc/net/tcp
  sl  local_address rem_address   st tx_queue rx_queue tr tm->when retrnsmt   uid  timeout inode
   0: 00000000:8000 00000000:0000 0A 00000000:00000000 00:00000000 00000000    29        0 9525 1 0dde7500 3000 0 0 2 -1
   1: 00000000:006F 00000000:0000 0A 00000000:00000000 00:00000000 00000000 0        0 9484 1 0dde79e0 3000 0 0 2 -1
   2: 0100007F:0277 00000000:0000 0A 00000000:00000000 00:00000000 00000000 0        0 10049 1 0a8e3a00 3000 0 0 2 -1
   3: 0100007F:14D7 00000000:0000 0A 00000000:00000000 00:00000000 00000000    99        0 9847 1 0dde7020 3000 0 0 2 -1
   4: 0100007F:0019 00000000:0000 0A 00000000:00000000 00:00000000 00000000 0        0 10286 1 0a8e3520 3000 0 0 2 -1
--------------------------------------------------------------------------------
[root@localhost /]# cat /proc/net/arp
IP address       HW type     Flags       HW address            Mask     Device
218.194.53.1     0x1         0x2         00:0D:BC:78:07:3F     *        eth0
--------------------------------------------------------------------------------
[root@localhost /]# cat /proc/net/udp
  sl  local_address rem_address   st tx_queue rx_queue tr tm->when retrnsmt   uid  timeout inode
   0: 00000000:8000 00000000:0000 07 00000000:00000000 00:00000000 00000000    29        0 9520 2 0b4ef7c0
105: 00000000:14E9 00000000:0000 07 00000000:00000000 00:00000000 00000000    99        0 10284 2 0b4ef040
111: 00000000:006F 00000000:0000 07 00000000:00000000 00:00000000 00000000 0        0 9483 2 0b4efcc0
116: 00000000:02F4 00000000:0000 07 00000000:00000000 00:00000000 00000000 0        0 9511 2 0b4efa40
119: 00000000:0277 00000000:0000 07 00000000:00000000 00:00000000 00000000 0        0 10050 2 0b4ef2c0

--------------------------------------------------------------------------------


/proc/scsi子目錄

此目錄下包含一個列出了所有檢測到的SCSI裝置的檔案,並且為每種控制器驅動程式提供一個目錄,在這個目錄下又為已安裝的此種控制器的每個執行個體提供一個子目錄。

樣本:
由於本人的機器沒有SCSI裝置,顧暫時無法提供樣本。
--------------------------------------------------------------------------------


/proc/sys子目錄

在此目錄下有許多子目錄。此目錄中的許多項都可以用來調整系統的效能。這個目錄包含資訊太多,無法介紹全部。只在樣本中展示目錄下的一些檔案。

樣本:[root@localhost /]# ls /proc/sys
debug  dev  fs  kernel  net  proc  sunrpc  vm
--------------------------------------------------------------------------------
[root@localhost ~]# ls /proc/sys/fs
aio-max-nr   dentry-state       file-nr      lease-break-time  overflowgid
aio-nr       dir-notify-enable  inode-nr     leases-enable     overflowuid
binfmt_misc  file-max           inode-state  mqueue            quota
--------------------------------------------------------------------------------
[root@localhost ~]# ls /proc/sys/kernel
acct                   hotplug      panic                   sem
cad_pid                modprobe     panic_on_oops           shmall
cap-bound              msgmax       pid_max                 shmmax
core_pattern           msgmnb       print-fatal-signals     shmmni
core_uses_pid          msgmni       printk                  sysrq
ctrl-alt-del           ngroups_max  printk_ratelimit        tainted
domainname             osrelease    printk_ratelimit_burst  threads-max
exec-shield            ostype       pty                     vdso
exec-shield-randomize  overflowgid  random                  version
hostname               overflowuid  real-root-dev
--------------------------------------------------------------------------------
[root@localhost ~]# ls /proc/sys/net
core  ethernet  ipv4  ipv6  unix
--------------------------------------------------------------------------------

[root@localhost sys]# ls /proc/sys/vm
block_dump                 laptop_mode            nr_pdflush_threads
dirty_background_ratio     legacy_va_layout       overcommit_memory
dirty_expire_centisecs     lower_zone_protection  overcommit_ratio
dirty_ratio                max_map_count          page-cluster
dirty_writeback_centisecs  min_free_kbytes        swappiness
hugetlb_shm_group          nr_hugepages           vfs_cache_pressure
--------------------------------------------------------------------------------

[root@localhost sys]# ls /proc/sys/net/ipv4
conf                               tcp_fack
icmp_echo_ignore_all               tcp_fin_timeout
icmp_echo_ignore_broadcasts        tcp_frto
icmp_ignore_bogus_error_responses  tcp_keepalive_intvl
icmp_ratelimit                     tcp_keepalive_probes
icmp_ratemask                      tcp_keepalive_time
igmp_max_memberships               tcp_low_latency
igmp_max_msf                       tcp_max_orphans
inet_peer_gc_maxtime               tcp_max_syn_backlog
inet_peer_gc_mintime               tcp_max_tw_buckets
inet_peer_maxttl                   tcp_mem
inet_peer_minttl                   tcp_moderate_rcvbuf
inet_peer_threshold                tcp_no_metrics_save
ip_autoconfig                      tcp_orphan_retries
ip_conntrack_max                   tcp_reordering
ip_default_ttl                     tcp_retrans_collapse
ip_dynaddr                         tcp_retries1
ip_forward                         tcp_retries2
ipfrag_high_thresh                 tcp_rfc1337
ipfrag_low_thresh                  tcp_rmem
ipfrag_secret_interval             tcp_sack
ipfrag_time                        tcp_stdurg
ip_local_port_range                tcp_synack_retries
ip_nonlocal_bind                   tcp_syncookies
ip_no_pmtu_disc                    tcp_syn_retries
neigh                              tcp_timestamps
netfilter                          tcp_tso_win_divisor
route                              tcp_tw_recycle
tcp_abort_on_overflow              tcp_tw_reuse
tcp_adv_win_scale                  tcp_vegas_alpha
tcp_app_win                        tcp_vegas_beta
tcp_bic                            tcp_vegas_cong_avoid
tcp_bic_fast_convergence           tcp_vegas_gamma
tcp_bic_low_window                 tcp_westwood
tcp_dsack                          tcp_window_scaling
tcp_ecn                            tcp_wmem
--------------------------------------------------------------------------------

[root@localhost sys]# cat /proc/sys/kernel/shmall
2097152
--------------------------------------------------------------------------------
[root@localhost sys]# cat /proc/sys/kernel/osrelease
2.6.9-1.667

--------------------------------------------------------------------------------


總結:/proc檔案系統包含了大量的有關當前系統狀態的資訊。proc的手冊頁中也有對這些檔案的解釋文檔。把檔案和分析這些檔案的工具產生的輸出進行比較能夠更加清晰地瞭解這些檔案。
相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.