It has been time to use the * nix system. However, I still ignore some commands. I hope I can find these commands several years ago.
1. man ascii
This command prints the ASCII code table of octal, hexadecimal, and decimal. I couldn't believe that I knew the command a month ago. I always use google to query ASCII code tables. This command is actually more convenient.
ASCII(7) BSD Miscellaneous Information Manual ASCII(7)
NAME
ascii -- octal, hexadecimal and decimal ASCII character sets
DESCRIPTION
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
For more information, see the ascii manual page.
2. cal
In many systems, it usually takes several steps to display the calendar. 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
For more information, see the cal manual page.
3. xxd
> 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...;...
This is another command that I could not believe was recently known. Xxd can generate the hexadecimal copy of the given file, or restore the edited hexadecimal copy to the binary format. It can also copy the hexadecimal data and output it into an array of C, which is very convenient:
> 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;
I also use this command to compare two binary files by comparing the hexadecimal copies of two files. For more information, see the xxd manual page.
4. ssh
Ssh is the first unix tool I know, but it was not long ago that I realized that it has more functions than using it to log on to a remote machine.
Ssh and its attached tools can be used:
1. transfer files between computers (using scp)
2 X-forwarding-connect to the remote machine and enable a GUI application. It looks like they are enabled locally, even if the remote machine does not provide the X service.
3 port forwarding-forward the connection to the local port to the port of the remote machine, or forward the connection to the remote machine port to the local port
4 SOCKS proxy-allows you to forward all connections on an application that supports SOCKET proxy to a remote machine. This is useful for more secure use of public wifi to browse networks and bypass strict firewalls.
5. Enter the password on the local machine once, and then use the ssh key proxy to log on to other remote machines with a security identity without entering your password again.
For more information, see the ssh manual page.
5. mdfind
The unique commands on this mac, of course, other * nix also have similar commands. It has the same functions as the find command, but it uses Spotlight indexes. It allows you to query your entire file system in seconds. You can use it to instantly display the updates of new files that meet the conditions. I often use it to query important files stored by applications in hidden locations.
> mdfind -name homebrew
/usr/local/Library/Homebrew
/Users/job/Library/Logs/Homebrew
For more information, see the mdfind manual page.
Awk for Unix text processing tools
Sed for Unix text processing tools
Unix/Linux System Management Technical Manual (Fourth Edition) HD Chinese PDF
Advanced Programming in Unix environment-Symbolic Link
Unix Shell loop control-while