Upgrade to Pro — share decks privately, control downloads, hide ads and more …

03-Unix.pdf

Avatar for William Albritton William Albritton
September 04, 2015
180

 03-Unix.pdf

Avatar for William Albritton

William Albritton

September 04, 2015
Tweet

Transcript

  1. SSH Software  SSH stands for Secure SHell  It

    is an encrypted version of Telnet, which provides a command line interface for a remote host (a computer far far away)  Since Telnet uses plain text, anyone listening to your Internet connection can get your username and password
  2. SSH Software  SSH prevents hackers from monitoring your network

    messages by encrypting the information  Other advantages of SSH include the ability to make multiple windows quickly and easily
  3. SSH Software  You can download SSH (and other software)

    from the UH Information Technology Services (ITS) Supported Software page: http://www.hawaii.edu/askus/778
  4. SSH Software  After you download the software, you should

    have two icons  Yellow icon (SSH Secure File Transfer Client): to transfer files to UHUNIX account  Gray icon (SSH Secure Shell Client): command line interface to access the UHUNIX operating system
  5. SSH Software  Clicking either icon will bring up this

    window  Click the “Quick Connect”button
  6. SSH Software  To see new files in SSH, you

    may need to press the Refresh button (two arrows) at the top of the window
  7. SSH Software  Move files from your computer to UHUNIX

    account by dragging the file from left to right window (and vice versa)
  8. SSH Settings  Changing the settings for the command line

    interface (Click Edit, then Settings)  Keyboard  Font  Color
  9. SSH Settings  Before closing SSH, save the profile 

    Click File, then Save Settings  Click File, then Save Layout
  10. Command Line Interface  Click on the gray icon at

    the top of the SSH Secure File Transfer window to open the command line interface
  11. Command Line Interface  On the right is a screen

    shot of the command line interface
  12. Unix Commands  tcsh  Running the TC Shell (TENEX

    C Shell) will enable these features: backspace, command line completion, and repeat a command uhunix2:/home/27/walbritt% tcsh
  13. Unix Commands  tcsh  For command line completion, pressing

    the tab key will complete a file name  To repeat a command, press the up and down arrow keys to scroll through a history of the commands, then press the enter key to execute the command
  14. Unix Commands  *  Many commands allow wild card

    characters in the file names  An * (asterisk) stands for any string of 0 or more characters  For example, *.c means all files that end with .c
  15. Unix Commands  ls *.c uhunix2:/home/27/walbritt% ls *.c a.c a4.c

    final.c test.c a1.c a5.c program.c a12.c a8.c solution08.c a2.c aloha.c temp.c
  16. Unix Commands  ?  Many commands allow wild card

    characters in the file names  A ? (question mark) stands for any single character  For example, ?.c means all files that end with .c with one character names
  17. Unix Commands  ls ?.c  ls program.? uhunix2:/home/27/walbritt% ls

    ?.c a.c uhunix2:/home/27/walbritt% ls program.? program.c program.o
  18. Unix Commands  cd dirname  Change directory  For

    example, "cd ics212" will change to the ics212 directory  "cd .." will move one directory higher
  19. Unix Commands  cd ics212  cd .. uhunix2:/home/27/walbritt% cd

    ics212 uhunix2:/home/27/walbritt/ics212% uhunix2:/home/27/walbritt/ics212% cd .. uhunix2:/home/27/walbritt%
  20. Unix Commands  cat filename  more filename  less

    filename  Different commands to display a file  For example, "cat aloha.c" will display the file aloha.c on your screen
  21. Unix Commands  cat aloha.c uhunix2:/home/27/walbritt% cat aloha.c /*Will output

    aloha!*/ #include <stdio.h> int main(void){ printf("Aloha!\n"); return 0; }
  22. Unix Commands  pwd  Print working directory (your current

    directory)  Note: to save space, we will use only the % (percent sign) as the UNIX prompt in the slides from now on % pwd walbritt@uhx01:/home/27/walbritt/public_html/ic s212/examples
  23. Unix Commands  man command  Display on-line manual for

    command  For example, "man ls" will display a short manual on the "ls" command % man ls
  24. Unix Commands  For more details on UNIX commands, see

    the “UNIX Commands” link on the class webpage
  25. emacs Commands  See the “Emacs Commands” link on the

    class webpage for a list of basic emacs commands
  26. emacs Commands  Type the code in the program file

     To move around, use the arrows
  27. emacs Commands & SSH  SSH has copy and paste,

    but it works a little differently from usual windows  You can select something with your mouse and copy (but not cut) the selected text  Then when you paste, the text is inserted where the cursor is, not where the mouse pointer or selection is
  28. emacs Commands  To save without exiting  To save

    and exit X Ctrl S Ctrl X Ctrl C Ctrl
  29. emacs Commands  Delete the character at the cursor 

    Delete the character preceding the cursor  Delete from the cursor to the end of the line D Ctrl K Ctrl
  30. emacs Commands  Search for a word  It does

    an "incremental search." For example, if you are looking for "hello", you type h and it looks for the first h. Then you type e and it looks for "he".  Type Ctrl-s again, and it will look for the next occurrence of the word S Ctrl
  31. Multiple Windows  With SSH, you can have any number

    of windows  I recommend that you start by opening one window in which you run a program and another window for editing  Edit a program in the edit window  Then save it (use Ctrl-x Ctrl-s), and then compile it and run it in the other window
  32. Customize your emacs  There is a file in your

    main directory called “.emacs” which you can use to customize your emacs  For example, to enable the backspace key, disable tabs, and set the indention to 2 spaces, see detailed code at the bottom of the webpage “Emacs Commands” (see the link on the class webpage)
  33. Output Redirection in Unix  Usually, output is displayed on

    the terminal  However, we can change where standard output is stored by using a command, followed by a greater- than-sign (>), and then a file name  The output will be stored in the file!  Syntax: command > file.txt
  34. Output Redirection in Unix  Stores the contents of the

    “ls” command in file1.txt  Stores contents of “history” command in file2.txt % ls > file1.txt % history> file2.txt
  35. Memory Management  SSH  Unix Command  emacs Commands

     Check the class website for assignment  Post any question to the discussion board