The shell is a command line interface to your computer.
The most common shells on Linux and MacOS are bash
and tcsh
.
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 and Shell options for starting 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.
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 &
echo $SHELL
You can find a bit more on the shell at https://happygitwithr.com/shell.html