# NSCI 580A4 fall 2017

### Sidebar

NSCI 580A4

Instructors
Tai Montgomery
Erin Nishimura

wiki:options2016

–> Quiz
–> Assignment
–> Further Exercises
–> Canvas
–> Summit

# OPTIONS

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 do the same thing…

$ls -a$ls --all

And these commands 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 ls:

• Using Finder/Explorer, navigate to the location where you downloaded the file.
• Double click on the .tgz file to decompress it.
• If you need to, move the resulting expanded directory and its contents to a location you can easily manipulate in the terminal.
• Open your terminal and navigate (cd, pwd, ls) to the directory 160825_options_ex.

Exercise: Try executing ls commands:

• Convince yourself that ls -a and ls --all do the same thing.
• Try ls -alh
• Which combination of ls options 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    44K Aug 24 19:37 dm6_chrom_sizes.txt