2016年3月21日月曜日

Linuxコマンドの実行タイプ

I eke out a living なLinuxの知見を根本的にあらためるべく。初歩の初歩からお勉強やり直し。で、入門的な書籍やコンテンツをひっくり返してみると、

Linuxコマンドの実行タイプ

という概念からそもそも知らなかったことに、今さらながらに気づかされた。

・shellの組み込みコマンド

 そして外部を実行可能なファイルを指定する場合に

・環境変数pathに指定がある場合
・pathに指定が無く直接指定する場合

の、ツゴウ3パターン。それから操作に関しては、


入力補完
履歴の呼び出し
キーバインド(短縮入力)

といった機能がある。これらについて拡販を意図する側が「慣れない人にとってはたいへんかもしれないが習熟によって操作性が...」などと仰ったりもするようだが、ユーザビリティに対するご姿勢の根底が、前時代的である印象だ。

次にデータの抽象化について。ユーザは、データの抽象化によって、データの物理的な条件を指定する煩わしさから解放されているとのこと。なるほど。

VFSによって、ファイルのみならずドライブやデバイスなどの物理要素も抽象化される。ファイルフォーマット、VFATやISO、EXt2/3/4などの差異もVFSによって抽象化? される。見方を変えると、このような思想が根底にあるので、外部ストレージを典型に、ディレクトリのどこかへマウントがmust。


まー、自分がLinuxのどのレベルで引っかかっていることか、痛々しくなる。幸い絶対に再発しない一度きりの痛々しさなので乗り越えてしまえば楽勝だぜ AWESOME!


続いてネットワーク編から。ネットワークの人でもちゃんと覚えているかどうかはかなりアヤシイいろいろ。

ICMPタイプ
0 Echo Reply
3 Destination Unreachable
8 Echo Request
11 Time Exceeded


ICMPタイプ3の詳細一部
0 Network Unreachable
1 Host Unreachable
2 Protocol Unreachable
3 Port Unreachable
6 Destination Network Unknown
7 Destination Host Unknown
13 Communication Administratibely Prohibited by Filtering

tracerouteが無い時はtracepathを試す。
PMTU…Path MTU 経路MTU
asymm=asymmetric 往路と復路が異なる場合

ifconfigはウインドウズふうならipconfig

もはや標準ではないがいちおう座学としてtelnet
クライアントはtelnet リモートホストにin telnetd
前提としてリモートホストにinetdeやxinitd
これらの確認のコマンドは
ps aux | grep inetd | grep v
ps aux | grep xinetd | grep v

だそうで。実際にやってみると、

# ps aux | grep inetd
root      2258  0.0  0.0 112644   964 pts/0    S+   14:49   0:00 grep --color=auto inetd

ここまではわかるが、

# ps aux | grep inetd | grep v

# ps aux | grep inetd | grep --v
grep (GNU grep) 2.20
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Mike Haertel and others, see <http://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.
#

はて?vオプションの意味が全くわからん。grep のヘルプを見てみると

# grep --help
Usage: grep [OPTION]... PATTERN [FILE]...
Search for PATTERN in each FILE or standard input.
PATTERN is, by default, a basic regular expression (BRE).
Example: grep -i 'hello world' menu.h main.c

Regexp selection and interpretation:
  -E, --extended-regexp     PATTERN is an extended regular expression (ERE)
  -F, --fixed-strings       PATTERN is a set of newline-separated fixed strings
  -G, --basic-regexp        PATTERN is a basic regular expression (BRE)
  -P, --perl-regexp         PATTERN is a Perl regular expression
  -e, --regexp=PATTERN      use PATTERN for matching
  -f, --file=FILE           obtain PATTERN from FILE
  -i, --ignore-case         ignore case distinctions
  -w, --word-regexp         force PATTERN to match only whole words
  -x, --line-regexp         force PATTERN to match only whole lines
  -z, --null-data           a data line ends in 0 byte, not newline

Miscellaneous:
  -s, --no-messages         suppress error messages
  -v, --invert-match        select non-matching lines
  -V, --version             display version information and exit
      --help                display this help text and exit

Output control:
  -m, --max-count=NUM       stop after NUM matches
  -b, --byte-offset         print the byte offset with output lines
  -n, --line-number         print line number with output lines
      --line-buffered       flush output on every line
  -H, --with-filename       print the file name for each match
  -h, --no-filename         suppress the file name prefix on output
      --label=LABEL         use LABEL as the standard input file name prefix
  -o, --only-matching       show only the part of a line matching PATTERN
  -q, --quiet, --silent     suppress all normal output
      --binary-files=TYPE   assume that binary files are TYPE;
                            TYPE is 'binary', 'text', or 'without-match'
  -a, --text                equivalent to --binary-files=text
  -I                        equivalent to --binary-files=without-match
  -d, --directories=ACTION  how to handle directories;
                            ACTION is 'read', 'recurse', or 'skip'
  -D, --devices=ACTION      how to handle devices, FIFOs and sockets;
                            ACTION is 'read' or 'skip'
  -r, --recursive           like --directories=recurse
  -R, --dereference-recursive
                            likewise, but follow all symlinks
      --include=FILE_PATTERN
                            search only files that match FILE_PATTERN
      --exclude=FILE_PATTERN
                            skip files and directories matching FILE_PATTERN
      --exclude-from=FILE   skip files matching any file pattern from FILE
      --exclude-dir=PATTERN directories that match PATTERN will be skipped.
  -L, --files-without-match print only names of FILEs containing no match
  -l, --files-with-matches  print only names of FILEs containing matches
  -c, --count               print only a count of matching lines per FILE
  -T, --initial-tab         make tabs line up (if needed)
  -Z, --null                print 0 byte after FILE name

Context control:
  -B, --before-context=NUM  print NUM lines of leading context
  -A, --after-context=NUM   print NUM lines of trailing context
  -C, --context=NUM         print NUM lines of output context
  -NUM                      same as --context=NUM
      --group-separator=SEP use SEP as a group separator
      --no-group-separator  use empty string as a group separator
      --color[=WHEN],
      --colour[=WHEN]       use markers to highlight the matching strings;
                            WHEN is 'always', 'never', or 'auto'
  -U, --binary              do not strip CR characters at EOL (MSDOS/Windows)
  -u, --unix-byte-offsets   report offsets as if CRs were not there
                            (MSDOS/Windows)

'egrep' means 'grep -E'.  'fgrep' means 'grep -F'.
Direct invocation as either 'egrep' or 'fgrep' is deprecated.
When FILE is -, read standard input.  With no FILE, read . if a command-line
-r is given, - otherwise.  If fewer than two FILEs are given, assume -h.
Exit status is 0 if any line is selected, 1 otherwise;
if any error occurs and -q is not given, the exit status is 2.

Report bugs to: bug-grep@gnu.org
GNU Grep home page: <http://www.gnu.org/software/grep/>
General help using GNU software: <http://www.gnu.org/gethelp/>
#


grepひとつについてもこれだけ知らん。ますますヤバイ。


次に、コマンドそのものを確認するに type。


# type cd
cd is a shell builtin

こういった確認が必要である(必要だった)こと自体に、レガシーというか、何か染みついたものというか、を感じるのだが恐ろしい見当違いの可能性が高いことは言うまでもない。




0 件のコメント:

コメントを投稿