
さまざまなオプション/フラグの意味をどのように理解しますか?
たとえば、
1) - ここではどういう意味ですかuname -a
?-a
2) - ここではどういう意味ですかpyang -f
?-f
これらの使い方を教えてくれる参照/文書があるかどうか疑問に思います。明確にしてください。
答え1
ほとんどすべてのLinuxコマンドと同様に、最も高速で簡単な最初のステップは、コマンドに "--help"を追加することです。これは一般的に十分なほど良い要約を提供します。
より詳細な情報が必要な場合は、manコマンドを選択することをお勧めします。
たとえば、
$uname --help
Usage: uname [OPTION]...
Print certain system information. With no OPTION, same as -s.
-a, --all print all information, in the following order,
except omit -p and -i if unknown:
-s, --kernel-name print the kernel name
-n, --nodename print the network node hostname
-r, --kernel-release print the kernel release
-v, --kernel-version print the kernel version
-m, --machine print the machine hardware name
-p, --processor print the processor type (non-portable)
-i, --hardware-platform print the hardware platform (non-portable)
-o, --operating-system print the operating system
--help display this help and exit
--version output version information and exit
答え2
UNIX/Linux シェルには 4 種類のコマンドがあります。
1. executables: compiled binaries or scripts
2. shell builtin commands
3. shell functions
4. aliases
不明なコマンドが表示された場合は、まずその種類を確認してください。各タイプのいくつかの例を見てみましょう。
type <command> # indicates the commands type
--------------
type find # find is /usr/bin/find --> executables
type cd # cd is a shell builtin
type dequote # dequote is a function
type ls # ls is aliased to 'ls --color=auto'
コマンドタイプ情報を使用すると、コマンドのヘルプ、説明、および使用方法を取得できます。オプション:
<command> --help # help for executables --> find --help
help <command> # help for shell builtins --> help cd
man <command> # manual page for the specific command
次のコマンドは情報収集にも役立ちます。
whatis <command> # display a very brief description of the command
which <command> # display an executables location
上記の例ではls
エイリアスですが、ls
実際には何ですか?
whatis ls
help ls # doesn't work --> ls is not a shell builtin command
ls --help # works --> ls is an executable / compiled binary
which ls # /bin/ls --> ls is an executable / compiled binary
探索するコマンドは何千ものあります。
ls /bin # list a few executables
ls /usr/bin # list more executables
enable -p # list all available shell builtin commands
declare -f # list all defined functions
alias # list all defined aliases
uname
それでは、コマンドを確認してみましょう。
type uname # uname is /bin/uname --> executable
whatis uname
which uname
uname --help # see the meanings of the options, e.g. -a
man uname # read the manual page for uname
コマンドで同じようにしてくださいpyang
...