2.4《想成为黑客,不知道这些命令行可不行》(Learn Enough Command Line to Be Dangerous)——小结
下Table 3本章重要命令小结
命令 | 描述 | 示例 |
- | :-: | :-:
|>
| 将输出内容重定向到指定文件中 |$ echo foo > foo.txt
|
|>>
| 将输出内容添加到指定问价中 |$ echo bar >> foo.txt
|
|cat <file>
| 在屏幕上输出文件内容 |$ cat hello.txt
|
|diff <f1> <f2>
| 比较文件1和2的差异 |$ diff foo.txt bar.txt
|
|ls
| 列出文件或目录 |$ ls hello.txt
|
|ls -l
| 以长列表形式列出文件或目录 |$ ls -l hello.txt
|
|ls -rtl
| 根据修改时间反转并以长表形式列出文件或目录 |$ ls -rtl
|
|ls -a
| 列出所有文件(包括隐藏文件) |$ ls -a
|
|touch <file>
| 创建空文件 |$ touch foo
|
|mv <old> <new>
| 给文件重命名|$ mv foo bar
|
|cp <old> <new>
| 复制文件到| $ cp foo bar
|
|rm <file>
| 移除(删除)文件 |$ rm foo
|
|rm -f <file>
| 强制移除文件|$ rm -f bar
|
练习
FRom faireſt creatures we deſire increaſe,
That thereby beauties Roſe might neuer die,
But as the riper ſhould by time deceaſe,
His tender heire might beare his memory:
But thou contracted to thine owne bright eyes,
Feed’ſt thy lights flame with ſelfe ſubſtantiall fewell,
Making a famine where aboundance lies,
Thy ſelfe thy foe,to thy ſweet ſelfe too cruell:
Thou that art now the worlds freſh ornament,
And only herauld to the gaudy ſpring,
Within thine owne bud burieſt thy content,
And tender chorle makſt waſt in niggarding:
Pitty the world,or elſe this glutton be,
To eate the worlds due,by the graue and thee.
在程序媛的路上,越走越用劲儿:)