| What Is the Terminal? Understanding the Shell and Command Line Interface |
|
The Terminal (The Window)
terminal emulatoraccepts keystrokes and displays text on screen does not process commands only forwards commands and receives responses The Shell (The Brain)
app called the Shell runs in the terminalShell is the command interpreter text uses Bash shell (Bourne Again SHell) The Command Line (The Concept)
CLI provides interaction with computer using text
The Restaurant Analogy
GUI is the menulimited to what is offered the Shell is the head chef terminal provides precision and power |
| Opening and Using the Terminal |
|
Focus
terminal only listens when it has focus
The Interaction Loop
terminal uses RELP (Read, Evaluate, Print, Loop)
|
| Understanding the Prompt: User, Host, and Working Directory |
standard Ubuntu prompt
username@computername:~$username is active user account @ separates username from the computername compuername name of host computer location - current location in file system the ~ (tilde) represnts the home directory privilege level
|
| Your First Commands: echo, date, whoami, pwd |
|
echo
simplest commandrepeats what was entered back to the screen date
terminal replies with current day, date, time and timezone
Mon Oct 27 10:30:15 EDT 2025 whoami
system returns the current usernameodd because the prompt already contains the username pwd (Print Working Directory)
can't always see the full path in the promptreturns current directory /home/yourusername |
| Command Structure: Commands, Options, and Arguments |
most commands use this structure
Command + Options + Arguments
The Basic Command
lslists files in current directory Adding an Argument
ls /binlists files in the /bin directory Adding an Option
ls -loption -l calls for 'long format' returns a list with
Putting it All Together
ls -l /bincombined command list (verb) the contents of the /bin folder (noun) using the long format (adverb) Short vs Long Options
short options use a single hyphenlong options use two hyphens Case Sensitivity
Linux is case-sensitive
|
| Getting Help: man Pages, --help, and info |
|
Linux has thousands of commands sysadmin's skills are not knowing the answer but knowing how to find the answer Linux has built-in encyclopedia called Manual Pages (man pages) Using man
to learn more about the ls command enter
man lsoutput will show
to exit the manual page press the q key (Quit) Using --help
man page can be too detailedfor a quick cheat sheet most commands support a --help option date -- helpproduces quick summary of how to use the command Using whatis
whatis provides a one sentence description of the command's function
whatis calprovides the result cal (1) - displays a calendar and the date of Easter. |
| Command History and Shortcuts: Arrow Keys, history, and Ctrl Combinations |
|
lazy system administrators are good system administrators should never type the same long command twice if it can be avoided the terminal has several features designed to save keystrokes The Up Arrow (Time Travel)
allows cycling through command history
The history Command
historyreturns a numbered list of past commands to rerun listed command #50 enter !50 Tab Completion (The Superpower)
the shell is smart
with a file
if multiple folders start with Do (Documents and Downloads) nothing will happen shell doesn't know the user's intent pressing Tab twice and all options will be listed type next letter (c or w) and press Tab again shell will complete the command Control Key Options
a few shortcuts
|
| Best Practices for Terminal Use |
to be safe and efficient
|
| Summary |
|