Versions Compared

Key

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

...

Excerpt
nameStarting Shell Access in OnDemand
Click shell.png

image-20240731-224939.png

...

The Command-Line Prompt

...

Your Prompt

Note

From now on, your prompt will take the form: [<username>@<hostname> ~]$

where:

  • <username> is YOUR username or potentially arcc-txx if you are using a training account.

  • <hostname> will take the form of mblog1, mblog2 - it should have log within the name to indicate you are using a login node - this will be covered within the Intro to HPC workshop, specifically What is HPC?

...

Syntax of a Shell Command

...

Case Sensitive

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

...

Getting Help: man

Code Block
[arcc-t05@blog1<username>@<hostname> ~]$ 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<username>@<hostname> ~]$ 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 ~

...

Single vs Multiple Lines

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

...

Exercises

...

Expand
titleAnswer

Yes. The ls command is used to list files.

The characters after the '-' are flags, which select options associated with the command.

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

...

Expand
titleAnswer
  • Use man ls or ls --help

    • -a is to specify “all”, which will include hidden files.

    • -l is to specify “long” which gives us the “long format” output about the listed files.

  • Options are also case sensitive:

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

...