Thursday, March 8, 2007

Terminal velocity: a quick primer to the Linux command line

I think one of the most imposing aspects of Linux for the newbie is its command line. Windows began phasing out its command-line in Windows 95, and now, with Vista, it's little more than a bad dream. So, the ex-Windows user may ask why can't Linux do the same? The answer is that there's a lot of power to the Linux command line, and really everything graphical in Linux is just window dressing for the command line anyways. It may seem scary or awkward, but once you get the hang of it, it'll soon become your best friend. So, to this end, I decided to provide a short primer on some of the most important commands.

A Word About the Linux Filesystem


Linux's filesystem can take a little getting-used-to coming from Windows. The filesystem in Linux always starts from root or '/', and all drives and partitions are mounted in the filesystem from there. Directories are hierarchically written out with slashes (/) between each directory. For instance, your desktop is located at '/home/johndoe/Desktop'. This says that it's a directory named 'Desktop', within a directory named 'johndoe', within the 'home' directory of root. This could have also been written as '~/Desktop', as the tilde (~) indicates the currently logged in user's home directory. Notice also that 'Desktop' is title-cased. The Linux filesystem is case-sensitive, so 'desktop', 'Desktop', 'DESKTOP', and 'DeSkToP' are all different directories.

Basic File and Directory Commands













Changing Directoriescd [directory]
Creating a Directorymkdir [directory]
Copying a Directorycp -r [target] [destination]
Moving a Directorymv [target] [destination]
Removing a Directory (empty)rmdir [directory]
Removing a Directory (non-empty)rm -r [directory]
Listing the Contents of a Directoryls
Getting a Detailed List of the Contents of a Directoryls -l
Copying a Filecp [target] [destination]
Moving a Filemv [target] [destination]
Removing a Filerm [file]

A Note About Permissions


Every file and directory in the Linux filesystem is subject to priviledges, owners and groups. Priviledges are things that are allowed to be done to a particular file or directory by those who have permission to do so. They are broken down widely into read, write, and execute priviledges. Groups are, obviously enough, groups of users who 'own' certain files and directories: they have permission to edit and otherwise alter or use files that have been given to their group. Owners are members of groups but have their own files and directories that they 'own' that the rest of the group does not. Root is a special user who in effect owns all files in the filesystem and belongs to all groups. This gives the root user complete and total authority of every part of the system, which also makes root a potential dangerous user. Most Linux distros, including Ubuntu, do not assign root to the computer's owner, rather creating a separate account for them. Ubuntu goes a step further and assigns a random password to root that the computer owner doesn't even know. This is good in that it protects the system against attacks, but it also creates a problem when things must be done on the system which actually require root priviledges. Thankfully, there's solutions for this.

Administrative Tasks









Do Something in a Terminal as Rootsudo [command]
Use a GUI Program as Rootgksu [command]
Use Terminal as Root (Potentially Dangerous!)sudo su -
Change Priviledges of a File or Directorysudo chmod [u/g][+/-][r/w/x] [target]
Change Priviledges of a Directory and All Files and Directories Withinsudo chmod -R [u/g][+/-][r/w/x] [target]
Change Owner of a File or Directorysudo chown [owner]:[group] [target]
Change Owner of a Directory and All Files and Directories Withinsudo chown -R [owner]:[group] [target]

This will do for now. I might come back and add more later or follow-up in another post. I intend on discussing some of the basic ways of editing files, but this really requires an post in itself.

Ubuntu + Firefox = Happy Me

I've been using Firefox as my preeminent browser since v1.0, and have loved it from the start. The only that has ever bothered me about this browser was an annoying 'feature' it has, or more appropriately, a 'feature' it has that becomes very annoying on a Winbox (computer running Windows).

Firefox keeps a record of pages one has viewed, so that you can 'fastback' to a previous page in your history. The number of previous pages store is usually around 5, but this is for every tab in every window. In principle, it's a great idea, and for people on slow connections, it makes Firefox a very attractive browser. It also makes Firefox a very memory-hungry browser, potentially. I say potentially, because Windows (at least post-XP) has a 'feature' where it doesn't release resources once one is done with them, in case you might need them again. This makes repeat loadings of a program or conducting similar actions faster because resources are not being constantly unloaded and reloaded, but combined with Firefox's feature, it makes for a Firefox that can easily grow t0 a 500mb, 1Gb, or more footprint.

This has always been a problem for me because I'm a tab pack-rat. When I'm scouring the web for some sort of info I can easily amass 50 or more open tabs, each containing some tidbit of information I deemed worthwhile. On Windows, I could feel each new tab taking a toll on my system, and quite often had to restart Firefox just to gain a little speed back (thank God for SessionSaver).

Well, as can be discerned from the title of this post, this is no longer a problem since switching to Linux. Not only is Firefox blazing fast (no matter how many tabs I have open), but really every program I run seems faster. Ubuntu's speed continues to amaze me, especially after many, many long years of tapping my foot while paying omage to the big blue monster that is Microsoft.

So, if Firefox is running slow on your Windows install or eating through your RAM like Pac-Man on steroids, there's one more reason to make the move to Linux, and obviously Ubuntu at that.

Wednesday, March 7, 2007

Ubuntu and Widescreens

When I first installed Ubuntu 6.06 TLS on my laptop, I was amazed by how easy it was. All of my hardware pretty much just worked. The only thing that frustrated me was that Ubuntu didn't seem to support my nice widescreen. The System Preferences menu provided a Screen Resolution applet, but much to my despair, the only options I was provided was 1024x768 and 800x600, neither of which fits a widescreen.

So, I began searching for an answer and came across a solution called 915resolution. Following advice from various articles I was reading, I went through the arduous process of trying to get this installed and running on my Ubuntu distro, as well as getting it set to automatically change my resolution to the right mode at startup. This was so until, I learned about adding additional repositories. There is some great information over at the UbuntuGuide about how to do this. You also might want to take a look through the guide while you're there. There's great advice about how to do all sorts of things in Ubuntu. Anways, after adding the additional respositories, getting 915resolution, and subsequently getting my widescreen, well, wide, becomes a simple matter of:


sudo apt-get update
sudo apt-get install 915resolution


The package installs 915resolution and automatically sets the right display setting and boot options. After the install finishes, a simple reboot or Alt+Ctrl+Backspace makes Ubuntu look as it should.

Hello World! Meet Ubuntu

I thought it'd be appropriate to start this blog with a little introduction about myself and of course, the focus of the blog, Ubuntu.

I've been primarily a Windows user for most of my life, but have been playing off and on with Linux for years. Roughly about 5 years ago, I made my first attempt to actually 'use' Linux, with the SuSe distro. At the time, I was running on my old HP n5270 laptop, and was confounded by almost a complete lack of hardware support. The fact that I never could get my ethernet or modem loaded pretty much put the nail in the coffin for Linux at the time, and I went back to Windows.

As Windows has progressed, there seems to have been a greater and greater move towards user-friendliness at the cost of 'user-ability'. I don't whether or not I'm the first to use that term, but I'm coining it here regardless. Usability is (or should) be the focus of every good designer/programmer; it's designing with an eye on the end-user and their wants and needs. Microsoft in particular seems to have a bad habit of incorporating usability by sacrificing options. In other words, things become easy-to-use, simply because there becomes only one way to do it. 'User-ability', to me, is a concept of usability that gives the power to the user. The end-user is given the freedom to do what they want to do, how they want to do it, and this doesn't have to come at the cost of usability, as the Ubuntu distro shows. So, when I got my new Gateway CX2724, I decided to give Linux another go. In my search for a good distro, I came across Ubuntu, and the rest is history.

What's so special about Ubuntu? In effect, it's everything and it's nothing. In other words, there's really not much that's special about Ubuntu in terms of what it is or what it does. What makes it special is what it is and what it does in relation to other distros out there.

First, it's free. While nearly all Linux distros are Open Source, not all are actually freely available to the public. Many of the major distributions have moved towards serving the enterprise community. Many of these still release publicly available versions, but usually with concessions. Either the code is not updated as frequently, or certain features are disabled, etc. Ubuntu just is. Whether you want to use it at the enterprise level or just on your own personal computer, it's all the same.

Second, Ubuntu maintains a hands-off approach to your computer and what you want to do with it. Initially, I was slightly interested in the trying out Fedora Core, the public-available descendant of the famous (infamous?) Red Hat. What killed it for me was Fedora includes no support for the mp3 format, and rather pushes (forces?) ogg. Now, it's not that I have a problem with ogg vorbis, or even that I have a great love for mp3, but I don't want my OS telling me which I'm allowed to use and which I'm not.

Third, Ubuntu isn't afraid to be what it is: a Linux distro. The Linux community as a whole has worked hard at chipping away some of Microsoft's market share, and they've made great strides. Right now, Linspire has OEM agreements with some computer manufacturers such that you can get a brand new computer that boots up with Linspire instead of Windows when you pull it out of the box. That's inspiring, but it comes at a price. As all too often happens when going to war against a foe, we tend to become that which we hate. Linspire (or its publicly-available incarnation, Freespire), in particular, is probably one of the most user-friendly distros out, but by becoming that, it has also become too 'Windowsy' for my tastes. Ubuntu is Linux; it uses Gnome (or KDE in its Kubuntu incarnation). It doesn't try to be a Windows clone, and I like that.

So, for these reasons and others, I chose Ubuntu. My first install was 6.06 TLS or Dapper Drake. Later I moved up to 6.10 or Edgy Eft, which is what I'm using now. I liked Dapper but I really like Edgy. I'm not sure exactly why I like Edgy so much more, but such it is. The standard disclaimer though is that Dapper is older and better supported, so if you're the cautious type stick with Dapper. If you've got a little risk-taking streak in you (personally, I don't feel like you need much of one), then try out Edgy. Whichever you chose, you can download the CDs or the DVD over at Ubuntu's site.

Well, that's it for now. I intend mostly for this blog to chronicle my experiences with Ubuntu. I'm not a Linux expert, so for those of you who are, try not to be over-critical of me. But I feel that since I'm not an expert, I can provide a critical perspective to others who aren't quite sure about this whole Linux thing, and that's what Ubuntu love is all about.