/
index.html
878 lines (809 loc) · 34.9 KB
/
index.html
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<title>I NEED HELP</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"/>
<!--360 webkit-->
<meta name="renderer" content="webkit">
<!--Baidu no-transform-->
<meta http-equiv="Cache-Control" content="no-transform " />
<!--No user-scalable-->
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"/>
<link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="http://cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="http://cdn.bootcss.com/animate.css/3.5.2/animate.css">
<link rel="stylesheet" href="https://cdn.bootcss.com/highlight.js/9.11.0/styles/mono-blue.min.css">
<style>
a{
color:#AFAFAF;
}
a:hover {
text-decoration: none;
-webkit-transition: 0.2s;
-moz-transition: 0.2s;
transition: 0.2s;
}
a:focus,a:active{
text-decoration: none;
outline:0 !important;
}
* {
margin: 0;
padding: 0;
}
.navbar {
border-radius: 0px;
border: none;
}
.btn-mini {
background-color: #555;
color: #f3f3f3;
font-size: 11px;
padding: 4px 8px 2px 8px;
box-shadow: 0 4px 8px 0 rgba(7,17,27,.4);
}
.btn-mini2 {
background-color: transparent;
border: 1px solid #333;
color: #000;
font-size: 11px;
padding: 4px 8px 2px 8px;
box-shadow: 0 4px 8px 0 rgba(7,17,17,.4);
}
.btn-mini2:hover{
transition: all .2s;
background-color: #000;
color: #fff;
font-size: 11px;
}
.btn-mini:hover{
transition: all .6s;
background-color: #000;
color: #fff;
font-size: 11px;
}
.btn-mini:active{
transition: all .3s;
background-color: #000;
color: #fcfcfc;
font-size: 11px;
}
blockquote{
padding: 10px 10px;
font-size: 11px;
}
code {
font-family: Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,sans-serif;
background-color: #EEE;
}
kbd {
padding: .1em .6em;
border: 1px solid #CCC;
font-size: 11px;
font-family: Arial,Helvetica,sans-serif;
background-color: #F7F7F7;
font-weight:100;
color: #333;
-moz-box-shadow: 0 1px 0 rgba(0,0,0,0.2),0 0 0 2px #fff inset;
-webkit-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2),0 0 0 2px #FFF inset;
box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2),0 0 0 2px #FFF inset;
border-radius: 3px;
display: inline-block;
margin: 0 .1em;
text-shadow: 0 1px 0 #FFF;
line-height: 1.4;
white-space: nowrap;
}
html {
position: relative;
min-height: 100%;
}
body {
margin-bottom: 60px;
background-color: #EDEFF0;
background-size:cover;
}
.breadcrumb{
background-color: #fff;
border-radius: 5px;
margin:0;
}
table{
font-size: 11px;
}
.nav{
display:block;
background-color: #fff;
border-radius: 5px;
padding:0px 20px 20px 20px;
margin:20px 0px 20px 0px;
z-index:100;
}
.nav li{
margin:10px;
}
.nav li a{
font-size:15px;
color:#555;
padding:3px 5px 3px 5px;
border-radius: 3px;
-webkit-transition: all .6s;
-moz-transition: all .6s;
-o-transition: all .6s;
transition: all .6s;
}
.nav li a:active{
text-decoration: none;
}
.nav li a:hover{
color:#FFF;
background-color:#4096EE;
}
.page-header {
padding-bottom: 10px;
margin: 30px 0;
}
h4{
font-size:18px;
}
h6{
margin:20px 0px 20px 0px;
font-weight:bold;
font-size: 14px;
color: #8C8C8C;
}
pre, .code{
background-color: #ECECEC;
color:#000;
border: none;
border-radius: 5px;
font-family: Consolas,Courier,Courier New,monospace,serif;
font-size: 13px;
}
#FontAwesome-Icons i.fa{
font-size: 35px;
}
textarea.code{
-webkit-appearance: none;
resize: none;
width: 100%;
line-height: 25px;
outline: none;
padding: 8px 8px;
}
/***footer***/
footer {
padding: 30px 0;
line-height: 25px;
background-color: #1f2d3d;
position: absolute;
bottom: 0;
width: 100%;
}
.fa{
color:#5C5C5C;
}
.met-online {
display: none;
position: fixed;
right: 10px;
bottom: 10px;
z-index: 100;
overflow: hidden;
}
.met-online ul.blocks {
margin: 0;
transition: all 0.5s;
-moz-transition: all 0.5s;
-webkit-transition: all 0.5s;
-o-transition: all 0.5s;
overflow: hidden;
}
.met-online ul.blocks li {
clear: both;
margin-bottom: 5px;
}
.met-online ul.blocks li button{
border: none;
background-color: rgba(64, 150, 238, 0.95);
padding: 0;
width: 35px;
height: 35px;
}
.met-online ul.blocks li button i{
color: #fff;
}
.met-online ul.blocks li button:hover{
transition: all 0.5s;
-moz-transition: all 0.5s;
-webkit-transition: all 0.5s;
-o-transition: all 0.5s;
background-color: rgba(64, 150, 238, 0.75);
}
</style>
</head>
<body>
<nav class="navbar navbar-default">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="#">
ONLINE HELP for dummies
</a>
</div>
</div>
</nav>
<div class="container">
<div class="row">
<div class="col-md-12 breadcrumb">
<ol class="breadcrumb">
<li><a href="#Bash"><i class="fa fa-terminal" aria-hidden="true"></i> Bash</a></li>
<li><a href="#Git"><i class="fa fa-github-alt" aria-hidden="true"></i> Git / GitHub</a></li>
<li><a href="#Vi"><i class="fa fa-linux" aria-hidden="true"></i> Vi / Vim</a></li>
<li><a href="#macosx"><i class="fa fa-apple" aria-hidden="true"></i> OS X</a></li>
<li class="active"><a href="#Windows"><i class="fa fa-windows" aria-hidden="true"></i> Windows terminal command</a></li>
</ol>
</div>
<!-- ------------------------ Links ------------------------ -->
<div class="col-md-12 nav" id="Links">
<div class="page-header">
<a target="_blank" href="template.html"><h4>Links</h4></a>
</div>
<a target="_blank" class="btn btn-mini2" href="https://resources.jetbrains.com/storage/products/intellij-idea/docs/IntelliJIDEA_ReferenceCard.pdf">IntelliJ IDEA KEYMAP</a>
<a target="_blank" class="btn btn-mini2" href="https://code.visualstudio.com/shortcuts/keyboard-shortcuts-macos.pdf">Keyboard shortcuts for macOS - Visual Studio Code</a>
<a target="_blank" class="btn btn-mini2" href="https://kapeli.com/cheat_sheets/iTerm2.docset/Contents/Resources/Documents/index">iTerm2 cheetsheet</a>
</div>
<!-- ------------------------ Keymap & Shortcuts ------------------------ -->
<div class="col-md-12 nav" id="Keymap">
<div class="page-header">
<h4>Links</h4>
</div>
<a target="_blank" class="btn btn-mini" href="http://BootCDN.cn">BootCDN</a>
<a target="_blank" class="btn btn-mini" href="http://tool.lu">iBox在线工具</a>
</div>
<!-- ------------------------ FontAwesome Icons ------------------------ -->
<div class="col-md-12 nav" id="FontAwesome-Icons">
<div class="page-header">
<a target="_blank" href="https://fontawesome.com/v4.7.0/icons/">
<h4>Icons</h4>
</a>
</div>
<div class="table-responsive">
<table class="table table-bordered">
<tbody>
<tr>
<td><i class="fa fa-github-alt" aria-hidden="true"></i></td>
<td><textarea class="textarea code" readonly rows="1"><i class="fa fa-github-alt" aria-hidden="true"></i></textarea></td>
</tr>
<tr>
<td><i class="fa fa-weixin" aria-hidden="true"></i></td>
<td><textarea class="textarea code" readonly rows="1"><i class="fa fa-weixin" aria-hidden="true"></i></textarea></td>
</tr>
<tr>
<td><i class="fa fa-commenting-o" aria-hidden="true"></i></td>
<td><textarea class="textarea code" readonly rows="1"><i class="fa fa-commenting-o" aria-hidden="true"></i></textarea></td>
</tr>
<tr>
<td><i class="fa fa-envelope" aria-hidden="true"></i></td>
<td><textarea class="textarea code" readonly rows="1"><i class="fa fa-envelope" aria-hidden="true"></i></textarea></td>
</tr>
<tr>
<td><i class="fa fa-file-archive-o" aria-hidden="true"></i></td>
<td><textarea class="textarea code" readonly rows="1"><i class="fa fa-file-archive-o" aria-hidden="true"></i></textarea></td>
</tr>
</tbody>
</table>
</div>
</div>
<!-- ------------------------ UNIX/Linux bash ------------------------ -->
<div class="col-md-12 nav" id="Bash">
<div class="page-header"><h4>UNIX/Linux bash</h4></div>
<h6>File & Directory Commands</h6>
<pre class="">
The tilde (~) symbol stands for your home directory. If you are user, then the tilde (~) stands for /home/user
#显示当前目录
pwd: The pwd command will allow you to know in which directory you're located (pwd stands for "print working directory"). Example: "pwd" in the Desktop directory will show "~/Desktop". Note that the GNOME Terminal also displays this information in the title bar of its window. A useful gnemonic is "present working directory."
ls: The ls command will show you ('list') the files in your current directory. Used with certain options, you can see sizes of files, when files were made, and permissions of files. Example: "ls ~" will show you the files that are in your home directory.
cd: The cd command will allow you to change directories. When you open a terminal you will be in your home directory. To move around the file system you will use cd. Examples:
To navigate into the root directory, use "cd /"
To navigate to your home directory, use "cd" or "cd ~"
#切换到上级目录
To navigate up one directory level, use "cd .."
#返回到刚才的目录
To navigate to the previous directory (or back), use "cd -"
To navigate through multiple levels of directory at once, specify the full directory path that you want to go to. For example, use, "cd /var/www" to go directly to the /www subdirectory of /var/. As another example, "cd ~/Desktop" will move you to the Desktop subdirectory inside your home directory.
cp: The cp command will make a copy of a file for you. Example: "cp file foo" will make an exact copy of "file" and name it "foo", but the file "file" will still be there. If you are copying a directory, you must use "cp -r directory foo" (copy recursively). (To understand what "recursively" means, think of it this way: to copy the directory and all its files and subdirectories and all their files and subdirectories of the subdirectories and all their files, and on and on, "recursively")
mv: The mv command will move a file to a different location or will rename a file. Examples are as follows: "mv file foo" will rename the file "file" to "foo". "mv foo ~/Desktop" will move the file "foo" to your Desktop directory, but it will not rename it. You must specify a new file name to rename a file.
To save on typing, you can substitute '~' in place of the home directory.
Note that if you are using mv with sudo you can use the ~ shortcut, because the terminal expands the ~ to your home directory. However, when you open a root shell with sudo -i or sudo -s, ~ will refer to the root account's home directory, not your own.
rm: Use this command to remove or delete a file in your directory.
rmdir: The rmdir command will delete an empty directory. To delete a directory and all of its contents recursively, use rm -r instead.(只删除空的)
rm -rf: 递归删除 文件/文件夹
mkdir: The mkdir command will allow you to create directories. Example: "mkdir music" will create a directory called "music".
man: The man command is used to show you the manual of other commands. Try "man man" to get the man page for man itself. See the "Man & Getting Help" section down the page for more information.</pre>
<h6>解压缩</h6>
<pre class="prettyprint">
tar xvf wordpress.tar /* 解压tar格式的文件 */
tar tvf myfile.tar /* 查看tar文件中包含的文件 */
tar cf toole.tar tool /* 把tool目录打包为toole.tar文件 */
tar zcf vpser.tar.gz tool /* 把tool目录打包且压缩为vpser.tar.gz文件*/
tar jcvf /var/bak/www.tar.bz2 /var/www/ /*创建.tar.bz2文件,压缩率高*/
tar xjf www.tar.bz2 /*解压tar.bz2格式*/
gzip -d ge.tar.gz /* 解压.tar.gz文件为.tar文件 */
unzip phpbb.zip /* 解压zip文件*/</pre>
<h6>进程管理</h6>
<pre class="prettyprint">
ps -aux /*ps 进程状态查询命令*/
ps命令输出字段的含义:
[list]
[*]USER,进程所有者的用户名。
[*]PID,进程号,可以唯一标识该进程。
[*]%CPU,进程自最近一次刷新以来所占用的CPU时间和总时间的百分比。
[*]%MEM,进程使用内存的百分比。
[*]VSZ,进程使用的虚拟内存大小,以K为单位。
[*]RSS,进程占用的物理内存的总数量,以K为单位。
[*]TTY,进程相关的终端名。
[*]STAT,进程状态,用(R--运行或准备运行;S--睡眠状态;I--空闲;Z--冻结;D--不间断睡眠;W-进程没有驻留页;T停止或跟踪。)这些字母来表示。
[*]START,进程开始运行时间。
[*]TIME,进程使用的总CPU时间。
[*]COMMAND,被执行的命令行。
[/list]
ps -aux | grep nginx /*在所有进程中,查找nginx的进程*/
kill 1234 /*1234为进程ID,即ps -aux 中的PID*/
killall nginx /*killall 通过程序的名字,直接杀死所有进程,nginx为进程名*/</pre>
<h6>资源占用查询</h6>
<pre class="prettyprint">
df -sh /home/wwwroot/* /* 查看/home/wwwroot/下各个目录的占用大小 */
free -m /* 查看内存核swap使用情况 */
top /* 查看程序的cpu、内存使用情况 */
netstat -ntl /* 查看端口占用情况 */</pre>
<h6>用户管理</h6>
<pre class="prettyprint">
adduser /*添加用户,如adduser vpser */
deluser /*删除用户,如deluser vpser */
passwd /*修改密码,按提示输入密码,密码不显示*/</pre>
</div>
<!-- ------------------------ Git/GitHub ------------------------ -->
<div class="col-md-12 nav" id="Git">
<div class="page-header"><h4>Git/GitHub</h4></div>
<h6>create a new repository on the command line</h6>
<pre class="prettyprint">
echo # help >> README.md
//touch .gitignore
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/Suxiaogang/YourRepoName.git
git push -u origin master</pre>
<h6>push an existing repository from the command line</h6>
<pre class="prettyprint">
git remote add origin https://github.com/Suxiaogang/YourRepoName.git
git push -u origin master</pre>
<h6>clone a repository with git clone [url] [directory name]</h6>
<pre class="prettyprint">
$ git clone https://github.com/Suxiaogang/YourRepoName
$ git clone https://github.com/Suxiaogang/YourRepoName MyRepoName</pre>
<h6>other</h6>
<pre class="prettyprint">
#git add command https://www.kernel.org/pub/software/scm/git/docs/git-add.html
#add all files from the current directory
git add .
#only update files currently being tracked.
git add -u
$ git clone https://github.com/Suxiaogang/YourRepoName MyRepoName</pre>
</div>
<!-- ------------------------ Vi/Vim ------------------------ -->
<div class="col-md-12 nav" id="Vi">
<div class="page-header"><h4>Vi/Vim</h4></div>
http://www.washington.edu/computing/unix/vi.html
http://unixhelp.ed.ac.uk/vi/
https://www.ccsf.edu/Pub/Fac/vi.html
<h6>to load an existing text file into vi, run the command 'vi [filename]', from the shell prompt:</h6>
<pre class="prettyprint">
$ vi myfile.txt</pre>
<h6>Command Mode and Insert Mode:</h6>
<blockquote>
vi is different from many editors, in that it has two main modes of operation: <b>command mode</b>, and <b>insert mode</b>. This is the cause of much of the confusion when a new user is learning vi, but it is actually very simple to understand.<br><br>
When you first load the editor, you will be placed into <b>command mode</b>. To switch into insert mode, simply press the <kbd>i</kbd> key. Although nothing will change on the screen to indicate the new mode, any thing that you type from now on will appear in the screen - this is what you are used to if you have ever used any other editor, or word processor. Try typing a few lines of text. When you press 'return' or 'enter' a new line will be created, and you may continue typing.<br><br>
When you have finished typing, you may return to <b>command mode</b>. This is done by pressing your <kbd>Esc</kbd> key. In command mode, key presses do not appear on the screen, but instead are used to indicate various commands to vi.<br><br>
At first, you may often mistake command mode and insert mode. For example, you may think you are in insert mode, and start typing your text, when in fact you are in command mode, and each keypress you make will issue a command to vi. Be careful - you may accidentally modify or delete parts of your file.<br><br>
If you are unsure which mode you are in, press <kbd>Esc</kbd>. If you were in insert mode, you will be returned to command mode. If you were already in command mode, you will be left in command mode (possibly with a 'beep', to indicate that you were already in command mode).</blockquote>
<h6>To save the file. The command for this is <kbd>w</kbd> (note the colon before the 'w'). After the 'w', put a space, and the name you want to store the file as. For example:</h6>
<pre class="prettyprint">
:w firstfile.txt</pre>
<h6>To quit vi and save the contents of the buffer to the file that vi is being used to edit:</h6>
<pre class="prettyprint">
:wq</pre>
<h6>To quit vi and save the contents of the buffer to a new file:</h6>
<pre class="prettyprint">
:w filename
:q</pre>
<h6>Quit Without saving changes:</h6>
<pre class="prettyprint">
:q!</pre>
<h6>中文Vi教程</h6>
<pre>
vi 常用命令行
1.vi 模式
a) 一般模式: vi 处理文件时,一进入该文件,就是一般模式了.
b) 编辑模式:在一般模式下可以进行删除,复制,粘贴等操作,却无法进行编辑操作。等按下‘i,I,o,O,a,A,r,R’等
字母之后才能进入编辑模式.通常在linux中,按下上述字母时,左下方会出现'INSERT'或者‘REPLACE’字样,才可以
输入任何文字到文件中.要回到一般模式,按下[ESC]键即可.
c) 命令行模式:在一般模式中,输入“: 或者/或者?”,即可将光标移动到最下面一行,在该模式下,您可以搜索数据,而且读取,
存盘,大量删除字符,离开vi,显示行号等操作.
2.vi 常用命令汇总:
2.1 一般模式
a) 移动光标:
--> 上下左右方向键 ↑↓← →
--> 翻页 pagedown / pageup 按键
--> 数字 0 : 将光标移动到当前行首
--> $ : 将光标移动到当前行尾
--> G : 移动到这个文件的最后一行 nG : n 为数字,移动到这个文件的第n行.
--> gg: 移动到这个文件的第一行 相当于 1G
b) 搜索与替换
--> /word : 从光标开始,向下查询一个名为word的字符串。
--> :n1、n2s/word1/word2/g : n1 与n2 为数字.在第n1与n2行之间寻找word1这个字符串,
并将该字符串替换为word2。
--> :1、$s/word1/word2/g : 从第一行到最后一行寻找word1字符串,并将该字符串替换为word2
--> :1、$s/word1/word2/gc: 从第一行到最后一行寻找word1字符串,并将该字符串替换为word2。
并且在替换之前显示提示符给用户确认(conform)是否需要替换。
c) 删除,复制,粘贴
--> x,X : 在一行中,x为向后删除一个字符(相当于del键),X为向前删除一个字符(相当于backspace键)。
--> dd : 删除光标所在的那一整行。
--> ndd : n 为数字。从光标开始,删除向下n列。
--> yy : 复制光标所在的那一行。
--> nyy : n为数字。复制光标所在的向下n行。
--> p,P : p 为将已复制的数据粘贴到光标的下一行,P则为贴在光标的上一行。
--> u : 复原前一个操作
--> CTRL + r : 重做上一个操作。
--> 小数点'.': 重复前一个动作。
2.2 编辑模式:
a) i, I : 在光标所在处插入输入文字,已存在的文字向后退。i 为‘从当前光标所在处插入’,I 为‘在当前所在行的一个非空格符处开始插入’。
b) a, A : a 为‘从当前光标所在处的下一个字符开始插入’。A 为‘从光标所在行的最后一个字符处开始插入’。
c) o,O : 这是英文o的大小写。o为‘在当前光标所在行的下一行处插入新的一行’。O表示‘在当前光标所在行的上一行插入新的一行’。
d) r,R : 替换:r 会替换光标所在的那一个字符。 R : 会一直替换光标所在的字符,直到按下esc 键为止。
e) ESC : 进入一般模式。
2.3 命令模式:
a) :w : 将编辑的数据写入硬盘
b) :q : 离开vi
c) :q! : 强制离开,不存储
d) :wq : 存储后离开
e) :wq! : 强制存储后离开
3. vim 附加命令行
3.1 块选择(visual block)
v 字符选择,将光标经过的地方反白显示
V 行选择,会将光标经过的行反白选择
ctrl + v 块选择,可以用长方形的方式选择数据
y 复制反白的地方
d 将反白的地方删除掉
3.2 多文件编辑
:n 编辑下一个文件
:N 编辑上一个文件
:files 列出当前vim 打开的所有文件
3.3 多窗口功能
:sp 【filename】打开一个新窗口,如果加filename,表示在新窗口打开一个新文件
否则表示两个窗口为同一个文件内容
ctrl+wj 先按下ctrl ,再按下w后,放开所有按键,然后按下j,则光标可移动到下方的窗口
ctrl+wk 同上,不过光标移动到上面的窗口
ctrl+wq 其实就是:q结束离开。</pre>
</div>
<!-- ------------------------ Mac OS X ------------------------ -->
<div class="col-md-12 nav" id="macosx">
<div class="page-header"><h4>Mac OS X</h4></div>
<a href="https://support.apple.com/zh-cn/HT201236" target="_blank">https://support.apple.com/zh-cn/HT201236</a>
<div class="table-responsive"><table class="table table-bordered">
<tbody><tr><td>⌘</td>
<td>Command 键</td>
</tr><tr><td>⌃</td>
<td>Control 键</td>
</tr><tr><td>⌥</td>
<td>Option 键</td>
</tr><tr><td>⇧</td>
<td>Shift 键</td>
</tr><tr><td>⇪</td>
<td>Caps Lock</td>
</tr><tr><td>fn</td>
<td>功能键</td>
</tr></tbody></table>
</div>
<h6>文本处理</h6>
<div class="table-responsive"><table class="table table-bordered">
<tbody><tr><td>组合键</td>
<td>功能</td>
</tr><tr><td>Command-B</td>
<td>以粗体显示所选文本或切换文本粗体显示开/关</td>
</tr><tr><td>Command-I</td>
<td>以斜体显示所选文本或切换文本斜体显示开/关</td>
</tr><tr><td>Command-U</td>
<td>对所选文本加下划线或打开/关闭加下划线功能</td>
</tr><tr><td>Command-T</td>
<td>显示或隐藏“字体”窗口</td>
</tr><tr><td>fn-Delete</td>
<td>向前删除(适用于便携式 Mac 的内建键盘)</td>
</tr><tr><td>fn-上箭头</td>
<td>向上滚动一页(相当于 Page Up 键)</td>
</tr><tr><td>fn-下箭头</td>
<td>向下滚动一页(相当于 Page Down 键)</td>
</tr><tr><td>fn-左箭头</td>
<td>滚动至文稿开头(相当于 Home 键)</td>
</tr><tr><td>fn-右箭头</td>
<td>滚动至文稿末尾(相当于 End 键)</td>
</tr><tr><td>Command-右箭头</td>
<td>将文本插入点移至当前行的行尾</td>
</tr><tr><td>Command-左箭头</td>
<td>将文本插入点移至当前行的行首</td>
</tr><tr><td>Command-下箭头</td>
<td>将文本插入点移至文稿末尾</td>
</tr><tr><td>Command-上箭头</td>
<td>将文本插入点移至文稿开头</td>
</tr><tr><td>Option-右箭头</td>
<td>将文本插入点移至下一个单词的末尾</td>
</tr><tr><td>Option-左箭头</td>
<td>将文本插入点移至上一个单词的开头</td>
</tr><tr><td>Option-Delete</td>
<td>删除光标左侧的词,以及词后的任何空格或标点符号</td>
</tr><tr><td><p>Command-Shift-右箭头</p>
</td>
<td>选中插入点与当前行行尾之间的文本 (*)</td>
</tr><tr><td>Command-Shift-左箭头</td>
<td>选中插入点与当前行行首之间的文本 (*)</td>
</tr><tr><td>Command-Shift-上箭头</td>
<td>选中插入点与文稿开头之间的文本 (*)</td>
</tr><tr><td>Command-Shift-下箭头</td>
<td>选中插入点与文稿末尾之间的文本 (*)</td>
</tr><tr><td>Shift-左箭头</td>
<td>将文本选择范围向左扩展一个字符 (*)</td>
</tr><tr><td>Shift-右箭头</td>
<td>将文本选择范围向右扩展一个字符 (*)</td>
</tr><tr><td>Shift-上箭头</td>
<td>将文本选择范围扩展到上一行相同水平位置的最近字符边缘 (*)</td>
</tr><tr><td>Shift-下箭头</td>
<td>将文本选择范围扩展到下一行相同水平位置的最近字符边缘 (*)</td>
</tr><tr><td>Shift-Option-右箭头</td>
<td>将文本选择范围扩展到当前词的词尾,再按一次则扩展到后一词的词尾 (*)</td>
</tr><tr><td>Shift-Option-左箭头</td>
<td>将文本选择范围扩展到当前词的词首,再按一次则扩展到后一词的词首 (*)</td>
</tr><tr><td>Shift-Option-下箭头</td>
<td>将文本选择范围扩展到当前段落的段尾,再按一次则扩展到下一段落的结尾 (*)</td>
</tr><tr><td>Shift-Option-上箭头</td>
<td>将文本选择范围扩展到当前段落的段首,再按一次则扩展到下一段落的段首 (*)</td>
</tr><tr><td>Control-A</td>
<td>移至行或段落的开头</td>
</tr><tr><td>Control-B</td>
<td>向后移动一个字符</td>
</tr><tr><td>Control-D</td>
<td>删除光标前的字符</td>
</tr><tr><td>Control-E</td>
<td>移至行或段落的开头</td>
</tr><tr><td>Control-F</td>
<td>向前移动一个字符</td>
</tr><tr><td>Control-H</td>
<td>删除光标后的字符</td>
</tr><tr><td>Control-K</td>
<td>删除从光标前的字符到行或段落末尾的所有内容</td>
</tr><tr><td>Control-L</td>
<td>将光标或所选内容置于可见区域中央</td>
</tr><tr><td>Control-N</td>
<td>下移一行</td>
</tr><tr><td>Control-O</td>
<td>在光标后插入一行</td>
</tr><tr><td>Control-P</td>
<td>上移一行</td>
</tr><tr><td>Control-T</td>
<td>调换光标前后的字符</td>
</tr><tr><td>Control-V</td>
<td>下移</td>
</tr><tr><td>Command-{</td>
<td>使所选内容左对齐</td>
</tr><tr><td>Command-}</td>
<td>使所选内容右对齐</td>
</tr><tr><td>Command-|</td>
<td>使所选内容居中对齐</td>
</tr><tr><td>Command-Option-C</td>
<td>拷贝所选项的格式设置并存储到剪贴板</td>
</tr><tr><td>Command-Option-V</td>
<td>将某对象的样式应用于所选对象(粘贴样式)</td>
</tr><tr><td>Command-Shift-Option-V</td>
<td>将周围文本的样式应用于所插入对象(粘贴并匹配样式)</td>
</tr><tr><td>Command-Control-V</td>
<td>将格式设置应用于所选对象(粘贴标尺)</td>
</tr><tr></tr></tbody></table>
</div>
<h6>Finder 快捷键</h6>
<div class="table-responsive"><table class="table table-bordered">
<tbody><tr><td>组合键</td>
<td>功能</td>
</tr><tr><td>Command-A</td>
<td>选择最前面的窗口中的所有文件</td>
</tr><tr><td>Command-Option-A</td>
<td>取消选择所有项</td>
</tr><tr><td>Command-C</td>
<td>拷贝选中的文件,然后使用“粘贴”或“移动”来移动这些文件。</td>
</tr><tr><td>Command-D</td>
<td>重复选中的文件</td>
</tr><tr><td>Command-E</td>
<td>推出</td>
</tr><tr><td>Command-F</td>
<td>查找任何匹配 Spotlight 属性的内容</td>
</tr><tr><td>Command-I</td>
<td>显示选中的文件的“显示简介”窗口</td>
</tr><tr><td>Command-Shift-C</td>
<td>打开“电脑”窗口</td>
</tr><tr><td>Command-Shift-D</td>
<td>打开“桌面”文件夹</td>
</tr><tr><td>Command-Shift-F</td>
<td>显示“我的所有文件”窗口</td>
</tr><tr><td>Command-Shift-G</td>
<td>前往文件夹</td>
</tr><tr><td>Command-Shift-H</td>
<td>打开当前已登录用户帐户的个人文件夹</td>
</tr><tr><td>Command-Shift-I</td>
<td>打开 iCloud Drive</td>
</tr><tr><td>Command-Shift-K</td>
<td>打开“网络”窗口</td>
</tr><tr><td>Command-Shift-L</td>
<td>打开“下载”文件夹</td>
</tr><tr><td>Command-Shift-O</td>
<td>打开“文稿”文件夹</td>
</tr><tr><td>Command-Shift-R</td>
<td>打开 AirDrop 窗口</td>
</tr><tr><td>Command-Shift-U</td>
<td>打开“实用工具”文件夹</td>
</tr><tr><td>Command-Control-T</td>
<td>添加到边栏 (OS X Mavericks)</td>
</tr><tr><td>Command-Option-I</td>
<td>显示或隐藏“检查器”窗口</td>
</tr><tr><td>Command-Control-I</td>
<td>获得摘要信息</td>
</tr><tr><td>Command-Option-P</td>
<td>隐藏或显示路径栏</td>
</tr><tr><td>Command-Option-S</td>
<td>隐藏或显示边栏</td>
</tr><tr><td>Command-正斜线 (/)</td>
<td>隐藏或显示状态栏</td>
</tr><tr><td>Command-J</td>
<td>调出“显示”选项</td>
</tr><tr><td>Command-K</td>
<td>连接到服务器</td>
</tr><tr><td>Command-L</td>
<td>为所选项制作替身</td>
</tr><tr><td>Command-N</td>
<td>新建 Finder 窗口</td>
</tr><tr><td>Command-Shift-N</td>
<td>新建文件夹</td>
</tr><tr><td>Command-Option-N</td>
<td>新建智能文件夹</td>
</tr><tr><td>Command-O</td>
<td>打开所选项</td>
</tr><tr><td>Command-R</td>
<td>显示(替身的)原身</td>
</tr><tr><td>Command-T</td>
<td>在当前 Finder 窗口中打开单个标签时显示或隐藏标签栏</td>
</tr><tr><td>Command-Shift-T</td>
<td>显示或隐藏 Finder 标签</td>
</tr><tr><td>Command-Option-T</td>
<td>在当前 Finder 窗口中打开单个标签时显示或隐藏工具栏</td>
</tr><tr><td>Command-V</td>
<td>将您放在剪贴板上的文本副本粘贴到当前位置。</td>
</tr><tr><td>Command-Option-V</td>
<td>将您放在剪贴板上的文本从其原始位置移动到当前位置。</td>
</tr><tr><td>Command-Option-Y</td>
<td>查看选中文件的快速查看幻灯片。</td>
</tr><tr><td>Command-1</td>
<td>以图标显示</td>
</tr><tr><td>Command-2</td>
<td>以列表方式显示</td>
</tr><tr><td>Command-3</td>
<td>以分栏方式显示</td>
</tr><tr><td>Command-4</td>
<td>以 Cover Flow 方式显示(Mac OS X v10.5 或更高版本)</td>
</tr><tr><td>Command-逗号 (,)</td>
<td>打开 Finder 偏好设置</td>
</tr><tr><td>Command-左中括号 ([)</td>
<td>前往上一文件夹</td>
</tr><tr><td>Command-右中括号 (])</td>
<td>前往下一文件夹</td>
</tr><tr><td>Command-上箭头</td>
<td>打开包含当前文件夹的文件夹</td>
</tr><tr><td>Command-Control-上箭头</td>
<td>在新窗口中打开包含当前文件夹的文件夹</td>
</tr><tr><td>Command-下箭头</td>
<td>打开高亮显示的项目</td>
</tr><tr><td>右箭头(以列表视图显示)</td>
<td>打开所选文件夹</td>
</tr><tr><td>左箭头(以列表视图显示)</td>
<td>关闭所选文件夹</td>
</tr><tr><td>Option-点按显示三角形(以列表视图显示)</td>
<td>打开所选文件夹内的所有文件夹</td>
</tr><tr><td>Option-连按</td>
<td>在单独窗口中打开文件夹,并关闭当前窗口</td>
</tr><tr><td>Command-连按</td>
<td>在单独标签或窗口中打开文件夹</td>
</tr><tr><td>Command-点按窗口标题</td>
<td>查看包含当前窗口的文件夹</td>
</tr><tr><td>Command-Delete</td>
<td>移至废纸篓</td>
</tr><tr><td>Command-Shift-Delete</td>
<td>清倒废纸篓</td>
</tr><tr><td>Command-Shift-Option-Delete</td>
<td>清倒废纸篓(不显示确认对话框)</td>
</tr><tr><td>空格键(或 Command-Y)</td>
<td>快速查看选中的文件</td>
</tr><tr><td>拖移时按 Command 键</td>
<td>将拖移的项目移至其他宗卷或位置<br>
(按住按键时指针会改变)</td>
</tr><tr><td>拖移时按 Option 键</td>
<td>拷贝拖移的项目<br>
(按住按键时指针会改变)</td>
</tr><tr><td>拖移时按 Command-Option 组合键</td>
<td>对拖移的项目赋予别名<br>
(按住按键时指针会改变)</td>
</tr></tbody></table>
</div>
</div>
<!-- ------------------------ Windows terminal command ------------------------ -->
<div class="col-md-12 nav" id="Windows">
<div class="page-header"><h4>Windows DOS/terminal command</h4></div>
<h6>Provide you with a list of currently open ports and related IP addresses. You’ll also be told what state the port is in – listening, established or closed.</h6>
<pre class="prettyprint">
netstat -an</pre>
<h6>Provide a current list of all tasks running on your PC</h6>
<pre class="prettyprint">
Tasklist</pre>
</div>
<div class="col-md-12 nav" id="showHtml">
<div class="page-header"><h4>HTML Template<li></h4></div>
<pre class="prettyprint" id="myHtml"><i class="fa fa-spinner fa-spin"></i></li></pre>
</div>
</div>
</div>
<div class="text-center"><a id="UserAgent">UserAgent</a></div>
<div class="met-online">
<ul class="blocks list-unstyled">
<li class="go_to_top"><button type="button" class="btn btn-icon btn-info">
<i class="fa fa-chevron-up" aria-hidden="true"></i></button>
</li>
</ul>
</div>
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/highlight.js/9.12.0/highlight.min.js"></script>
<script src="http://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script>
$(document).ready(function() {
$(".go_to_top").click(function() {
$("html,body").animate({
'scrollTop': '0px'
}, 300)
});
$(window).scroll(function() {
var top = $(document).scrollTop();
var g = $(".met-online");
if (top > 100 && g.is(":hidden")) {
g.fadeIn();
} else if(top < 100 && g.is(":visible")) {
g.fadeOut();
}
});
$("#UserAgent").html(navigator.userAgent);
$(document).on('click', 'a[href^="#"]', function (event) {
event.preventDefault();
$('html, body').animate({
scrollTop: $($.attr(this, 'href')).offset().top
}, 500);
});
$('pre').each(function(i, block) {
hljs.highlightBlock(block);
});
$('#showHtml').on('click', function() {
$.ajax({
url: "template.html",
cache: false,
success: function(html){
$("#myHtml").html("<xmp>"+html+"</xmp>");
}
});
});
});
</script>
</body>
</html>