I have moved my blog to Wordpress at theunixgeek.wordpress.com. I will still be checking back periodically on this one as well, though. 19 April 2009


Merging Mkdir and Cd | 280 Slides Interview | I Switched to KDE 4

clickable portals

Saturday, February 21, 2009

Merging mkdir and cd

I oftentimes use mkdir and cd together, as in mkdir project && cd project or mkdir project; cd project and I believe many people probably do the same thing. I always found it tedious and repetitive to have to type in the directory's name twice, so I thought, "why not merge these two into one command?" Something like mkcd project could do both jobs at once and reduce typing; it's like hitting two birds with one stone, so to speak.

The biggest problem I've encountered in the implementation of a seemingly simple idea is that when programs or shell scripts are run they are child processes. That said, you can't have a simple BASH script that reads "mkdir $1 && cd $1" because it would only switch to the directory while running as a child process instead of actually switching to the directory. The same applies to the system( ); function in stdlib.h (in C, C++ - cstdlib -, and related languages).

I am considering submitting the idea to the GNU project. The idea has been sent and I'm awaiting their reply.

Friday, February 20, 2009

I Switched to KDE 4

After KDE 4.2 was released, I have to say, I was hooked. The interface got cleaned up, everything is more elegant, practically bug-free, and not as sluggish as the original release (it's not as fast as GNOME yet, but it's been alright). As a big GNOME fan for quite a while now, the 4.2 release is almost at what could be considered commercially-ready. Will it be KDE that will tumble the world onto the GNU/Linux platform? I even remember seeing a photo of a bunch of KDE 4-based computers on display in Germany to celebrate the 4.0 beta. I can't seem to recall where I'd seen it, though.

Below is a screenshot of my current desktop, and I love it:

Wednesday, February 18, 2009

How Linux Shuts Down

Have you ever wondered how a computer can turn itself off without any manual controls? It's quite simple, actually. Here's how it works in Linux:

First off, all running processes are terminated. This means first closing files (and, in certain cases, saving them) to ensure that the system's stability is maintained and then completely forcing all processes to stop.

Afterwards, all external (non-root*) filesystems (including swap partitions) are unmounted.

If anything goes wrong in any of these steps, the filesystem may become unstable and may even render the installation useless. This is a warning to not interrupt your computer while it is being shut down! I personally know someone who happened to do so; his root filesystem became corrupted and a reinstallation had to be done.

For the actual hardware shutdown, a signal is sent to the power supply (similarly to how a signal can be sent to open a disc drive), which triggers the final shutdown.

(thanks to Tobor for help on the hardware info)

* root here means the root directory, not the root user.

Friday, February 13, 2009

Making Firefox Fit Into KDE 4.2

If you've ever run a default install of Firefox in KDE 4.2, you most likely saw tabs that looked terrible (at least on Kubuntu Intrepid). At first I thought there was a problem with my GTK theme settings for KDE, but then I figured out the problem was simply the theme. I installed KDE4+Firefox and now everything looks just fine.

Wednesday, February 11, 2009

Networking Ubuntu and OS X with Samba

Let's assume you have both Macs and Ubuntu PCs in your network. How can you set them up so you're able to access Ubuntu from a Mac and vice-versa? It's pretty simple via Samba.

Setting up Ubuntu
  1. Right-click the folder you want to share and select Sharing Options.
  2. Unless you already have Samba installed, you may be asked to install it now.
  3. Set all the options you want - select the name of the share (this will appear in the Finder's sidebar), if you want to allow other people to be able to write in the folder or not, and if you want guests to be able to access this folder.
  4. After saving the modifications, a link to the Ubuntu computer should appear automatically in the Finder, with the iconic BSOD icon
Setting up Mac OS X
  1. Open System Preferences > Sharing. Select the file sharing checkbox.
  2. Select the "Options..." button.
  3. In the pop-up menu, add the names of the users whose Public folders will be shared and select "Share Files using SMB."
  4. In Ubuntu, select Places > Connect to Server... and select Windows Share.
  5. Type in your computer's network address (usually smb://***.***. ... where the asterisks represent your IP address). You can access your computer either from the Places menu, the desktop, or in network:/// in Nautilus (or your file manager of choice).

Wednesday, February 4, 2009

Windows 7 Editions

I'd say Microsoft made its best post-Vista move recently. Windows 7 will come in the same options as Vista (except Business is now Professional again), except only Home Business and Professional will be publicly available for retail.

Starter Editions will now be available internationally and Home Basic will be around only in selected countries (shouldn't it be the other way around?).

Overall, I think this was a nice move on Microsoft's part.