Tuesday, January 8, 2013

Cygwin and More Plans

I was introduced to the command line when I borrowed a friend's Macbook Pro to use while my laptop was being repaired. I also happened to be taking a Databases course at the time, which required us to run our MySQL code on a Unix machine on campus. With these toys to play with, I quickly became comfortable with the command line, although I'm still far from an expert on its many capabilities. Echoing last week's ending thoughts, the best way to learn tools is by using them. While I might not know that many commands, I'm now far more comfortable playing with the command line and exploring than I was after reading about its various capabilities.



After I returned the Macbook Pro, I missed the option to play with the command line on Windows.
I installed Ubuntu on my laptop (so I get the fancy "which OS are you booting to?" screen), but switching over was just clunky, and the one time I actually tried to do anything on Ubuntu (gzip a file, before I discovered that 7zip can do that on Windows), it didn't work (something about disc mounting issues). While I would love to explore more about the Unix command line, I have no desire to use Ubuntu as my primary OS. A Mac would have been a happy compromise between a Unix command line and a mainstream OS, but I also have no desire to buy a Mac...


Enter Cygwin

Cygwin is a Unix command line for Windows. The official website isn't layman-friendly: what is a DLL, and what does it mean to build an application from source? And that's just the overview! Happily, Lifehacker has a guide to Cygwin, which starts at installation and covers basic commands, as well as a few nifty tricks. Here's Lifehackers guide to Cygwin, Part I, Part II, and Part III.

Part I went pretty smoothly. Their link to the todotxt program didn't work, but they did provide a link to todotxt's website, so I followed that and explored the program a bit. I think I'll stick with my current to-do system (a page on Google sites). Nonetheless, I think the concept (a simple text to-do list accessible from the command line, text editor, and mobile device) is awesome, and just playing with the script helped me learn more about the command line (Filesystem Hierarchy Standard, aliasing, and .bashrc, to name a few topics).

Part II covers some text manipulation and the 'man' command. It starts by introducing readers to tricks using ls, cat, piping, and grep. I'd seen all of these commands before, but the examples illustrated how they can be used in combination for neat tricks. By reading the examples, playing with Cygwin on my own, and looking up more documentation and further examples, I finally understood the differences between less and cat (less gives you a screen to scroll through, cat prints a file it to standard output, which can be piped to other commands), and between | and >>. I finally understood the difference between man, apropos, and whatis (man gives the manual page, apropos searches the manual for "terms containing your string", and whatis just gives the first line of the term, nifty for printing out a cheat sheet of some sort). So, the commands were simple and I knew them already, but this article helped me really 'get it.'

Finally, Part III goes over downloading packages to Cygwin (run setup, and don't hit "enter" in the search page until you've actually selected the packages you want), networking utilities (ssh and scp), and scripts. This article didn't cover too much that I didn't already know (being familiar with ssh and scp from my Databases class), but I followed link after link - it turns out, Lifehacker has a lot to say about making your time on the command line more productive. At some point I might learn to master wget (seems pretty cool!), or various other tools, or some useful keyboard shortcuts.  For now, I'm tired of tools; the whole point of installing Cygwin was to make it easy for me to play with it on my own time, so I'm sure more mastery will come with time.

Next time...

As I said, I'm tired of writing about tools. Let's write some code! I've got a few things planned for the next couple weeks:
  • Custom Drupal Module for STS - Right, I really need to get on that. Ideally, I'll have done enough and learned enough that I'll have something to write about.
  • Learn R programming - Have downloaded the package, haven't actually touched learning the program yet. Hopefully it's not too hard; the course I need to know it for starts on Jan 22, in 2 weeks.
  • I've just finished watching the first week of lectures for Software as a Service on EdX. It's interesting and extremely relevant; I'm only a little miffed that I can't start chewing on the programming assignments now, while I still have lots of free time.
  • Last upcoming course this month is Programming Languages on Coursera (I understand that it'll be about functional programming). If you think I've gone a little MOOC-crazy, you're right. I really have too much time at home. You should have seen me before I cut the list down.
  • Still have to review Java/Data Structures Basics
  • Still haven't made my Sudoku Solver on Android. Unfortunately, in light of the courses I've signed up for and the work I'm doing for STS, I think this project is going to be on the back-burner.
So although I've made some progress (hey, two blog posts so far!), it seems that this list has gotten longer, not shorter. "Why is it growing!?" my friend Yoshi mentioned to me once, about his own to-do list. The only thing for it is to keep at it!

Oh, and Little Red, thanks for the shout-out. I hope these past two posts haven't bored you to tears. Maybe sometime I'll think of an awesome reason Cygwin can be useful to you - or maybe I'll try for more entertainment on the next post.

2 comments:

  1. All I have to say is, welcome to the growing list. There is only every going to be more to do ^_^.

    And let's just say I get lost in the acronyms :P

    ReplyDelete
  2. Yeah, I'm sorry. I tried to make the posts "to you," a novice/non-coder, but about halfway through the last post (about version control) I got bored of basically repeating the things I'd just read on the websites I linked.

    For this post in particular... you could probably just ignore it. Actually, you have an iMac, so I guess you could control it from your computer using SSH (basically, you'd log in to the iMac over the interwebz). I don't actually know how to do that (I can SSH into a computer that's already "set up" for me, but I haven't set one up myself), but we could play with it if you want.

    ReplyDelete