Command Line Arguments and Options

  • Some options can be specified by a single dash and a single character, other options require two dashes and a multi-character (verbose) description.

  • Formats can also be combined, by following some rules:

    • one character options can be merged

    • multi-character formats cannot be combined

ls command example

ls --help
	Usage: ls [OPTION]... [FILE]...
	List information about the FILEs (the current directory by default).
	Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.
	
	Mandatory arguments to long options are mandatory for short options too.
	  -a, --all                  do not ignore entries starting with .
	  -A, --almost-all           do not list implied . and ..
	[...]
	  -I, --ignore=PATTERN       do not list implied entries matching shell PATTERN
	  -k, --kibibytes            default to 1024-byte blocks for disk usage;
	                               used only with -s and per directory totals
	  -l                         use a long listing format
	  -L, --dereference          when showing file information for a symbolic
	                               link, show information for the file the link
	                               references rather than for the link itself
	  -m                         fill width with a comma separated list of entries
	  -n, --numeric-uid-gid      like -l, but list numeric user and group IDs
	[...]
  • ls -al - Single character options:

  • ls --all -l - Multi character options:

  • ls -I - use ignore pattern option:

πŸ“Œ Pay attention to option arguments when combining more single character options. It is better to use the long format option.


Last updated

Was this helpful?