## What is a Shell

• The shell is a command line interface to your computer.

• The shell can be used to
• start and stop processes that run programs;
• create and delete files and directories (a.k.a folders);
• set environment variables;
• manage processes and process resources;
• The most common shells on Linux and MacOS are bash and tcsh.

• Windows provides the cmd shell and the Power Shell; bash is becoming available as well.
• cmd is very bare bones; Power Shell is more powerful.
• They provide similar facilities to the Linux/MacOS shells but under different names.
• If you install Git for Windows, which is recommended, you also get a light-weight version of the bash shell.
• RStudio’s Tools menu provides the Terminal and Shell options for starting a shell. The Shell option doesn’t work reiably on FastX.

## Some Basic bash/tcsh Commands

• hostname prints the name of the computer the shell is running on.

• pwd prints the current working directory.

• ls lists files in a directory:
• ls lists files in the current directory;
• ls foo lists files in a sub-directory foo;
• cd changes the working directory:
• cd or cd ~ moves to your home directory;
• cd foo moves to the sub-directory foo;
• cd .. moves up to the parent directory;
• mkdir foo creates a new sub-directory foo in your current working directory;

• mv moves and renames files.

• rm, rmdir can be used to remove files and directories; BE VERY CAREFUL WITH THESE!!!

## Running Programs from the Shell

• Typing the name followed by the Enter key runs the program and waits until it finishes.

• Typing the name followed by & and the Enter key runs the program in background and the shell returns immediately for your next command.

• This is useful for starting GUI programs from the shell; for example, to start RStudio on a Linux machine you could use

rstudio &

## Which Shell Are You Using on Linux?

• You can find out using the shell command

echo \$SHELL
• For most simple things it doesn’t matter.
• On the CLAS systems you can change your default shell at http://hawkid.uiowa.edu/. You may have to do this from on campus or over a VPN connection.

You can find a bit more on the shell at http://happygitwithr.com/shell.html