Learning Linux Basics Course & Labs
Working with Shell I
Introduction to Shell
In this lesson, we dive deep into the Linux shell and learn how to navigate directories, manage files, and execute commands using the Bash Shell. Whether you’re new to Linux or looking to sharpen your command-line skills, this guide provides a solid foundation.
Getting Started with the Command Line
The first chapter, "Working with the Shell, Part 1," introduces the command line interface. Although graphical user interfaces (GUIs) can be visually appealing, the command-line shell offers enhanced functionality and flexibility—an essential tool for any Linux system administrator.
The Linux shell acts as a mediator between you and the operating system. Commands entered into the shell are executed immediately, and the results are returned in the same window. Upon logging in, you are placed in your home directory, typically located under /home. For example:
- A user named Michael will have a home directory at
/home/Michael
. - Another user, Alan, will have a home directory at
/home/Alan
.
Your home directory serves as your personal workspace—a dedicated area for storing, retrieving, and managing your files and folders.
In the command line, your home directory is represented by the tilde symbol (~
). When you see ~
in your prompt, it indicates that you are currently in your home directory.
# Home Directory = ~ (tilde)
[~]$
Tip
Always check your current directory by observing the prompt, and use the pwd
command for confirmation.
Executing Commands
Interacting with Linux is as simple as typing a command into the shell. Each command usually corresponds to a program that performs a particular task. For example, the echo
command prints text to the screen. Running echo
without an argument produces no output:
[~]$ echo
[~]$
To see text output, provide an argument as shown here:
[~]$ echo Hello
Hello
[~]$
Arguments and Options
Many commands support additional input in the form of arguments or options to modify their behavior. For instance, to print "Hello" without a trailing newline, use the -n
option with echo
:
[~]$ echo -n Hello
Hello[~]$
Another useful command is uptime
, which displays how long the system has been running along with load information:
[~]$ uptime
19:18:51 up 19:48, 2 users, load average: 1.18, 0.49, 0.36
[~]$
Help is Available
If you are ever unsure about a command or its available options, refer to its help output (using command --help
) or consult the man pages.
Understanding Command Types
Linux commands are broadly categorized into two types:
Internal (Built-in) Commands
These commands are integrated into the shell. They include:cd
(change directory)export
mkdir
(make directory)pwd
(print working directory)
External Commands
These are separate binary programs or scripts residing on the system and may be installed by default or added later. A common example is themv
(move) command.
To verify whether a command is internal or external, use the type
command. For example, executing type echo
shows that echo
is a built-in command.
Conclusion
This lesson lays the groundwork for working with the Linux shell. As you continue, you will gain confidence in using commands, understanding options, and efficiently navigating the file system. Embrace the command line as your primary tool for effective system management and administration.
For further exploration, check out additional resources such as:
Happy exploring!
Watch Video
Watch video content