01 - Shell
Shell
Collect some commands in bash I didn’t know before.
Navigating in shell
ls -l dir
drwxr-xr-x ...:
d:
tell thatmissing
is a dirrwx:
依次表示三方对 missing 文件的权利 -the owner of the file
、the owning group(users)
、others
x
表示 execute
Gets more info about a program’s args, inputs, outputs and how it works: use man
1 | man ls |
Connecting programs
Simplest: redirection is
< file
and> file
use
>>
to append to a file, this kind shines in the use of pipes. The|
operator lets you ‘chain’ programs such that the one’s output is the latter one’s input.
1 | missing:~$ ls -l / | tail -n1 |
Versatile and powerful tools
How does shell know that the file is supposed to be interpreted using sh
: shebang(Unix)
1 |
|
#
starts a comment in Bash!
even within double-quoted(")
strings has special meaning (?)
If surreptitious, chech shebang link.
Exercise
1 | tail -c 22 // shows the last 22 characters |
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 Sicilienne!
评论
Valine# ValineDisqus