Things I Can Do in Linux that I Can’t Do in Windows

I’m an evangelist. Whenever I discover something new and great that’s improved my life, I try to spread the message. Occasionally I’ll get someone to try out Linux. They’re always impressed at first, but inevitably the question always comes in some form or other: “Why can’t it do this like it does it in Windows?”

There are many answers to that question depending on the task at hand, in some cases Linux does it differently and better, in others Linux just doesn’t do it (just like Windows doesn’t support ext3).

But this post is not going to be one of those posts, this post is going to be about what I can do in Linux that I find myself asking in Windows “Why can’t it do this?”

I’m purposely leaving out the obvious bullet points – including modify it any way I like because it’s open source – I want to focus on a user perspective, especially for those thinking of making the switch.

1. Always On Top

This is such a simple and useful feature, to select a window and tell it to stay on top of the others. I mainly find it useful for Tomboy notes or when I’m using a combination of the terminal and file manager.

This would be incredibly useful when I’m using Windows based work computers, where as many as 15 application windows could be open at once.

2. Virtual Desktop

Of course what do you do when you have several application windows crowding your taskbar and only one screen. Shift to the next workspace of course!

Before Linux, when I was just a Windows guy I used to look at these default 4 workspaces and wonder why you would need more than one. I guess I got incredibly more busy since then and since moving to Linux. Now I wonder how those with just one desktop cope!

3. Change the Background

Yeah this is just another dig at Windows 7 Starter Trial edition. Sorry it’s just an easy target!

4. Boot Live CD/USB

There’s times when it would be so convenient to say, boot up a virtual environment in order to analyse or recover your hard disk without actually loading the OS.

Other times you want to try out a new flavour of the OS, or have a portable working environment to switch from PC to PC. Being able to install a USB live distro with minimal fuss and no licensing restrictions is bliss.

5. Install Applications Effortlessly

A lot of people make a big deal out of installing from source on a command line in the terminal, but I think this ceased being an issue a long time ago. It’s mostly used as FUD now. – unless you’re making the switch to Gentoo.

I think there may have been a couple of rare occasions in the last 3 years where I had to install something from source – usually a fairly new alpha or beta application.

Most of the time, I just go to Applications menu and click on the package manager, search for what I need and find multiple choices to try. No DVDs, no drivers, no license codes to enter, no crashing another application and all upgrades managed semi-automatically. Clean install and clean removal if necessary.

6. Partition Management

Want to install a second OS, need to extend your home directory? Just fire up a live disk/usb and run your free partition editor of choice.

This was a major seller of Linux for me. Before Linux I didn’t even realise that partition editors were so ubiquitous and free! That’s right partition your hard drive easily and for free!

Oh… and remember that thing about rebooting into a command line that you need to do in Windows in order to repartion? No need for that here, repartion on the fly in your live desktop environment. It’s so easy!

7. Command Line Fu

OK so this may be slightly technical for the average Windows user but since embracing Linux I’ve learned to embrace and love the command line.. sometimes it’s just easier and faster to fire up an terminal and type

egrep -i "Date: \d+/03/2010" | cut -f1 -d: | sort | uniq | while read line; do mv $line /home/user/March_2010/ ; done

Rather than sift through numerous files looking for those containing dates from March 2010 and endless click and drag.

8. Mimic An Apple Mac

There are specific themes created by the community and tutorials on how to do it, however you don’t even have to go that far. There are several app docks in the repository, as well as widgets (but I can’t stand widgets personally). Currently I use Cairo-dock on my desktop Ubuntu setup.

9. Bulk Rename

This can be done from the command line itself but I have to give credit to this utility from the Thunar file manager. It really is one of the most practical and easiest applications I use.

10. Recover from Crashes

Yes the Linux desktop does crash occasionally, a lot less than Windows. But there are a number of ways out beyond Ctrl-Alt-Del or the power button. Crtl-Alt-F1 will switch you to a command line login that allows you to identify problem processes and kill them, whilst raising a skinny elephant (Alt-Sys Rq- RSEIUB) will secure your system before rebooting, minimising data loss and hard drive borking.

Addendum

Of course there are things that Windows will do that Linux won’t. For example Linux won’t reboot after every update like Windows does. It won’t run malware and spyware downloaded passively from fraudulent websites. It won’t bug you to purchase a license after 30 days, or check whether your copy of your OS is genuine. It won’t slow down after a certain amount of time. It won’t require a defrag or disk error scanning.

I guess one thing I really miss about windows is all that time I spent searching for performance tweaks, registry hacks and beefing up security. Unfortunately I spend less time messing about with the OS and more getting things done.

Beyond Photorec… Gloobus Helps Discover What The Heck is in These Files?!

Last week I posted on my wife’s emergency situation upon losing hundreds of important work documents after a fatal delete. Photorec is a phenomenal tool in this situation. The problem with using Photorec to restore lost data or a corrupt partition however, is that it spits out files with a generic id for the filename – consequently you could find yourself spending hours opening, closing and renaming restored files.

Thankfully I have just discovered Gloobus, which is an open source alternative to Apple’s Quicklook, and what’s more it’s for Linux! This takes away the headache of launching OpenOffice.org hundreds of times and makes file previews a doddle. If only we’d found this last week!

Instructions for installing for Ubuntu are here, other distros will need to install from source.

Recover Your Data with Photorec

Recently my wife had a crisis – she deleted a huge amount of files in a directory all in one go, worse still, she had committed the fatal no-no of saving and working on these documents from a USB flash drive.

For anyone who is doing this – STOP IT! NOW! Flash memory has a limited lifespan, and if you don’t use up the whole memory block each time the parts you do use will wear faster*. What this means is you’re eventually going to lose those files if you’re relying on it effectively as a mobile office! That is of course, assuming you don’t lose your USB memory stick on the bus or the tube on the way to work…

Bottom line USB memory sticks are really for moving files around, not permanent storage, and it’s even worse to not make backups!

Back on topic. My wife was in despair, she thought these files were lost. Now anyone who uses Linux extensively knows that Linux creates a .Trash file which stores all deletions till you come to unmount. Not so on Windows – no Windows has it’s own bizarre rules for external memory depending on size. In the case of flash drives, there is pretty much zero chance of restoring from the Recycle Bin.

But all is still not lost! When she called me I was careful to instruct my wife not to touch anything on the USB drive. That means no saving, modifying or adding new files.

We then took the memory drive home and I plugged it into my trusty Ubuntified Sammy n210. I downloaded a package called Testdisk, which comes with a handy utility called Photorec.

For those lonely Windows users, download an Ubuntu live CD, then run Software Centre and install Testdisk and go from there.

Procedures for doing a recovery of files with Photorec can be found at Ubuntu’s Community Documentation portal.

It’s run from the command line but then there’s a simple intuitive GUI interface that gets you to where you need. Just select the USB device, the directory you want to save to and a few clicks later you can restore pretty much everything on the disk.

A word of warning though, Photorec spits out everything with a generic indexed name. The file extensions are there, but it’s a case of opening them up to discover what is inside and renaming those files. A bit laborious but if the documents are that important – worth it.

And once again – BACKUP YOUR FILES!

*I’m not talking about netbook flash hard-drives of course, they have different technology that evens the wear.

Headless Recovery with Persistent Ubuntu Live USB

As some of you know, recently my Samsung NC10 netbook screen was smashed in an unfortunate accident. I have since replaced this with the excellent Sammy N210 but was at a loss where to begin recovering data from the NC10.

Of course, the obvious solution was unscrew and take out the hard drive, however these Netbooks are tightly built, and since I’m still considering the possibility of replacing the screen, I don’t want to create any superficial damage to the case.

So I googled for options, initially hoping to snag a Linux liveCD that would automatically boot with sshd in order for me to log in remotely.

Aside from some vague forum references to Knoppix and editing configuration files, I got nowhere. However what did occur to me was that Ubuntu LiveCD on a usb flash drive can be set to be persistent so it saves any changes including packages and settings.

The following steps are what I did to get access to my netbook data despite having a smashed screen, without needing to take out the hard drive, hook up an external monitor or building my own distro. Hopefully it may be useful for anyone finding themselves in a similar situation.

This is by no means a silver bullet. You will require the following setup for this to work:

  • The system with the broken screen must be capable of booting from USB.
  • The Bios must already be set to boot from USB (unless you have some way to set it without a screen).
  • A second ‘puter with sshd installed and running.

This will not work with a LiveCD, it needs to be a USB pen drive so that changes can be easily saved on the drive.

  1. Download an ISO of Ubuntu or Netbook Remix, which is what I used, and then use the Startup Disk Creator to create a live USB pen drive – check the box for persistent mode (“Stored in reserved extra space”).
  2. Run the LiveUSB and when it boots to desktop open a terminal and type:

    sudo apt-get update
    sudo apt-get install openssh-server

  3. When installing openssh on a LiveCD/USB you need a password to log in remotely. This can be done 1 of 2 ways, either by setting ‘passwd’ for the default ubuntu user or creating a new user. NerdNotes.org offers a nice and easy tutorial. In practice I found that when I rebooted the liveUSB for some reason the default ubuntu user ‘lost’ the password so I had to create a new user instead.
  4. If you have created a new user, be sure to add the username to the admin group, giving root privileges:
  5. sudo adduser <username> admin

  6. Test the ssh daemon by logging in remotely to the machine you will use for recovery. If you are prompted for a key then type ‘yes’ and hit enter:
  7. ssh username@hostname

  8. Then make sure you can ssh back to your ubuntu LiveUSB. You may also want to do a quick reboot and test run to see if you can ssh without problems and without touching the LiveUSB keyboard.
  9. Now shutdown the LiveUSB and plug it into your headless netbook/laptop, switch it on and let it boot up, it should take about 30 seconds to boot automatically after the menu and then another 30-45 seconds before you can ssh in.
  10. Create a directory you are going to use to copy all your files from your netbook.
  11. wafitz@ $ mkdir /media/bkup

  12. Once you can ssh to the LiveUSB, you want to mount your hard disk partition.
  13. wafitz@ubuntu$ sudo fdisk -l

    Device Boot      Start         End      Blocks   Id  System
    /dev/sda1               1         182    160101883+  82  Linux swap / Solaris
    /dev/sda2   *       53782       60802    69389632    7  HPFS/NTFS

    wafitz@ubuntu$ sudo mount /dev/sda1 /mnt

  14. It should now be easy after this to grab your files and scp them back to your curent system, whether you previously had Windows or Ubuntu (or other distro) Linux installed. However if like me, you had an encrypted home partition, then keep following the steps:
    I got the original instructions for this from Dustin Kirklands blog – nb: I needed to use ecryptfs-add-passphrase in order to record my passphrase manually before mounting the encrypted directory.
  15. wafitz@ubuntu$ sudo mount -o bind /dev /mnt/dev
    wafitz@ubuntu$ sudo mount -o bind /dev/shm /mnt/dev/shm
    wafitz@ubuntu$ sudo mount -o bind /proc /mnt/proc
    wafitz@ubuntu$ sudo mount -o bind /sys /mnt/sys
    wafitz@ubuntu$ sudo chroot /mnt
    root@ubuntu$ su - wafitz
    wafitz@ubuntu$ ecryptfs-add-passphrase --fnek
    wafitz@ubuntu$ ecryptfs-mount-private
    Enter your login passphrase:

    Warning: Using default salt value (undefined in ~/.ecryptfsrc)
    Inserted auth tok with sig [xxx] into the user session keyring

    wafitz@ubuntu$ cd $HOME
    wafitz@ubuntu$ ls -a

  16. Finally you can do a secure copy from your netbook back to your host pc:
  17. wafitz@ubuntu$ scp -pr * wafitz@:/media/bkup

If you have found this post whilst searching for a solution and this helps you, please let me know. Even more so, if this method can be refined or improved then I’d also like to read your comments!