This site is an archive; learn more about 8 years of OpenHatch.

[Devel] Bash Mission Proposal

Paul Bakulich paulbakulich at gmail.com
Wed Apr 27 07:16:02 UTC 2011


Hi awesome OpenHatch devel team,

I've worked on my Proposal for the Bash mission and here it is,
read through it and please give feedback.

____________________________________________________________________

Openhatch - Bash Terminal Mission

=== Mission Outline ===

The purpose of this training mission is to:

* Show you how to find a terminal, where you can enter commands
* Make you familiar with how to copy and paste in a terminal.
* Teach you the basics of typing commands in, and reading their output
* Help you find documentation on your computer about any linux command

Once you complete this mission, you should be capable of running linux
commands and reading their output, copying and pasting to and from the
terminal and using all the available built-in help tools.

If you don't know how to open a terminal, read the Hints document.

>> Now go onto the first mission -  Finding Your Username

=== Finding your Username ===

Your terminal probably looks something like:

(Create screenshot of empty terminal)

This breaks down into:

(username)@(hostname):(path) $

This is called the terminal prompt and it can be changed or customized
using a special parameter - $PS1. Learn more about bash parameters
here - {{ url http://mywiki.wooledge.org/BashGuide/Parameters }}

The prompt helps you know where you are on your system, if, for
example, you connect via SSH to another machine it will tell you where
you are on that remote machine.

Based on the break-down of the shell prompt above, what is your
username on your computer?

__________________________ (submit)

>> Right! Now the next mission - Using Top.

=== Using Top  ===

Okay, {{ username_the_person_entered_above }}!
Through your exceptional ability to learn things quickly you have been
allowed to
continue to the next mission.

Your mission, if you choose to accept it, is to use learn to use the
<em>top</em>command which displays what current processes are running
on your system and how much resources they are currently using.

Run <code>top -d 10</code>

To prove that you have successfully run top, copy the first 4 lines of
output to the area below - If you need help on how to copy the results
from the terminal, look at the HINTS - {{ url bash.mission.hints }}

<text area>
Answer: Pattern of usual top output.

>> Excellent, you have proven yourself worthy to advance to the next mission -Getting Help in a terminal


== Getting Help in a Terminal ==

Even world conquerors need help to enable them to fulfill their
desires, surprisingly, there are lots of ways of getting help in a
terminal.

Below we have 3 available help options for the program top, go ahead
and try them.

man top # man pages short for manual pages, enable you to read about
linux commands - to read about man itself use the command man man. To
exit man, type q.

top --help # A quick overview of the commands options.

interactive help - key h - while running top.
Interactive help is usually offered in more complex programs like vi,
less or man.

Using the above methods to find help on using top, describe which key
will allow you to limit tops results to 10 commands. HINT - use
interactive key h -

< input > submit
Answer: n

Extra Credit: Figure out what the -d flag for the previous mission was
for by copying the man pages description for that option (only one
line).

EXTRA CREDIT: <text area> submit
Answer: * 'd' - Delay time       3.0 seconds

>> Excellent, let's get you onto the next mission - Understanding the filesystem

>> EXTRA CREDIT - Valid: Wow, we have a exceptional hacker here - Let's get onto the next mission - Understanding the filesystem


== Understanding the filesystem ==

To learn more about your linux filesystem you need to be able to get
around it, below are the main commands which will enable you to join
our team to conquer the world...

You need to answer the following questions by using the man pages.

# list directory contents
<code>man ls</code>
Q:                  <input>

# change directory
<code>man cd</code>
Q:                  <input>

# print current working directory
<code>man pwd</code>
Q:                  <input>

# Change file or directory persmissions
<code>man chmod</code>
Q:                  <input>

# Change file or directory ownership
<code>man chown</code>
Q:                  <input>

# Change the file/s or directories group
<code>man chgrp</code>
Q:                  <input>

Phew, that was tough! But world domination isn't easy, right?

Now, one last question before you finally are prove yourself worthy of
our secret team...

Read the man page for the command <code>ls</code> -
<code>man ls</code>
Now copy the output for the option -s

<text area > submit
Answer: -S     sort by file size

Answers: All Q validated, otherwise tell user which one they got wrong
and a hint.

>> Whoa, excellent! You have successfully completed the beginner bash mission.

We hope that you have enjoyed this mission! Unfortunately, we just
found out that a virus has disabled our teams main server, and now we
can't invite you to our team to conquer the world.

But be sure to try the more advanced bash mission {{ mission not available }} -

Hopefully by the time you are finished it we will have repaired the
server that will enable you to join our secret team. -

PS. Please don't despair, the advanced bash mission will be created by
the awesome OpenHatch team shortly.


=== About BASH ===

Bash is a Unix shell written by Brian Fox for the GNU Project. The
name is an acronym, a pun and descriptive. As an acronym, it stands
for Bourne-again shell, referring to its initial conception as a free
software replacement for the Bourne shell (sh).[3][4][5] As a pun, it
expressed that objective in a phrase that sounds the same as born
again, a term for spiritual rebirth.[6][7] The name is also
descriptive of what it did, bashing together the features of sh, csh
and ksh.

Quote from: http://en.wikipedia.org/wiki/Bash_(Unix_shell)

Additional references:
The original document outlining the Bourne UNIX Shell, which the BASH
shell is based on. -
http://www.softlab.ntua.gr/facilities/documentation/unix/docs/sh.txt

A great beginners guide to the Unix SHELL -
http://linuxcommand.org/lts0010.php

The Online Man Page for BASH
http://tiswww.case.edu/php/chet/bash/bash.html

An awesome guide from Freenodes- IRC #bash channel
http://mywiki.wooledge.org/BashGuide

Advanced bash:
http://www.ibm.com/developerworks/linux/library/l-bash2/index.html
http://www.freeos.com/guides/lsst/


=== Hints ===

-- Get a terminal running --

Before you can proceed with this training mission, you'll
need to know how to open up a terminal.

If you are running a Linux or BSD system and you have menus, try going
to Applications->Utiltiies->Terminal. - In Ubuntu you will find
'terminal' under Accessories.
Otherwise, look for 'xterm', 'gnome-terminal', or 'konsole'

If you are running Mac OS X, there is a bundled terminal
you can use. To find it, open up the Finder, then look for the
Applications folder.
Look for the Utilities folder inside Applications; double-click the
Terminal program.

On Windows, install GitBash from
https://code.google.com/p/msysgit/downloads/list so that you have a
UNIX-like environment.

Once you open a terminal with a prompt  eg-
(username)@(hostname):(path) $ and a cursor, usually blinking, waiting
to accept input from you, you're ready to start.

-- Quitting programs that are not responding --

If you need to exit a program at any time you can use CTRL-C # Which
cancels the current running command.

-- Basic navigation in a terminal --

up - down # scroll through your command-line history
left - right # move cursor inside the command line text
CTRL+left / right # some terminals support jumping between words

SHIFT+INSERT # Copy to a terminal
Mouse middle-button-click - scroll-wheel # Copy into terminal with mouse

Left-click - highlight - # Copy some text

Usually the standard keyboard key combinations will work for copying
and pasting. There are however a couple of exceptions. When copying
within (or to and from) some terminal windows there are different key
combinations to use. For example, in gnome-terminal instead of Ctrl-c
and Ctrl-v (for copy and paste) you use Ctrl-shift-c and Ctrl-shift-v
for copying and pasting. This can be changed within the profile editor
in gnome-terminal (if you want this feature to echo the standard
combination.) Be aware, however, that if you copy text by selecting
via the left mouse you can not paste by using Ctrl-v. The Ctrl-v
combination (or Ctrl-Shift-v combination) only works in conjunction
with the Ctrl-c or Ctrl-Shift-c combinations. We recommend using GNU
Screen - link -
http://superuser.com/questions/138748/how-to-scroll-up-and-look-at-data-in-gnu-screen
- if you do not use a mouse.
There are some small programs that extend the terminal's copy & paste
options: http://linuxtidbits.wordpress.com/2008/02/22/command-line-to-clipboard/

NOTE: Once you have mastered this bash mission, a advanced bash
mission to cover even more awesome linux commands and concepts will
soon be available to complete your bash training, enabling you to
conquer the world - muhahaha.

PS. Please don't despair, the advanced bash mission will be created by
the awesome OpenHatch team shortly.

____________________________________________________________________


I hope this mission isn't too complicated.
I deliberately concentrated on getting the user to use the man pages
as much as possible to answer questions.

Let me know what you think, either by replying to this email, or by
adding a comment at http://openhatch.org/bugs/issue390.

I hope we can finish the bash mission by the end of the milestone, so
please be quick to reply.

Paul Bakulich.


More information about the Devel mailing list