==============================================================================
                      LINUX Account Orientation
==============================================================================

******
RULE#1 in Linux:  Everything (e.g. the passwords, commands, filenames, 
directory names, etc) is CaSe SeNsItiVe!  So be careful when you type.
******

-----------------------------------------------------------------------------   
* Download/Install SSH in your home/office computer
-----------------------------------------------------------------------------   

  Want to practice Linux commands at home?  Follow this link to
  download a SSH (Secure Shell Client) called Putty:

  http://the.earth.li/~sgtatham/putty/latest/x86/putty.exe

  Putty does not need any installation so it will work with many
  restricted PC installations.  You can always google "Putty" to 
  get a copy of Putty ("putty.exe") from anywhere.

-----------------------------------------------------------------------------   
* Logging into your "vulcan.seidenberg.pace.edu" account

  - First launch PuTTY, and you should see a "Putty Configuration"
    window. Now fill in the following information: 
    
    * Host Name or IP address:  vulcan.seidenberg.pace.edu
    * Port: leave the default '22' there (SSH uses port 22)
    * Connection type:  leave the default SSH protocol checked.

    * Save Sessions:  You can optionally save a session name like:
      'vulcan' or 'vulcan.seidenberg.pace.edu' and click [Save].
      (The next time you login, you can just select the profile
       and click [Load].)

  - Now click [Open] to open an SSH session into vulcan.
    You should now see the following two prompts:

    * login as:  (now type in your username - it is case-sensitive)
    * Password:  type in your password carefully - it is case-sensitive)
      NOTE:  By design, your password will NOT be echoed back; you won't 
      see the characters on the screen as you type. If you make a
      mistake, just hit ENTER and you'll see the Password prompt again.


* Linux Directory-related Commands

  Once you are logged into vulcan, try the following (note the "$" is
  your Linux system prompt. Only type the commands after the "$" sign):

  $ ls
  (list directory - show what files/directories are in your directory now)

  It's possible that ls will show anything, because your home directory
  may be empty in the first place. We can try to create some directory first:

  $ mkdir docs
  (make --new-- directory)

  $ cd docs
  (change --current working-- directory)

  $ pwd
  ('print working directory' or think of it as 'present working directory')  
 
  $ cd ..
  (change directory to the parent directory)

  $ rmdir docs
  (remove directory) 

* File-related commands:

  $ ls 
  (show just the regular files, in short format)

  HINT:  Read Linux command man/manual pages by doing:  man [any_command_name]

  $ man ls
  ('man ls' will show you the 'man (manual) pages' for the 'ls'
  command.  It will show you everything you want to know about the 'ls'.
  Hit [SPACE] to advance to the next page, hit 'q' to get out of man.
  You can hit 'q' anywhere in the man pages and don't have to keep
  hitting the spaces till the end.)

  $ clear
  (clear the screen whenever it gets messy)

  $ ls -Fal
  (my preferred way of seeing "everything" in a directory)
 
  $ ls -a
  ('-a' will not hide files/directories starting with a dot '.'
   The dot files/directories are 'hidden' ones that won't show 
   in a typical 'ls')

  $ ls -l
  ('-l' will show the long format, including file date/owner/privilege,etc)

  $ ls -F
  ('-F' will give more hints, e.g. adding '/' to the end of directory names
   such that you can tell files from directories)

  $ ls -F -a -l
  (will be the same as 'ls -Fal', or 'ls -alF'...   You can combine and
   randomize the sequence of the command flags/switches.)

  $ ls -lS
  (will display long format, sorted by file/directory size.  Now do a couple 
   more 'man ls' to learn about different flags/switches for 'ls' and try 
   as many as you can!)

  Now we can create some text files using the 'nano' editor: 

  $ nano 
  (you can invoke 'nano' without giving it a filename.  But before you
   exit from nano by typing Ctrl-X, you will be asked if you want to 
   save the current buffer/content to a file.)

  $ nano notes1.txt
  (create a new file called notes1.txt using nano)

  $ cp notes1.txt notes2.txt
  (make a copy of notes1.txt and call the new file notes2.txt)

  $ mv notes2.txt notes3.txt
  (move/rename file, try 'man mv';
   rename notes2.txt into notes3.txt)

  $ rm notes3.txt
  (remove/delete file, try 'man rm';
   delete notes3.txt)

  $ more notes1.txt
  (display the content of a file, one page at a time... try 'man more'.
   'more README' shows the content of the 'README' file in your directory)
 
  $ cat notes1.txt
  (concatenate file/print to screen, will not stop at one page full of content.
   Try 'man cat')
 

* Account-related commands:

  (Note for Vulcan users:  Please don't change your passwords for now
   after you learn about the following 'passwd' command.)
   
  $ passwd
   (change password; hit 'Ctrl-c' to get out of 'passwd' at any time.
    Try 'man passwd'

  $ whoami
   (print my username/userid; try 'man whoami') 

  $ echo $HOME
   (print my $HOME directory, the place that I will be at after I log in.
    Try 'man echo')

  $ w
   (show who's logged into the system right now, where they are from, and 
    even what programs they are running, try 'man w')

  $ who
   (show who's logged in with complete user names. Does not show what 
   programs people are running like what you see in 'w'.  Try 'man who')

  $ uname -a
   (show what type of unix/linux that I am using.  Try 'man uname')

  $ man man
   (It can read the man/manual pages about the 'man' command, too!)

******
RULE#2 in Linux:  Read the man pages!  Most Linux system 
administrators learned their craft by reading lots of man pages AND 
by doing lots of experiments at the command prompt at the same time.
******

******
RULE#3 in Linux:  Before you ask any questions about a Linux 
command, read the man pages!  Most of your questions are 
either in the man pages or can be googled easily.  
Remember: Search engines are your best friends!
******


* Command-Line Wizardry: Getting to know command history & auto-completion

  $ history
  (give me a list of commands that I have typed since I login, 'man history')

  - Hit [UP] and [DOWN] arrow keys to recall/cycle through command history.
    You can then use backspace/delete/arrow to edit the line you chose.

  - Hit [TAB] key to "complete" a directory, file, or even command name!

  $ mkdir this_is_a_directory_name_that_is_impossibly_long
    (now try the following...)

  $ rmdir this[TAB]

   [TAB] will try to complete till a point that it requires more input!
   Do the following test:

  $ nano notes1.txt
  $ nano notes2.txt
  $ nano notes3.txt

  $ ls notes*
  notes1.txt  notes2.txt  notes3.txt ....
  (now I have three filenames starting with notes. Try the following:)

  $ more n[TAB]
  ([TAB] will complete till '$ more note' and wait for you to type more 
   characters to disambiguate its guesses.  Now type '1' to make it look like
   '$ more note1' and hit [TAB]...  now you'll see '.txt' completed for you)

  $ whoa[TAB]
  (see how auto-completion works for the commands it knows...
   in this case, the command happens to be 'whoami')
 
* When you are done, don't forget to logout of your Linux account:

  $ exit

-----------------------------------------------------------------------------   
* Hungry for more?
-----------------------------------------------------------------------------   

  Try and read man pages for the commands categorized on the left side of the:
  An A-Z Index of the Bash command line for Linux

 (Relax! These extra commands will NOT be in the quiz. Nonetheless, 
  you should know the commands before "Hungry for more."  Linux admins, 
  on the other hand, typically remember a couple hundred ommands.)
  
  Since some commands will require system administrator privilege
  (the superuser account in Unix/Linux is called 'root', so it's also 
  called 'root privilege'), you will have to have your own Linux box or
  just use some Linux virtual machines. 

  Any questions, do drop your professor a note!