5. Shell basicsΒΆ
ShellΒΆ
Please read and understand the following questions:
Whatβs a shell?
What operations can you do with a shell?
What shells are there available?
How do you access the shell?
Whatβs a CLI, respectively a CLI tool?
Howβs a developer using the shell?
Howβs an engineer using the shell?
Important
Take 30 minutes to research and answer the questions, then discuss them with your coach.
TerminalΒΆ
Find the Terminal
on your Mac and open it. Letβs see if you can run the first command:
echo "Hello $USER"
This should output your username on the Terminal.
Hint
Alternatively you can also download iTerm 2 for a better & more advanced terminal.
Bash scriptingΒΆ
If you could output your username with the command above, read & start this Bash Scripting Tutorial for Beginners.
You need to understand the following concepts:
Relative and absolute paths (e.g.
/usr/local/bin/example
,bin/example
,../bin
)Displaying the current directory (i.e.
pwd
)Changing the directory (i.e.
cd
)Listing files and directories (i.e.
ls
)Getting the content of a file (e.g.
cat
,more
)Permissions (i.e. users, groups, permission modes
chown
,chgrp
,chmod
)Create output (i.e.
echo
,printf
)Redirect output (i.e.
>
)Variables (e.g.
$FOO_BAR
,${FOO_BAR}
)The UNIX shebang (i.e.
#!β¦
in the first line)Exit codes (e.g. what means
0
and non-0
,$?
)Executing commands & execute bash scripts
Hint
Weβre focusing on command line editors later on, especially vi(m)
.
Do everything in your installed editor instead.