The shell is a command line interface to your computer.
The shell can be used to
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.bash shell.RStudio’s Tools menu provides the Terminal option for starting a shell terminal.
Terminal refers to the graphical user interface; the program running in a terminal is a shell.
bash/tcsh Commandshostname 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. BE CAREFUL IF THE FILES ARE UNDER VERSION CONTROL!
rm, rmdir can be used to remove files and directories; BE VERY CAREFUL WITH THESE!!!
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 &Some Programs can take command line arguments, often names of files to process.
To start RStudio and open a file hw1.Rmd:
rstudio hw1.Rmd &You can find out using the shell command
echo $SHELLFor most simple things it doesn’t matter.
On the CLAS systems you can change your default shell at https://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