Up to this point, we have used commands without arguments and commands with arguments. In addition to this, we can execute commands with options. Options are bells and whistles we can append to our commands to customize the way the shell interprets the commands.
Here are a few options for the command
ls courtesy of The Linux Command Line :
Options are added after the command itself but before any arguments.
command [options] [arguments]
command [options] <arguments>
 – optional. The command will work with or without these
<> – required. The command requires these arguments
Short options take one dash. Long options take two dashes
Further, short options can often be lumped together.
For example, the following commands should do the same thing…
$ ls -a $ ls --all
And these commands should do the same thing…
$ ls --all --human-readable -l $ ls -a -h -l $ ls -ahl
Exercise: Let's obtain a dataset to allow us to explore
Quick Tip: If double clicking on the “tarball” doesn't open it, try using tar on the command line:
$ tar -zxvf 160825_options_ex.tgz
ls) to the directory
Exercise: Try executing
ls -a -l -h
lsoptions would you execute to list the contents in the following order and format?:
total 184 -rw-r--r--@ 1 erinonish staff 99B Aug 24 19:38 ce11_chrom_sizes.txt -rw-r--r--@ 1 erinonish staff 800B Aug 24 19:51 README_download.txt -rw-r--r--@ 1 erinonish staff 1.4K Aug 24 19:39 mm10_chrom_sizes.txt -rw-r--r--@ 1 erinonish staff 11K Aug 24 19:41 hg38_chrom_sizes.txt -rw-r--r--@ 1 erinonish staff 23K Aug 24 19:42 danRer10_chrom_sizes.txt -rw-r--r--@ 1 erinonish staff 44K Aug 24 19:37 dm6_chrom_sizes.txt
Reading a book or a webpage about options can sometimes lead you astray. This is because different commands work differently across different linux “distros”. Sometimes the manual for a given command is more useful.
$ man ls
Use the SPACE bar to navigate through the manual pages.
Use Q to quit out of the manual pages.
I hate to tell you this, but sometimes the man pages are also inaccurate.