Cs2044_Lecture2 - CS2044 Advanced Unix Tools Spring 2010 Lecture 2 David Slater dms236 at cornell.edu David Slater dms236 at cornell.edu CS2044

Info iconThis preview shows pages 1–12. Sign up to view the full content.

View Full Document Right Arrow Icon
CS2044 - Advanced Unix Tools Spring 2010 Lecture 2 David Slater dms236 at cornell.edu February 24, 2010 David Slater dms236 at cornell.edu CS2044 - Advanced Unix Tools
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Organization Please complete the questionnaire by class on Friday. Is everyone on CMS? What about CSUGLab accounts? David Slater dms236 at cornell.edu CS2044 - Advanced Unix Tools
Background image of page 2
Some Review Quoting: echo "I am $USER, did you know it is currently ‘date‘?" echo ’I am $USER, did you know it is currently ‘date‘?’ David Slater dms236 at cornell.edu CS2044 - Advanced Unix Tools
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Some Review Quoting: echo "I am $USER, did you know it is currently ‘date‘?" echo ’I am $USER, did you know it is currently ‘date‘?’ I am slater, did you know it is currently Wed Feb 18 12:12:46 EST 2009? I am $USER, did you know it is currently ‘date‘? David Slater dms236 at cornell.edu CS2044 - Advanced Unix Tools
Background image of page 4
Random Bash Tip of the Day The more you use BASH the more you see what options you use all the time. For instance ls -l to see permissions, or rm -i to insure you don’t accidentally delete a file. Wouldn’t it be nice to be able to make shortcuts for these things? Alias: alias name=command The alias allows you to rename or type something simple instead of typing a long command You can set an alias for your current session at the command prompt To set an alias more permenantly add it to your .bashrc or .bash_profile file. David Slater dms236 at cornell.edu CS2044 - Advanced Unix Tools
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Alias Examples Examples alias ls=’ls --color=auto’ alias dc=cd alias rm=’rm -i’ alias ll=’ls -l’ alias canhaz=’sudo apt-get install’ Quotes are necessary if the string being aliased is more than one word To see what aliases are active simply type alias Note: If you are poking around in .bashrc you should know that # is the UNIX comment character. So any line that starts with # is commented out. David Slater dms236 at cornell.edu CS2044 - Advanced Unix Tools
Background image of page 6
More on Redirection We can redirect error messages to a file cmd 2> command.error cmd 2>> comand.error We can redirect both outout and error messages to the same file David Slater dms236 at cornell.edu CS2044 - Advanced Unix Tools
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
More Redirection We can redirect to /dev/null to suppress output Why does the following not work correctly? cmd < file > file David Slater dms236 at cornell.edu CS2044 - Advanced Unix Tools
Background image of page 8
More Redirection We can redirect to /dev/null to suppress output Why does the following not work correctly? cmd < file > file Because before the command is executed, file is opened for reading and writing. When we open for writing it blanks the file. David Slater dms236 at cornell.edu CS2044 - Advanced Unix Tools
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
A Bit of Translation What does this print? echo ’1337 5p34k !5 n07 5p0k3n 4m0n9 2341 h4ck325’ | tr ’01234579!’ ’olreastgi’ David Slater dms236 at cornell.edu CS2044 - Advanced Unix Tools
Background image of page 10
A Bit of Translation What does this print?
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 12
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 03/15/2010.

Page1 / 52

Cs2044_Lecture2 - CS2044 Advanced Unix Tools Spring 2010 Lecture 2 David Slater dms236 at cornell.edu David Slater dms236 at cornell.edu CS2044

This preview shows document pages 1 - 12. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online