Skip to main content
Beta
This lesson is in the beta phase, which means that it is ready for teaching by instructors outside of the original author team.
The Unix Shell
- The shell gives you the ability to work more efficiently by using
keyboard commands rather than a GUI.
- Useful commands for navigating your file system include:
ls
, pwd
, and cd
.
- Most commands take options (flags) which begin with a
-
.
- Tab completion can reduce errors from mistyping and make work more
efficient in the shell.
- The
/
, ~
, and ..
characters
represent important navigational shortcuts.
- Hidden files and directories start with
.
and can be
viewed using ls -a
.
- Relative paths specify a location starting from the current
location, while absolute paths specify a location from the root of the
file system.
- You can view file contents using
less
,
cat
, head
or tail
.
- The commands
cp
, mv
, and
mkdir
are useful for manipulating existing files and
creating new directories.
- You can view file permissions using
ls -l
and change
permissions using chmod
.
- The
history
command and the up arrow on your keyboard
can be used to repeat recently used commands.
-
grep
is a powerful search tool with many options for
customization.
-
>
, >>
, and |
are
different ways of redirecting output.
-
command > file
redirects a command’s output to a
file.
-
command >> file
redirects a command’s output to a
file without overwriting the existing contents of the file.
-
command_1 | command_2
redirects the output of the first
command as input to the second command.
-
for
loops are used for iteration.
-
basename
gets rid of repetitive parts of names.
- Scripts are a collection of commands executed together.
- Transferring information to and from virtual and local
computers.
- Spend the time to organize your file system when you start a new
project. Your future self will thank you!
- Always save a write-protected copy of your raw data.