Attachment 'cheatsheet.txt'

Download

   1 ####################################################
   2 # UNIX - THE BASIC COMMANDS
   3 # -- created by judith degen on 10/17/2009
   4 ####################################################
   5 
   6 ************************************************
   7 * PART I: navigating the directory structure
   8 ************************************************
   9 
  10 # Log onto slate:
  11 # ssh USERNAME@slate.hlp.rochester.edu
  12 ssh jdegen@slate.hlp.rochester.edu
  13 
  14 # Change your password!
  15 passwd
  16 
  17 # Show the contents of your current directory. If you just logged on, this will be your home directory.
  18 ls
  19 
  20 # For more information about file size/type/permissions
  21 ls -l
  22 
  23 # Show the contents of the directory /corpora/TDTlite.
  24 ls /p/hlp/tools/TDTlite
  25 
  26 
  27 # Move to the directory /corpora/TDTlite
  28 cd /corpora/TDTlite
  29 
  30 # Show the contents of the directory /corpora/TDTlite/sample_project
  31 ls /p/hlp/tools/TDTlite/sample_project
  32 
  33 # Move back to your home directory.
  34 cd
  35 
  36 # Move one directory up.
  37 cd ..
  38 
  39 # Check where you are.
  40 pwd
  41 
  42 # Figure out how to use a command.
  43 # man COMMANDNAME
  44 man cp
  45 
  46 # Copy the sample_project directory to your home directory with cp and rename it with mv.
  47 cp -r /p/hlp/tools/TDTlite/sample_project .
  48 mv sample_project myproject
  49 
  50 # Create a directory.
  51 mkdir mydir
  52 
  53 # Remove the directory you just created from your home directory. BE VERY CAREFUL WITH THE rm COMMAND!
  54 rm -r mydir
  55 
  56 # To copy file myfile.txt from your home directory on the server to your current directory on your computer:
  57 scp jdegen@slate.hlp.rochester.edu:./myfile.txt .
  58 
  59 # To copy the directory myproject from your home directory on the server to your current directory on your computer:
  60 scp -r jdegen@slate.hlp.rochester.edu:./myproject .
  61 
  62 ************************************************
  63 * PART II: the basics of tgrep2
  64 ************************************************
  65 
  66 # Run tgrep2
  67 tgrep2 "ADJP"
  68 
  69 # Run tgrep2 on the Wall Street Journal. Search for all VPs
  70 tgrep2 -c /corpora/TGrep2able/wsj_mrg.t2c.gz "ADJP"
  71 
  72 # The same, but print only terminals
  73 tgrep2 -c /corpora/TGrep2able/wsj_mrg.t2c.gz -t "ADJP"
  74 
  75 # Print the entire sentence
  76 tgrep2 -c /corpora/TGrep2able/wsj_mrg.t2c.gz -tw "ADJP"
  77 
  78 # Save the output to a file
  79 tgrep2 -c /corpora/TGrep2able/wsj_mrg.t2c.gz -tw "ADJP" > adjp.txt
  80 
  81 # View the contents of adjp.txt
  82 less adjp.txt
  83 
  84 # Search inside adjp.txt for "awesome":
  85 /awesome
  86 
  87 # Count the lines in adjp.txt
  88 wc -l adjp.txt
  89 
  90 # Output the match ID in front of the match itself. \t is a special character that inserts a tab, similarly \n inserts a newline
  91 tgrep2 -c /corpora/TGrep2able/wsj_mrg.t2c.gz -m '%xm\t%tm\n' "ADJP"
  92 
  93 # Always use the -af options, they make sure all your matches are found if for example there are multiple matches within one sentence
  94 
  95 # Two ADJP that are sisters, print first one, tab, second one
  96 tgrep2 -c /corpora/TGrep2able/wsj_mrg.t2c.gz -m '%t=a1= \t %t=a2=\n' "ADJP=a1 $ ADJP=a2"
  97 
  98 # Create a MACRO file
  99 vi
 100 
 101 # In the vi, there are a number of commands you can use:
 102 # :w FILENAME - save file as FILENAME
 103 # :q - quit
 104 # :wq - save and quit
 105 # 0 - move to start of line
 106 # $ - move to end of line
 107 # 1G - move to first line
 108 # G - move to last line
 109 # i - insert text before cursor, until <Esc> is hit
 110 # a - insert text after cursor, until <Esc> is hit
 1