I am working on linux, and came across instances netstat -an and netstat -na.
Are they both same.what are their significance
I am working on linux, and came across instances netstat -an and netstat -na.
Are they both same.what are their significance
Both having the same effect.
Most of the programs found on a GNU/Linux system, as netstat
, using the glibc function getopt
for parsing their command line arguments. That's why you have to look at the documentation of GNU getopt
, especially it's argument syntax which follows the POSIX standard. Here it is: http://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html
However, not all programs are using this syntax. Especially shell scripts or programs written in a language that has no bindings for GNU getopt
. This means the question can't be answered in general, you need to check the man page if you want to know the exact argument syntax for a certain program. But netstat
uses getopt
.
It doesn't matter how you pass the arguments to below,
while ((i = getopt_long(argc, argv, "MCFA:acdegphinNorstuVv?wxl", longopts, &lop)) != EOF)
switch (i) {
...
case 'a':
flag_all++;
break;
case 'n':
flag_not |= FLAG_NUM;
break;
...
Just the cases a
& n
are enabled which is processed later with the respective flags set.