Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Goals: Introduction to using a Terminal

  • What does a prompt look like?

  • General syntax of shell command.

  • Commands/options are case sensitive.

  • Getting Help:

    • Man pages (man)

    • Options: <command> --help


Table of Contents
minLevel1
maxLevel1
outlinefalse
stylenone
typelist
printabletrue

Login

  1. Open up Chrome

  2. Navigate to: MedicineBow OnDemand

  3. Type in your provided username and password. Usually this will be your UWYO username and password, unless you are using an assigned training account.

  4. Authenticate using your preferred 2 factor method (expandable directions below):

Expand
titleDuo Mobile push:

If you usually get a two-factor push to your phone, just hit enter after entering your username and password, then complete authentication by approving the push on your device.

pushapprove.png

Expand
titlePhone Call:

Without hitting enter after typing in your username and password, in the password text box, append a comma (,) to the end of your password, then append phone as shown in the screenshot below:

You should get a phone call on your main phone # associated with your two factor account. Answer this call and hit # to approve access.

Expand
titleDuo Passcode

If you prefer to use a 2 factor passcode from your Duo Mobile app, without hitting enter after typing in your username and password, in the password text box, append a comma (,) to the end of your password, then append the multi digit passcode found in duo mobile as shown in the screenshot below:

Expand
titleYubikey:

Type in the account password, then, without hitting enter, append a comma (,) to the end of the password, then touch the light on the yubikey as shown in the screenshot and photo below:

Then hit the green light on your yubikey to authenticate:

yubikey.jpeg


Start MedicineBow Shell Access

Excerpt
nameStarting Shell Access in OnDemand
Click shell.png

image-20240731-224939.png


The Command-Line Prompt

image-20240522-171748.png

Syntax of a Shell Command

image-20240522-172219.png

Case Sensitive

Code Block
# Lists what is in the current location.
[arcc-t05@blog1 ~]$ ls
Desktop  Documents  Downloads
# Throws an error.
[arcc-t05@blog1 ~]$ LS
-bash: LS: command not found
Filename  ≠  FiLeNaMe  ≠  FILENAME

 

Code Block
Filename  ≠  FiLeNaMe  ≠  FILENAME

Getting Help: man

Code Block
[arcc-t05@blog1 ~]$ man ls
LS(1)                                     User Commands                                     LS(1)
NAME
       ls - list directory contents
SYNOPSIS
       ls [OPTION]... [FILE]...
DESCRIPTION
       List  information about the FILEs (the current directory by default).  Sort entries alpha‐
       betically 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 ..
       ...
Manual page ls(1) line 1 (press h for help or q to quit)

Getting Help: <command --help>

Code Block
[arcc-t05@blog1 ~]$ 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 ..
      --author               with -l, print the author of each file
  -b, --escape               print C-style escapes for nongraphic characters
      --block-size=SIZE      with -l, scale sizes by SIZE when printing them;
                               e.g., '--block-size=M'; see SIZE format below
  -B, --ignore-backups       do not list implied entries ending with ~

Getting Help: Options

Typically, options can have a:

  • short-name: “-a”:

    • Single letter following a single “-

  • long-name: “--all”: 

    • More descriptive word after two dashes “--

Short options can be grouped: 

  • ls -a –l” can be shortened to “ls –al


Single vs Multiple Lines

Code Block
[arcc-t05@blog1 ~]$ ls -al ~
[arcc-t05@blog1 ~]$ ls \
> -al \
> ~

Exercises

Questions:

  1. Is there a difference between running ls versus ls -al?

  2. How can you find out what the –al options do?

  3. What does the pwd command do?

  4. From the command line, what happens if you press the up/down arrow keys?


Answers(1)

1: Is there a difference between running ls versus ls -al?

Code Block
[arcc-t05@blog1 ~]$ ls
Desktop  Documents  Downloads
[arcc-t05@blog1 ~]$ ls -al
total 76
drwxr-x---   8 arcc-t05 arcc-t05  4096 Oct  3 13:57 .
drwxr-xr-x 925 root     root     32768 Sep 27 16:21 ..
-rw-------   1 arcc-t05 arcc-t05   212 Sep 12 15:44 .bash_history
-rw-r--r--   1 arcc-t05 arcc-t05    18 Aug 10 17:00 .bash_logout
-rw-r--r--   1 arcc-t05 arcc-t05   141 Aug 10 17:00 .bash_profile
-rw-r--r--   1 arcc-t05 arcc-t05   376 Aug 10 17:00 .bashrc
drwx------   3 arcc-t05 arcc-t05  4096 Sep 12 11:36 .config
drwxr-xr-x   2 arcc-t05 arcc-t05  4096 Aug 10 17:00 Desktop
drwxr-xr-x   2 arcc-t05 arcc-t05  4096 Aug 10 17:00 Documents

Answers(2)

2: How can you find out what the –al options do?

  • Use man ls or ls --help

  • -a, --all do not ignore entries starting with .

  • -l use a long listing format

  • Options are also case sensitive:

    Code Block
    [arcc-t05@blog1 ~]$ ls -A
    .bash_history  .bash_profile  .config  Documents  .emacs     .kshrc    .mozilla  .zshrc
    .bash_logout   .bashrc        Desktop  Downloads  .esd_auth  .lesshst  .ssh

Answers(3, 4)

3: What does the pwd command do?

  • Use man pwd or pwd --help

  • pwd - print name of current/working directory

4: From the command line, what happens if you press the up/down arrow keys?

  • Steps through the previous commands you’ve typed.


 Next Steps