Difference between revisions of "Shell"

From Coder Merlin
Line 5: Line 5:


{{MerlinMultipageExperienceNavBar}}
{{MerlinMultipageExperienceNavBar}}
== Change Your Password ==
When you first log on to the server you'll have been assigned a password.  You should change this password to something that is easy for you to remember but difficult for others to guess (or derive).  (A good summary article of how to select strong passwords may be found [https://www.fpainc.com/blog/password-guidelines-from-nist here].)
The program that you'll use to change your password is '''passwd'''.  It will prompt you three times. 
* You'll first enter your current password
* then the new password that you want to use
* and then finally, to ensure that you're entering the new password correctly, you'll be prompted a second time for the new password.
{{Hint|
Remember that when you enter the password, what you type '''will not be echoed to the terminal'''.  You'll just need to pretend that the your keypresses are being received.
}}
Change your default password to a strong password:
{{ConsoleLines|john-williams@codermerlin:~$ passwd<br/>
Changing password for john-williams.<br/>
(current) UNIX password:<br/>
Enter new UNIX password:<br/>
Retype new UNIX password:<br/>
passwd: password updated successfully
}}


== Display a Manual ==
== Display a Manual ==

Revision as of 10:23, 23 November 2021

Within these castle walls be forged Mavens of Computer Science ...
— Merlin, The Coder

Curriculum[edit]

ExercisesIcon.png
 Coder Merlin™  Computer Science Curriculum Data

Unit: Lab basics

Experience Name: Shell (W1002)

Next Experience: Help Me! (W1003)

Knowledge and skills:

  • §10.121 Demonstrate proficiency in managing files and processes using a command line interface

Topic areas: SSH clients; Linux; Bash

Classroom time (average): 60 minutes

Study time (average): 180 minutes

Successful completion requires knowledge: differentiate between a CLI and GUI; understand the purpose of a prompt and cursor; understand files, directories, and their organizational hierarchy; understand processes; understand the client-server model

Successful completion requires skills: ability to successfully navigate the file hierarchy; ability to create new, empty files; ability to create new text files; ability to append text to an existing file; ability to move and rename files and directories; ability to delete files and directories; ability to suspend and resume processes; ability to terminate processes; ability to successfully determine your location in the file hierarchy

This is a multi-page experience, consisting of the following pages. Be sure to visit them all in sequence. A navigation bar at the bottom of each page is available to assist you.


[[Shell/Alter Previous Commands, Shell/Change Your Password, Shell/Clear the Screen, Shell/Client and Server, Shell/Deleting a File, Shell/Directories, Shell/Directories Revisited, Shell/Display a Manual, Shell/Exiting the Shell, Shell/Files, Shell/First Connection, Shell/Jobs, Shell/Recall Previous Commands, Shell/Renaming a File, Shell/Tab Completion, Shell/Terminating a Partial Command, Shell/The Shell<ul><li>"]]" is not a number.</li> <!--br--><li>Some use of "" in your query was not closed by a matching "".</li></ul>|« Prior]]Shell : 1 of 17Next »


Display a Manual[edit]

Finally, let's try out one more very helpful command. If we want to learn more about a command we can read its manual. We do this with the command man. As an example, look at the man page for the emacs command. Type man emacs.

john-williams@codermerlin:~/Merlin$  man emacs

The screen will be filled with information about the emacs command. While a man page is displayed we can use the following keys to navigate:

  • Typing f will move us forward one page in the manual
  • Typing b will move us backward one page in the manual
  • Typing q will quit (exit the manual)

Exit the manual now.

Exiting the Shell[edit]

In general, there's no need to exit the shell. It's almost always sufficient to close your terminal emulator. An advantage to this approach is that the next time you connect to the server you'll be in exactly the same place where you left off. However, on rare occasions the terminal emulator can become "confused" and display characters in odd places. In such a case, there's still no need to exit; instead, use the reset command.

👀 See Also[edit]

📺 Videos[edit]

Bash Terminal Beginner's Guide
Linus Torvalds

📖 Texts[edit]

Help Me!
Shell

📚 References[edit]


Key Concepts[edit]

Key ConceptsKeyConceptsIcon.png
  • A client-server model is a means of distributing resources between the provider of a service and a consumer of that service, the client. The advantages of this model include:
    • Users don't need to personally possess the hardware and software required to implement the service
    • Users don't need to worry about installation and configuration
    • Users are able to access their data from anywhere in the world
    • The state of a users data remains consistent, regardless of how and from where they access the server
  • A shell is a user interface which provides access to an operating system’s services. There are two basic types of shells:
    • A command-line interface (CLI)
    • A graphical user interface (GUI)
  • A prompt lets you know that the server is ready and waiting for your input
  • A cursor is a flashing block which indicates where new characters will appear as you type
  • A file is either a destination or source for a stream of data
  • A process is a program that is being executed by the operating system
  • All files are integrated into a single, hierarchical structure called a directory
    • A directory provides a logical grouping of related files (and potentially other directories)
    • The top of this tree is called the root and is referred to by a slash (/)
    • A subdirectory is a directory contained within another directory, called the parent directory
    • On Unix systems, the file structure is logical rather than physical
    • A path describes an ordered transition through one or more directories on the way to a destination (either a directory or a file)
      • Paths which begin at the root (symbolized by the initial slash) are called absolute paths
      • All other paths are relative paths
    • Your home directory is indicated by a special symbol, the tilde (~)
    • Your working directory can be thought of as your current directory
    • The command pwd prints the working directory
    • The command mkdir creates a new directory
    • The command ls lists the contents of a directory
    • The command cd changes your working directory
    • The command pushd changes our working directory temporarily
    • The command popd returns us to our previous directory after executing pushd
    • The command tree displays a directory hierarchy
    • The command rmdir removes (deletes) a directory
  • The echo command echoes the argument to the output
  • The touch command creates a new, empty file, if such a file does not already exist. If such a file does already exist, the access and modification times will be set to the current time.
  • The greater-than symbol (>) can be used to redirect output to a file
  • Two greater-than symbols (>>) can be used to append output to a file
  • The cat command allows us to quickly view the contents of one or more files
  • The rm command is used to remove (delete) a file
  • The mv command is used to either move or rename a file
  • The clear command clears the screen
  • A program is an executable file which contains a series of instructions which can be executed by the computer
  • A process is a program which is being executed on the computer
  • The shell manages processes using jobs
  • The jobs command will list the current jobs associated with your shell
    • A job can be terminated by using the key sequence CONTROL-C
    • A job can be suspended by using the key sequence CONTROL-Z
    • A job can be resumed in the foreground with fg
    • A job can be resumed in the background with bg
  • The man command displays the contents of a manual
  • The reset command resets your terminal

Exercises[edit]

ExercisesExercisesIcon.png

Using pencil and paper, answer all questions in this experience.


After completing W1005:

  •  J1002  Create a journal and answer all questions in this experience. Be sure to include all sections of the journal, properly formatted.

After completing W1008:

  •  M1002-10  Complete  Merlin Mission Manager  Mission M1002-10.
  •  M1002-31  Verify your journal's conformance with  Merlin Mission Manager  Mission M1002-31.


Experience Metadata

Experience ID W1002
Next experience ID
Unit Lab basics
Knowledge and skills §10.121
Topic areas SSH clients
Linux
Bash
Classroom time 1 hour60 minutes <br />
Study time 3 hours180 minutes <br />
Acquired knowledge differentiate between a CLI and GUI
understand files, directories, and their organizational hierarchy
understand of the client-server model
understand processes
understand the purpose of a prompt and cursor
Acquired skill ability to append text to an existing file
ability to create new text files
ability to create new, empty files
ability to delete files and directories
ability to move and rename files and directories
ability to successfully determine location in the file hierarchy
ability to successfully navigate the file hierarchy
ability to suspend and resume processes
ability to terminate processes
Additional categories