Thursday, April 30, 2009

The Tiny Unix And Linux Shell Crash Course For Beginners

Hey there,

Today's been a long day, filled with fun and gainful employment. Unfortunately, nothing I did today was the least bit interesting to write about ;)

So, in the mean time - in between time - I came up with a little something to help a few new guys get used to the shell (bash in this instance, but most of this will work in any shell... except the c shell - nothing is compatible with the c shell except tcsh and ...the c shell ;)

The setup is simple for this crash course, and (we'll consider ourselves the teachers) you should let the student know that they're in for a fun little piece of problem solving. Maybe, if I had the time to give this some more thought, it could be a pretty decent (although probably unusually cruel ;) interview tactic. If you have the time (and the stomach) to do that to some poor bastard that's looking to make a buck; go for it. I'm a pretty harsh interview, but I don't know if this is something I'd do to someone who didn't already know that their future employment was ensured (pending the outcome of drug testing, of course. Quite frankly, if you don't have what it takes to do your job while you're loaded to the gills, I don't think you'll not be able to see right through my fragile mask of sanity ;)

Anyway. Load up your mark's .profile (or .bashrc, etc) with this little collection of shell aliases and see how long it takes them to break out and get a normal shell back. Plenty of folks can do it without thinking. Anyone who can't will learn a little something.

And, please remember, this isn't about judgement; it's about pushing someone (even yourself) to think outside the box (or whatever object they're figuratively trapped in ;). We all need to be able to think in that abstract space every once in a while. Why not make it fun :)

Cheers,

PS1="youAreHere/ "
export PS1
alias --='-'
alias ash='echo youAreHere/ '
alias bash='echo youAreHere/ '
alias cat='perl -l'
alias cd='cd .'
alias cp='echo cp'
alias csh='echo youAreHere/ '
alias df='echo /dev/dump 100% 100% 0% /tmp/jailfs/hoosegow/you'
alias echo='echo '
alias emacs='ed'
alias env='vmstat'
alias ex='ed'
alias exec='echo cannot fork'
alias exit='echo are you sure?'
alias id='echo user\(me\) group\(sadly the same\)'
alias joe='ed'
alias jsh='echo youAreHere/ '
alias kill='echo all dead'
alias ksh='echo youAreHere/ '
alias less='more ---x'
alias logout='echo are you sure?'
alias ls='echo .'
alias mkdir='echo making directory'
alias more='less </dev/null'
alias mv='echo stay'
alias netstat='cat /dev/random'
alias ping='ping /dev/null'
alias prompt='echo youAreHere/'
alias ps='echo you 501 501 0 Apr 1 ? 0:00 /usr/bin/vicks -vaporub'
alias pwd='echo you are here'
alias rm='echo can\'\''t find'
alias rmdir='removing directory'
alias set='iostat'
alias sh='echo youAreHere/ '
alias su='echo cannot su to'
alias sudo='exec'
alias touch='echo please don\'\''t touch'
alias unalias='echo no aliases found named'
alias vi='ed'
alias vim='ed'
alias w='echo x, y and z'
alias who='echo what?'
alias zsh='echo youAreHere/ '
# alias alias="sleep 5"

# Uncommenting that last line is optional ;)

, Mike




Discover the Free Ebook that shows you how to make 100% commissions on ClickBank!



Please note that this blog accepts comments via email only. See our Mission And Policy Statement for further details.