1 / 32

Unix Tools

Unix Tools. Getting Around. pwd P rint W orking D irectory Tells you where you are on the remote computer. Getting Around. LS Lists directory contents. L flag for ‘long list’. Getting Around. owner. size. date. name. directory. everyone. owner. group. W = writable R = readable

romeo
Download Presentation

Unix Tools

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Unix Tools

  2. Getting Around • pwd • Print Working Directory • Tells you where you are on the remote computer

  3. Getting Around • LS • Lists directory contents L flag for ‘long list’

  4. Getting Around owner size date name directory everyone owner group W = writable R = readable X = executable

  5. Getting Around • cd Go to the root of the server From there, go to the folder called ‘afs’ Now you’re in /afs

  6. Operations • Chown • Changes ownership of a file or folder chown [user] [file] chown gillw3 /var/logs chown –R gillw3 /var/logs Changes ownership of the folder ‘logs’ Changes ownership of the folder ‘logs’ and everything in it

  7. Operations • chmod • Modifies access rules for a file chmod [usertype] = [rights] [file] [usertype] can be one of u, g, or o (current owner, anyone in the owners group, anyone) [rights] can be r, w or x (read, write, execute)

  8. Operations • chmod chmod u=rwx somefile.txt

  9. Operations • cp • Copies a file cp [source] [destination] cp somefile.txt somefile_copy.txt

  10. Operations • mv • Moves a file mv [source] [destination] mv somefile.txt newname.txt (renames) mv somefile.txt /var/www/somefile.txt (moves)

  11. Operations • rm • Removes a file rm [file] rm somefile.txt

  12. Operations • wget • Gets a file (or more) from a web resource wget [url] wget http://www.rpi.edu/index.html (gets file, saves it to current directory as index.html) wget –O rpihome.html http://www.rpi.edu/index.html (gets file, saves it to current directory as rpihome.html)

  13. .sh files • Put shell commands in a file • Call the file, all the commands run The following should be the top line of the file: #!/bin/sh

  14. Operations • cron • allows users to set timers for operations to be exicuted • crontab • A file that specifies what should be done when

  15. Operations • Crontab • Crontab –e (edits file) [min] [hour] [day of month] [month] [day of week] [command] [0-59, *] [0-23, *] [1-31, *] [1-12, *] [0-6, *] [command] 0,5,10,15,20,25,30,35,40,45,50,55 * * * * update-rss-feeds.sh 0 3 * * * managelogs.sh

  16. Apache Webserver

  17. Apache Webserver = httpd • Hypertext transfer protocol daemon • Daemons are applications that run all the time listening for a request. When a request is made they do something. • Developed in 1995 • Serves 50% of websites

  18. HTTPD is Modular • mod_php is added to allow php to be processed…. • Modules may be added when the application is complied • Modules may be dynamically added after the application is complied • apxs is a tool for managing dynamic modules • http://httpd.apache.org/docs/2.2/programs/apxs.html

  19. Modules in httpd.conf

  20. Modules • mod_auth_cas • http://www.ja-sig.org/wiki/display/CASC/mod_auth_cas • mod_auth_ldap • http://httpd.apache.org/docs/2.0/mod/mod_auth_ldap.html • mod_proxy_fcgi • http://mproxyfcgi.sourceforge.net/

  21. Configuring in httpd.conf • Httpd.conf is read when httpd starts • Restart httpd every time you edit httpd.conf • At all times, refer to the apache documenation • http://httpd.apache.org/docs/2.2/

  22. httpd.conf • <directory> • Rules for a folder on the server • <location> • Rules for a url • <virtualhost> • Directive that creates additional hosts on your httpd instance. • <IfModule> • Tests of a module is loaded before you attempt to configure the module

  23. <directory> Allows server side includes in the specified folder Instructs httpd to follow shortcuts in the filesystem, to ignore .htaccess files, do not serve any content

  24. <location> Requires AFS login to any URL that has an /AFS in the path

  25. <virtualhost> Creates a virtual host, alert.rpi.edu

  26. <IfModule> Only runs the re-write rules if mod_rewrite is loaded

  27. .htaccess • Contains instructions, like those found in httpd.conf • File is parsed every time the server requests a resource in that folder, or a downstream folder

  28. In Class Work • Using mod_rewrite to • Proxy • Make neato urls • Create a httpd servable directory named ‘rewrite’

  29. In Class Work Allowing .htaccess files in httpd.conf • Add the following to httpd.conf <Directory /path/to/www/rewrite> AllowOverride All </Directory> • Restart httpd

  30. In Class Work • Create a file named .htaccess in ‘rewrite’ • Add: <IfModule mod_rewrite.c> RewriteEngine on RewriteBase /rewrite/ RewriteRule ^(.*)$ http://www.cnn.com/ [P] </IfModule>

  31. In Class Work • Go to http://localhost/rewrite • Rename .htaccess to example1.txt • Create another file named .htaccess <IfModule mod_rewrite.c> RewriteEngine On RewriteRule /(.*) index.php?input=$1 </IfModule>

  32. In Class Work • Create index.php • echo $_GET[‘input’]; • Use ‘explode’ on $_GET[‘input’] to break the input into value key pairs

More Related