[Shell advanced] The most bull B Linux shell command (iv)

Source: Internet
Author: User
Tags glob net command

1. View the ASCII code table

Man
7 ASCII

Many people are beginners to the concept of the ASCII code, and sometimes in order to check the ASCII value of a symbol, you may have to rummage to find the current textbook? Linux Manpage contains a lot of similar practical information, the above command can be in a very detailed way to explain the ASCII code, of course, there are online version.

The second parameter of the man command is the area code, which distinguishes the range of index words, such as printf, which is different from the printf in the C standard library, the former query is Man 3 printf, the latter is man 1 printf. If this area code is omitted, it will be searched starting from 1 until it is found.

The command man man can see a detailed explanation.

Manpages also has some interesting and useful information that may be well-known:

Man 1 Intro-A concise tutorial on users who have never been in touch with Linux.
Man 2 syscalls-List of kernel system requests, categorized by kernel version notes, System programming prerequisites.
Man 2 Select_tut-tutorial on the Select () system request.
Man 3 string-all functions within the header file.
Man 3 stdio-Description of the standard input/output library for the use of header files.
Man 3 errno-the value and description of all Errorno. (Exception notification mechanism in C language similar to other languages)
The terminal control code of Man 4 Console_codes-linux and its usage explanation.
Man 4 full-describes the/dev/full, a disk that is always in the "Fill" state. (corresponds to/dev/null this always empty device)
Man 5 proc-describes the file system under/proc.
Man 5 filesystems-various Linux file systems.

The information in area 7th is usually the coolest:

Man 7 Bootparam-detailed explanation of kernel boot parameters.
Man 7 charsets-explains the encoding set for various languages. (gbk,gb2312, etc.)
Man 7 Glob-explains the working process of GLOB file name management mechanism.
Man 7 hier-explains the role of the various parts of the Linux file system architecture.
A list of the operators of the man 7 Operator-c language.
Man 7 regex-describes regular expressions.
Man 7 suffixes-a list of common file suffix names is explained.
The clock mechanism of the man 7 Time-linux is explained.
Man 7 units-numerical units and their numerical values are explained.
Man 7 UTF8-describes UTF-8 encoding.
Man 7 URL-the standard for interpreting URLs, URIs, urns, and so on.

2. Simple Timer

Time
Read

Run the command to start, press ENTER at the end to show the entire process time, accurate to the MS level.

Time is a program used to calculate how long a process takes to run to the end, and its output typically has three items:

$ Time Ls/opt
...

Real 0m0.008s
User 0m0.003s
SYS 0m0.007s

Real refers to the time it takes for the entire program to run in the real world, the user refers to the time that the program is running in users ' space, and SYS refers to the time the program calls the lock on the system.

Read is a command to read the user input, the common use is read line, the user entered and enter, the type of content is saved to the $line variable, but before you type enter, the command is blocked.

Visible time Read this command has the flexibility to take advantage of the operating system's blocking. Use this command to test how long a pot of water should be boiled and rolled should be good.

3. Remotely turn off a Windows machine

net RPC shutdown-i ip_address-u Username%password

The net command on the Windows platform is relatively powerful, because its background is an RPC class system service, you should have seen win under the net usefile:///C|/ip/ipc%24 * Such a command to establish an IPC null connection, Invasion of the host thing.

The net command under Linux is a program for Samba components, usually contained within Smbclient, that communicates with services such as files and printer shares of Windows hosts, but also supports RPC commands.

The above command executes the shutdown command on a remote Windows host. Of course, this does not necessarily succeed, related to the security settings on the win host. NET command to control the win host.

4. Run a command in a child shell

(cd/tmp && ls)

Of course this is just a demonstration, to see the directory of course can ls/tmp.

The benefit is that the current shell's directory is not changed, and if the command is designed for environment variables, there will be no changes to the current shell.

There are a lot of shell programming that use quotes to enclose a command: ' Ls/tmp ', which is also a child shell process. However, the method of closing the quotation marks cannot be nested, and the method of using parentheses can be, a more tangled example is:

echo $ (echo-e file:///C|/x%24%28printf "%x" 65))

5. Using an intermediate pipe nesting with ssh

ssh-t host_a ssh host_b

If the target machine host_b in a more complex network environment, the machine can not be directly accessed, but another host_a can access to host_b, but also can be accessed by the local, the above command to solve the problem of convenient login host_b.

But theoretically this process can be nested indefinitely, such as:

Ssh-t host1 ssh-t host2 ssh-t host3 ssh-t host4 ...

Well, that God horse FBI CIA, have the ability to catch me ~

6. Clear the screen

<CTRL+l>;

This is similar to the reset command that was described earlier, in fact, it just sends a control sequence to reset the display of the terminal.

You can also run this:

Tput Clear

Tput is a gadget specifically designed to control the terminal, but also quite powerful, with detailed information on Running Man Tput view.

7. I want to know when a server restarts

ping-a IP

The most common thing the system administrator does is reboot the system. But the server restart process often takes several minutes, what is your server 4 SCSI card? 16 drives? System is Redhat? All components are also fully installed? Well, it's a good time to restart, so I'd love to know when it's coming back.

The ping command has a audible ping parameter,-A, which makes the trumpet sound when it finally pings your server.

8. List the 10 commands you use most

History
| awk ' {a[$2]++}end{for (i in a) {print a "" I}} ' | Sort-rn | Head

This is a good combination of commands: History outputs the user's command histories, awk counts and outputs lists; sort sorts; head truncates the first 10 lines.

9. Check Gmail for new messages

curl-u [email protected] --silent " https://mail.google.com/mail/feed/atom" |
Perl-ne \

Print "Subject: $" if/<title> (. +?) <\/title>/&& $title + +;
Print "(from $) \ n" If/<email> (. +?) <\/email>/;
'

One feature of Gmail is the support for the Atom feed output mailing list, so always see a lot of Gmail email reminders and the like, because the development of the very simple, atom is very convenient.

This is just using Perl's regular to parse atom (Sed/awk can do the same).

10. Using Telnet to watch "Star Wars"

telnet towel.blinkenlights.nl

There's nothing to explain, it's one of the ASCII Arts. If you have a IPv6 connection, you can also see the color version. Bull bar?

[Shell advanced] (GO) The most bull B Linux shell command (iv)

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.