Little-known Unix command inventory

  
                

Among the many commands in Unix, some commands are often used, and some commands are rare. Although they are less used, some commands are more practical. The following small series introduces some uncommon but practical ones. Unix commands, let's go together.

1. man ascii

This command will print out octal, hexadecimal and decimal ASCII code table.

ASCII(7) BSD Miscellaneous Information Manual ASCII(7)

NAME

ascii -- octal, hexadecimal and decimal ASCII character sets

DESCRIPTION< Br>

The octal set:

000 nul 001 soh 002 stx 003 etx 004 eot 005 enq 006 ack 007 bel

010 bs 011 ht 012 nl 013 vt 014 np 015 cr 016 So 017 si

020 dle 021 dc1 022 dc2 023 dc3 024 dc4 025 nak 026 syn 027 etb

030 can 031 em 032 sub 033 esc 034 fs 035 gs 036 rs 037 us

2. cal

There are several steps to displaying a calendar on many systems. In fact, you can use the cal command.

》 cal

August 2013

Su Mo Tu We Th Fr Sa

1 2 3

4 5 6 7 8 9 10

11 12 13 14 15 16 17

18 19 20 21 22 23 24

25 26 27 28 29 30 31

3. xxd< Br>

xxd somefile.bin

0000000: 83ff 0010 8d01 0408 d301 0408 a540 0408 . . . . . . . . . . . . .@.

0000010: d701 0408 d901 0408 db01 0408 0000 0000 . . . . . . . . . . . . . . . .

0000020: 0000 0000 0000 0000 0000 0000 1199 0508 . . . . . . . . . . . . . . . .

0000030: df01 0408 0000 0000 e199 0508 1d9a 0508 . . . . . . . . . . . . . . . .

0000040: e501 0408 2912 0508 e901 0408 eb01 0408. . . . ). . . . . . . . . . .

0000050: ed01 0408 ef01 0408 39e0 0408 55e0 0408 . . . . . . . .9.. .U. .

0000060: 71e0 0408 8de0 0408 a9e0 0408 39f7 0408 q. . . . . . . . . .9.. .

0000070: 6df7 0408 a5f7 0408 ddf7 0408 15f8 0408 m. . . . . . . . . . . . . .

0000080: 49f8 0408 81f8 0408 7de5 0408 0b02 0408 I. . . . . . }. . . . . . .

0000090: 4ded 0408 a9ed 0408 1102 0408 c5e0 0408 M.. . . . . . . . . . . . . .

00000a0: 1502 0408 1702 0408 1902 0408 1b02 0408 . . . . . . . . . . . . . . . .

00000b0: e50a 0508 1d0b 0508 590b 0508 2302 0408 . . . . . . . .Y. .#. .

00000c0: 2502 0408 253d 0508 2941 0508 7106 0508 %. .%=. . ) A..q. .

00000d0: 8106 0508 690e 0508 990e 0508 c90e 0508. . . .i. . . . . . . . . .

00000e0: 19e1 0408 3702 0408 3902 0408 3b02 0408 . . . .7. .9.. . ; . .

xxd can generate a hex copy of the given file, or you can restore the edited hex copy to a binary format. It can also output a hex copy as an array of C:

xxd -i data.bin

unsigned char data_bin[] = {

0x6d, 0x61 , 0x64, 0x65, 0x20, 0x79, 0x6f, 0x75, 0x20, 0x6c, 0x6f, 0x6f,

0x6b, 0x0a

};

unsigned int data_bin_len = 14;

Use this command to compare two binary files by comparing hexadecimal copies of two files.

4. ssh

ssh is a slightly more complicated Unix tool that has many other uses besides using it to log in to a remote machine.

ssh and the tools it comes with can be used:

1 Passing files between computers (using scp)

2 X-forwarding – Connecting to the far end Machines, and open a GUI application, it looks like they are turned on locally, even if the remote machine does not provide X services.

3-port forwarding & ndash; forwards the connection to the local port to the port of the remote machine, or forwards the connection to the remote machine port to the local port

4 SOCKS proxy – You forward all connections on an application that supports the SOCKET proxy to the remote machine. This is useful for how to use public wifi to browse the web and bypass a strict firewall.

5 Enter the password once on the local machine, and then use ssh's key agent to log in to the remaining remote machines with a secure identity without having to enter your password repeatedly.

5. mdfind

This command is unique on mac, and of course other *nix will have similar commands. It has the same functionality as the find command, but it is indexed using Spotlight. It allows you to query your entire file system in seconds. You can use it to instantly display updates to new files that meet the criteria. It can be used to query important files that the app stores in a hidden location.

》 mdfind -name homebrew

/usr/local/Library/Homebrew

/Users/job/Library/Logs/Homebrew

The above is not A common but useful introduction to Unix commands, this article describes five commands that are often overlooked, and if you use them, you'll find them useful.

Copyright © Windows knowledge All Rights Reserved