A few unknown but very useful commands for the shell to share the _linux shell

Source: Internet
Author: User

Having recently been using the Linux operating system and being familiar with some simple commands, I'll introduce you to some of the less-known but very useful commands:

1.mtr command to view the direct network connection of a MTR running host and a Web site, as follows

MTR google.com

Show the content

Copy Code code as follows:

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% 42 0.5 0.5 0.5 0.6 0.0
2.118.126.0.9 0% 42 0.3 0.3 0.2 0.4 0.0
3.210.245.144.37 0% 42 2.9 3.6 2.9 22.1 3.0
4.113.10.231.125 0% 42 3.1 3.8 2.7 40.2 5.8
5. irb9.10g-tc2.wpc.nwtgigalink.com 0% 42 2.9 3.1 2.9 5.1 0.4
6. ae2.10g-pp2.wpc.nwtgigalink.com 0% 42 3.2 3.0 2.9 3.2 0.1
7. Google3-10g.hkix.net 0% 42 4.6 4.5 4.3 4.6 0.1
8.209.85.248.62 0% 42 5.0 5.3 4.8 13.7 1.6
9.209.85.241.171 0% 42 5.3 5.2 5.1 5.7 0.1
Hkg03s16-in-f8.1e100.net 0% 41 4.8 4.9 4.7 5.0 0.1

2.nl command, add the line number to the text you are viewing, as follows

Cat A.log
Aa

NL A.log
1 AA
3.SHUF command to randomly select rows or files from a file or a folder

Copy Code code as follows:

[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

Of course you can also change parameters such as Cat A.log | Shuf-n2 gets two lines of content.

4.last command to view the last logged-on or logged out user

Copy Code code as follows:

Root PTS/4 xxxxxxxxxxx Sun may 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 Displays the current process node in the structure of the tree

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
OK, so much for today, and later on ....

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.