Recording-2025-09-18T00:45:49.525Z
Overview of the Linux Shell
- The Linux shell is a command line interface (CLI) that enables text-based interaction between the user and the operating system.
- It is a program that runs commands you type and returns the output, acting as the intermediary between you and the OS.
- The shell is especially powerful for system administration and scripting; while a GUI may be more approachable for beginners, the shell offers deeper functionality and automation.
- This material focuses on the Bash shell, but also mentions other shells in general.
The Linux Shell and the Terminal
- When you log in, the first directory you land in is your home directory.
- Home directories live under /home and are named after the user; e.g., Michael and Alan.
- Michael's home directory: \text{/home/Michael}
- Alan's home directory: \text{/home/Alan}
- The home directory is private by default; other users cannot access your files or folders without permission.
- A home directory stores personal data in files and directories; think of it as a dedicated locker for each user.
- The home directory is represented by the tilde symbol (~) in the command line prompt and in path abbreviations.
- The prompt shown can be configured to display different information (host name, date, time, etc.); in the example, it shows the current working directory.
- The tilde (~) expands to the home directory in many shell environments; you can use it in commands, e.g., \text{cd ~} goes to the home directory.
- The concept of the home directory can be summarized as: the home directory path is \text{/home/username} and the symbol \sim represents it.
- Why the home directory matters: it provides a private space for each user to store personal data and configurations.
Interacting with the Shell: Commands, Arguments, and Options
- Interaction with the shell happens by typing commands; the shell executes a program and returns its output.
- The echo command prints a line of text to the screen.
- If you run echo with no arguments, it prints nothing because there is no input to echo.
- An argument is input to a command; for example, using
echo hello
prints the word "hello" on a new line. - Many commands require arguments to function, but some work without any arguments (e.g., uptime).
- Commands can have options (also called switches or flags) that modify their behavior. Options are typically a single letter preceded by a single hyphen; e.g., the -n option for echo prevents printing a trailing newline.
- Because there are many options, it is common to consult help or the manual pages for unfamiliar commands.
- Help sources include inline help (often via -h or --help) and the manual pages (man pages).
- The document introduces the idea that you will learn more about help options and man pages later in the course.
Command Types: Internal (Built-in) vs External
- Linux commands fall into two broad categories: internal (built-in) commands and external commands.
- Internal commands are part of the shell itself and come bundled with it.
- There are approximately 30 built-in commands.
- Examples of built-in commands mentioned in the transcript include: cd (change directory), export, and pwd (print working directory). The transcript also lists mkdir (make directory) as a built-in in that context, and it mentions uptime as an example that does not require arguments.
- External commands are binary executables or scripts located in standard filesystem locations (e.g., /bin, /usr/bin). They are usually installed by the distribution's package manager or can be created/installed by the user.
- To determine whether a command is internal or external, use the
type
command. - Example from the transcript:
echo
is a shell built-in, while mv
is an external command.
Help, Documentation, and Practical Guidance
- When working with unfamiliar commands, refer to built-in help or online documentation:
- Inline help: use
command -h
or