国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > Linux Shell > 正文

關于shell的幾個不為人知卻十分有用的命令分享

2020-07-27 19:02:42
字體:
來源:轉載
供稿:網友

最近一直在使用Linux操作系統,也熟知一些簡單的命令,那么下面我將介紹幾個不為人知卻十分有用的命令:

1.mtr命令,查看mtr運行的主機和某個網站的直接網絡連接,如下

mtr google.com

顯示一下內容

復制代碼 代碼如下:

My traceroute  [v0.75]
localhost.localdomain (0.0.0.0)                        Sun May 18 19:32:36 2014
Keys:  Help   Display mode   Restart statistics   Order of fields   quit
 Packets               Pings
 Host                                Loss%   Snt   Last   Avg  Best  Wrst StDev
 1. 103.31.240.129                    0.0%    42    0.5   0.5   0.5   0.6   0.0
 2. 118.126.0.9                       0.0%    42    0.3   0.3   0.2   0.4   0.0
 3. 210.245.144.37                    0.0%    42    2.9   3.6   2.9  22.1   3.0
 4. 113.10.231.125                    0.0%    42    3.1   3.8   2.7  40.2   5.8
 5. irb9.10g-tc2.wpc.nwtgigalink.com  0.0%    42    2.9   3.1   2.9   5.1   0.4
 6. ae2.10g-pp2.wpc.nwtgigalink.com   0.0%    42    3.2   3.0   2.9   3.2   0.1
 7. google3-10G.hkix.net              0.0%    42    4.6   4.5   4.3   4.6   0.1
 8. 209.85.248.62                     0.0%    42    5.0   5.3   4.8  13.7   1.6
 9. 209.85.241.171                    0.0%    42    5.3   5.2   5.1   5.7   0.1
10. hkg03s16-in-f8.1e100.net          0.0%    41    4.8   4.9   4.7   5.0   0.1

2.nl命令,給所查看的文本加上行號,如下

cat a.log
aa

nl a.log
1 aa
 3.shuf命令,隨機從一個文件或者一個文件夾中選取行或者文件

復制代碼 代碼如下:

[root@localhost mwq]# ls | shuf -n1
a.log
[root@localhost mwq]# ls | shuf -n1
a.log
[root@localhost mwq]# ls | shuf -n1
a.log
[root@localhost mwq]# ls | shuf -n1
20140512.sql
[root@localhost mwq]# ls | shuf -n1
20140512.sql
[root@localhost mwq]# ls | shuf -n1
a.log
[root@localhost mwq]# vim a.log
[root@localhost mwq]# cat a.log | shuf -n1
aa
[root@localhost mwq]# cat a.log | shuf -n1
dd
[root@localhost mwq]# cat a.log | shuf -n1
aa
[root@localhost mwq]# cat a.log | shuf -n1
ff

 當然你也可以改變參數如cat a.log | shuf -n2獲取兩行內容。

4.last命令,查看上次登錄或者登出的用戶

復制代碼 代碼如下:

root     pts/4        xxxxxxxxxxx    Sun May 18 19:12   still logged in  
root     pts/4        xxxxxxxxxxx    Fri May 16 09:39 - 15:17  (05:38)   
root     pts/4        xxxxxxxxxxx    Wed May 14 17:13 - 18:01  (00:48)   
root     pts/4        xxxxxxxxxxx    Mon May 12 10:50 - 13:38  (02:47)   
root     pts/4        xxxxxxxxxxx    Mon May 12 10:48 - 10:50  (00:02)   
root     pts/1        xxxxxxxxxxx    Fri May  9 11:58   still logged in

5.pstree以樹的結構顯示當前的進程節點

init─┬─abrt-dump-oops
 ├─abrtd
 ├─acpid
 ├─atd
 ├─auditd───{auditd}
 ├─avahi-daemon───avahi-daemon
 ├─console-kit-dae───63*[{console-kit-da}]
 ├─crond
 ├─dbus-daemon───{dbus-daemon}
 ├─hald───hald-runner─┬─hald-addon-acpi
 │    └─hald-addon-inpu
 ├─irqbalance
 ├─java───330*[{java}]
 ├─master───qmgr
 ├─6*[mingetty]
 ├─mysqld_safe───mysqld───11*[{mysqld}]
 ├─rhsmcertd───rhsmcertd
 ├─rsyslogd───3*[{rsyslogd}]
 ├─sshd─┬─4*[sshd───bash]
 │  └─sshd───bash───pstree
 ├─stap-serverd
 ├─udevd───2*[udevd]
 └─vsftpd
好了,今天就先介紹這么多,稍后會繼續。。。。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 资兴市| 札达县| 龙游县| 江陵县| 抚顺市| 新建县| 南阳市| 尉犁县| 腾冲县| 会同县| 西安市| 顺昌县| 芒康县| 长白| 全州县| 广饶县| 吴桥县| 华阴市| 宁南县| 金溪县| 三都| 淄博市| 工布江达县| 炎陵县| 博乐市| 保亭| 吐鲁番市| 逊克县| 咸宁市| 广德县| 抚宁县| 靖边县| 来凤县| 陵水| 池州市| 汤阴县| 柳州市| 米脂县| 唐河县| 汤原县| 邻水|