Skip to main content
Alpha
This lesson is in the alpha phase, which means that it has been taught once and lesson authors are iterating on feedback.
The Unix Shell (pilot)
- 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.