- I was wondering where I can find and learn some general idea about the command line interface used in Linux and bash?
As to now, I have found pieces of such information only from experience, such as
- For cat, without any further
arguments, it accepts stdin input.
But you may explicitly specify STDIN
using the special name
-, and both ways are equivalent.catcan also accept a filename ascat filename. So is-meant to fill in an argument supposed for filename? Is this usage of-also common for other commands? - In
chardet <<<somestring,<<<means a string is used as stdin, the same asecho somestring | chardet. Is this usage of<<<also common? - In
cut -c 1-3,20,25- employees, is the way1-3,20,25-to specify a range of numbers for an argument also common in other commands?
- For cat, without any further
arguments, it accepts stdin input.
But you may explicitly specify STDIN
using the special name
- Last but not least, are these general ideas common to just within bash, or within Linux and Unix, or within software using getopt as command line parser?
|
|
||||
|
|
|
I recommend reading a book on unix or Linux shell and command line usage, in order to learn basic usage and get a feeling for some advanced features. Then you can turn to reference documentation. The usage of specific commands is described in their manual. The POSIX standard specifies a minimum set of commands, options and shell features that every unix system is supposed to support. Most current systems by and large support POSIX:2004 (also known as Single UNIX version 3 and the Open Group Base Specifications issue 6). GNU software (the utilities found on Linux) often have many extensions to this minimum set. There are common conventions for command-line arguments. POSIX specifies utility conventions that most utilities follow, in particular:
GNU utilities and others also support “long options” of the form Redirection is a shell feature, so you'll find it in your shell's manual. |
|||
|
|
|
I would suggest looking into Unix in a Nutshell by O'rielly or merely just googling a bash tutorial. Bash is aka Bourne Again SHell. The other shells were SH, CSH, and KSH if I remember correctly. CSH is based on C. I would also recommend learning C and Perl or Python, they help speed things up substantially. |
|||
|
|
Yes.
I'm not really sure if there is some standard for it, but some GNU tools (example: tar) use - for this purpose.
It just seems to be natural. I'm sure you can use this in most of GNU tools - they are mostly following same conventions, but I'd check manual for any non-GNU tool. |
|||
|
|