Tag Archives: Linux

notepad.exe vs vi: Which Is More Difficult To Learn? The Answer Isn’t Quite What You Expect.

Migrating from Windows to Linux is no simple task. One of the things that some people complain about is the difficulty of text editing in console mode.

You may or may not know that Notepad.exe is actually pretty damn complicated. Just take a look at all the documented keyboard shortcuts:

New Ctrl+N
Open Ctrl+O
Save Ctrl+Save
Save As Alt, F, A
Page Setup Alt, F, U
Print Ctrl + P
Exit Alt+F4

Undo Ctrl+Z
Cut Ctrl+X
Copy Ctrl+C
Paste Ctrl+P
Delete Del
Find Ctrl+F
Find Next F3
Replace Ctrl+H
Goto Ctrl+G
Select All Ctrl+A
Time/Date F5

Word Wrap Alt, O, W
Font Alt, O, F

Status Bar Alt, V, S

Help Topics F1
About Notepad Alt, H, A

Here are some some undocumented keyboard shortcuts:

Goto Beginning of Next Word: Ctrl+Right Arrow
Goto Beginning Previous Word: Ctrl+Left Arrow

Select From Current Position To Next Word: Ctrl+Shift+Left Arrow
Select From Current Position To Previous Word: Ctrl+Shift+Left Arrow

Select From Current Position to Beginning of Line: Shift+Home
Select From Current Position to End of Line: Shift+End

This list of undocumented keyboard shortcuts for notepad are pretty long, that’s just a start from memory. If you count all the extra undocumented keyboard shortcuts, notepad has tons of functionality that is under utilized.

Did we ever notice or care that notepad had that many shortcuts? Most power users simply knew these shortcut commands by heart and never even had a second thought that notepad was difficult to learn, or poorly documented.

Using the vi editor is not complicated. I think most people just assume at first glance at a huge list of commands that it’s really hard to remember everything. It’s not that hard! Remember how ‘easy to use’ notepad seemed at first? Apply that attitude to learning vi!

The hard part about learning vi is that it doesn’t have a graphical interface for training wheels. You get right dropped right into a window that doesn’t necessarily want to help you get up and running quickly. So here are a few keyboard shortcuts for vi starting from the equivalents for notepad that are listed above:

New vi newfile
Open vi filename
Save :w[Enter]
Save As :w filename[Enter]
Exit :q
Undo u
Cut y
Paste P
Delete d
Find /text
Find Next n
Replace :%s/search/replace/g
Goto :linenumber
Help F1

Here’s where you, my readers come in. I’ve been looking all over, but I just can’t seem to find replacements for the following commands that have similar function without making things difficult:

Copy ?
Select All ?
Time/Date ?
Word Wrap ?
Font ?
Page Setup ?
Print ?

I assume since these were something I couldn’t find really easily that they are probably configuration settings, somewhere, but I’ve been looking for awhile and no luck.

Also, here is a pretty fantastic cheat sheet for vi (or vim) that I’ve found pretty handy:

vi-vim cheat sheet

Enjoy!

Few more announcements: Friday is my birthday, and I’ll be out of town. The the next several days will be pretty quiet. I’ll probably do the 6th edition of Linux Nation tomorrow morning, but that should be all you see from me until Monday, and I’ll be back with a vengeance.

Good news if anyone is keeping up with the times here, girlfriend has been quoted as asking, “can’t we just take off Windows?” Needless to day, that experiment is also going much better than I expected.

Also check out the right sidebar, Atlas carrying the Firefox icon was an idea I came up with, it was all done using Inkscape and GIMP. Let me know what you think of it. If you’re too lazy to scroll up, here it is:

atlas with firefox

See ya next week,
-Wayne

Linux Related Wikipedia Articles That Need Attention

There are currently 200 articles on Wikipedia about Linux that need more information within the page, or they will probably be deleted (eventually).

For example, Ubuntu Studio is one of 34 Linux distributions that are categorized as “stubs”. Why is a distro like Ubuntu Studio is categorized as a stub? It’s simply because we haven’t taken the time to put up a few facts and a short time-line. I’m sure you could catch a developer of such a prominent distro in IRC or in the Ubuntu Forums and not break a sweat helping them out with something that they may not have the time themselves to do.

After looking around a little bit, I created an account on Wikipedia that takes all of 2 minutes. If you use the Ubuntu wiki as a guide, there can be several hundred edits added in very little time using resources such as DistroWatch.

Some people forget that something simple like this can drastically improve the visibility of a distribution – you don’t have to be a coder to contribute to Open Source.

glTail.rb – Visualize Traffic In Real Time On Your Web Server

This is probably the most visual way I have ever used to analyze web traffic. Quoted from the authors website:

“glTail.rb allows you to view real-time traffic, data, and statistics from any log file on any server with SSH, in an intuitive and entertaining way using Ruby, net-ssh, and OpenGL.”

The latest version adds several new features and fixes several bugs which annoyed me.

Release Notes:
13 Oct 2007 – v0.06 – Handle referrals including your site as params
- Handle disabling a block without disabling the source
- Rework coordinate systems, and swap to glOrtho instead of glFrustum
- PureFTPD parser
- MySQL activity log parser
- Background reverse IP lookup
- Use yaml for config file (Ian Ownbey <[email protected]>)
- Highlight rate/total/avg column
- Split source into several files (Ben Bleything <[email protected]>)
- qmail/vmpop3d parser (James Grant <[email protected]>)
- Postfix fixes (Andre Luiz dos Santos <[email protected]>)
- TShark parser (Landy Bible <[email protected]>)
- Updated Squid parser (Isuraeru Ochoa <[email protected]>)

Here is a video in case you would like to see it in action.

Ahhh – I love it.

BREAKING NEWS: Girlfriend Agrees To Use Linux For A Month

A few months before I started writing about Linux, I convinced my girlfriend to switch to using Firefox. This was the first step I took to getting her warmed up to the idea of using Open Source software.

At the time that she switched to Firefox, she absolutely hated Internet Explorer, and really enjoyed the tabbed browsing feature. She said even though it took longer to actually start Firefox, it ran much smoother and was more efficient. Since I’ve started writing on a regular basis about Linux, my girlfriend has shown a moderate amount of interest in Linux and has been reading most of my articles. (*wave* Hi baby!)

About 3 weeks ago, her computer had a MASSIVE infestation of some really, really nasty adware. It took over the TCP/IP stack, and redirected all URLs through about:blank, and was not something I could fix. I tried about a half-dozen different anti-spyware programs, manually removed things, and even in windows Safe Mode, the damn ads kept popping up on the screen, making the computer useless.

I had to backup her documents, pictures, etc and reinstall Windows. I mentioned at the time that we could try installing Linux, and see how that goes, but she adamantly declined.

Fast forward to last night. I asked if we could try Linux out as an experiment. I’d setup the computer to automatically boot up in Linux after 30 seconds of waiting at the bootloader menu, and if she had problems with Linux, she could simply reboot and use Windows. She said, “Ok, I’ll try it.” I nearly had a heart attack.

I decided to try using Linux Mint as a “switcher” distribution for the time being, as it is a very full-featured distribution that has a menu similar to the default Windows XP menu. I originally thought that Puppy 3.0 would be a better option, seeing as she has a little bit older computer, since Puppy Linux runs completely in RAM it would run faster that most other distributions out there. I decided due to some reviews I read that it would not be the best option, especially since I am most comfortable with Ubuntu – and Linux Mint is a “downstream” version of Ubuntu.

Linux Mint Menu

Next, we changed the background to the default Bliss desktop wallpaper, renamed the “Celina” menu to the “Start” menu, and when I woke up this morning, she was browsing the web without any issues in Firefox

What I’ll do from now is provide a weekly “progress report” of things that she needed to reboot into Windows to do, and how she subjectively feels about the switch. I think it will be a successful conversion, seeing as she has expressed just three primary needs in an O/S: Browsing, Picture Editing, and BlackBerry firmware updates.

In other news, Hell freezes over.

By popular request, her picture has been added. ;-)

233486883_l.jpg

How To: Stream Music From The iPhone In Ubuntu

This is the first how-to article that holds your hand step by step to stream music from the iPhone in Ubuntu over Wi-Fi. This will work on other distributions, simply replace apt-get with your package manager of choice.

Requirements:

- 1.02 Firmware iPhone with OpenSSH installed via Installer.app
- Ubuntu, or probably any distribution based on apt-get (such as Debian)
- Wireless Router (ad-hoc connection probably works too, untested)

These instructions were performed on brand new Ubuntu 32-bit installation of Gutsy Gibbon (7.10). They have been found to be complete and accurate. Installing OpenSSH on the iPhone is outlined in other articles available online, simply search for “iPhone jailbreak” and follow instructions, you will need a Windows PC or Mac.

Using two programs called FUSE (Filesystem in Userspace) and sshfs we can mount the iPhone filesystem in Linux, then configure ssh key pairs so we can connect without needing to sudo or login as root every time we want to sync the phone, then we’ll install beta versions of Libgpod and Rythmbox to end up with something insanely great:

screenshot-tokyo-ska-paradise-orchestra-loverswalk.png

1. Installing FUSE and other needed programs.

On your PC, goto Applications, Accessories, Terminal
Search for gstreamer in add/remove programs and add everything with the name starting with gstreamer, including ubuntu restricted extras.

Note: You can copy-paste every command from this article using CTRL+Shift+V.

sudo apt-get install sshfs

Then, add yourself to the fuse group with this command:

sudo adduser wayne fuse [Replace wayne with your username]

Re-authenticate using su - wayne to avoid /dev/fuse errors later on (or reboot). We’ll be leaving this terminal open for the rest of this guide.

2. Setting up Hosts file, Configuring OpenSSH password, and Configuring SSH Key Pairs
This lets you connect to your iPhone without using a password every time.

Turn off auto-lock on your iPhone by going to Settings | General | Auto-Lock | Never

Adding the iPhone to /etc/hosts
Open a terminal, type:

sudo gedit /etc/hosts

Edit the file to look like this, changing 10.0.0.196 to the IP address of your iPhone:

iPhone Host File Setup

You can find the IP address of your iPhone by either by looking in your wireless router configuration page (now would be an excellent time to make it a static DHCP address) or on the phone by going to Settings | Wi-Fi, then tapping the blue arrow next to the access point.

Save and quit gedit, you’ll be back to the terminal.

In the terminal we’ll generate SSH keys and connect to the iPhone

ssh-keygen -t rsa

Should output something like this:

Generating public/private rsa key pair.
Enter file in which to save the key (/home/wayne/.ssh/id_rsa): [ENTER]
Enter passphrase (empty for no passphrase): [ENTER]
Enter same passphrase again: [ENTER]
Your identification has been saved in /home/wayne/.ssh/id_rsa.
Your public key has been saved in /home/wayne/.ssh/id_rsa.pub.
The key fingerprint is:
xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx wayne@gutsy
wayne@gutsy:~/Desktop$

4. Logging into the iPhone via SSH, Resetting Passwords, and setting up the iPhone SSH Keys.
ssh root@iphone

Don’t worry, if it takes a long time – the first time you connect, it takes about 30 seconds to generate keys on the iPhone.

wayne@gutsy:~/Desktop$ ssh root@iphone
The authenticity of host 'iphone (10.0.0.196)' can't be established.
RSA key fingerprint is xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'iphone,10.0.0.196' (RSA) to the list of known hosts.

root@iphone's password: dottie [This is the default password]
#

At the # prompt type the following:
passwd root [Type in the new password twice.]
passwd mobile [Type in the new password twice.]

Configure SSH keys on the iPhone.

mkdir ~/.ssh << [Error that it exists is OK.]
chmod go-w / ~
cp /etc/ssh_config /etc/ssh_config.bak
echo AuthorizedKeysFile .ssh/authorized_keys >> /etc/sshd_config
exit

You should see the following output:
Connection to iphone closed.
wayne@gutsy:~$

5. Configure SSH keys on your Linux PC/
scp ~/.ssh/id_rsa.pub root@iphone:.ssh/authorized_keys

You should see something like this:
root@iphone's password: [type the new password you setup here]
id_rsa.pub 100% 393 0.4KB/s 00:00
wayne@gutsy:~$

6. Mount your iPhone using sshfs

sudo mkdir /media/iphone/ -m 777

When running sshfs you may receive errors. Common ones are about /dev/fuse – logout, reauthenticate using su - wayne, or rebooting is a simple solution (although not needed).

sshfs root@iphone:/var/root/Media /media/iphone/
ln -s /media/iphone/iTunes_Control /media/iphone/iPod_Control

7. Install SVN versions of Rhythmbox and Libgpod

Download the debs here. (Thanks funk for packaging these!)
Extract this file with Archive Manager, then double click on each one and install each package.

After installing all of these, when you open up Rhythmbox via Applications | Sound & Video | Rythmbox, your iPhone will magically appear in the devices list, and allow you to stream media via wireless. If it’s not working, make sure that you can still browse to /media/iphone and view files yourself.

To ummount the iPhone:
fusermount -u /media/iphone

To re-mount the iPhone:
sshfs root@iPhone:/var/root/Media /media/iphone/

Did you run into any problems? Comment here and I’ll help you out best I can.

Bonus tip: Mount /var/root/Library/Ringtones instead and load up on ringtones!

10 Internet Resources ALL Linux Users Need To Know About

Why do we waste time reading articles about Linux that don’t provide what they promise in the title?

This article doesn’t give you just 10, but eleven types of resources that ALL new or experienced Linux users should bookmark, or at the very least be familiar with in case they get stuck or have a problem that needs fixing. I realize that I failed to deliver exactly what was I promised in the title. Please accept my most sincere apologies.

Unless we are lucky and own one of the new manufacture-supported computers that come pre-loaded with Linux, we will need to fix problems ourselves. These resources are the best ways to find support and assistance for fixing those nasty errors we can sometimes get in Linux.

1. History:
Undoubtedly we’ll will want to brag or casually talk about Linux with friends, family and acquaintances, so let’s start with the basic history. The Linux page at Wikipedia will teach us all we need to know about the history behind Linux. After reading this, can you tell me when Linus first began working on the non-commercial replacement for MINIX? If not, go back and read it again.

2. Distribution Selection:
If we haven’t already, we’ll need to go ahead and select a distribution that fits you. The premier resource to find distributions is DistroWatch. Even if we already know what we’re going to be using, I suggest visiting there on a monthly basis, or subscribe to their RSS feed to keep up-to-date with new releases.

3. Forums:
Become part of the community and join a forum. The two most active forums I am aware of are Linux Forums and Linux Questions. Those are a great general resource, but you may want to find the forum for your specific distribution, where you can find specialized help from people who know some of the more intricate details of your chosen distro.

Article Bonus:
Top 10 Linux Distributions’ Forum Websites:

PCLinuxOS, Ubuntu, SUSE , Fedora, Sabayon, Linux Mint, Debian, Mepis, Mandriva, DSL

4. News:
There are so many out there, but I’ll list the most important ones that we will want to read so we keep up to date with trends. Slashdot, LXer, Linux Today, Linux.com, and my personal favorite, the Digg Linux/Unix section.

5. Console/Terminal Familiarity:
Usually, we can get along just fine in Linux without using the console in most cases, but sometimes you just gotta get down and dirty. The more you do, the more you learn about the system. Here’s a few: Linux Shortcuts and Commands, Linux Newbie Administrator Guide, Linux Command Reference, How To Look Like A UNIX Guru, and my favorite, Linux Command Line Tips

6. Books:
There are lots of books to read about Linux, and costs range from free to priceless. For example, Introduction to Linux – A Hands on Guide. I don’t recommend books to most people, because it’s an awful lot of information to take in. If you want to go with something that isn’t a snore, I personally enjoyed Linux In A Nutshell.

7. Wiki for your distribution:
Wikis are websites that anyone can add information to, the most famous of them is Wikipedia. A wiki can be as simple as a FAQ, or a complete and total documentation source for every program that is maintained or supported by our distribution of choice.

8. “Alternative” Media; Newsgroups/IRC/Mailing Lists.
Newsgroups for Linux are listed at Linux.org. IRC for your specific distribution can be found by searching for the terms “IRC” followed by the distro name. You can get a LOT of very specialized help in these IRC rooms. Just imagine a chat room filled with hundreds of Linux enthusiasts. Somone is bound to help. IRC can be a real life saver when you are in DIRE need of assistance. For example, if you get stuck in read-only mode, and can’t bootup properly. Login to IRC, someone probably can probably figure out the problem. Mailing lists are also grouped as an alternative media, because most people don’t like to have a million emails flood their inbox and clutter things up. Here’s a suggestion: Create a brand new Gmail account, and use the RSS feed of that email account to view topics as you want to. Or, set up the mailing list preferences to send you a condensed version of the list on a daily basis.

9. Search for the Answer:
I hate to mention this one, because it seems like common sense to me. If we get an error in any program, the chances are that someone else has already had this problem, and posted about it online. Simply copy and paste the error, throw it into a Google Search, and enclose it within quotes to make sure you get the most relavent results. Nine times out of ten we will receive multiple hits, as well as a fix.

10. Ask Questions:
Learning how to ask smart questions is difficult. Luckily, I just provided a link that will teach you exactly how to do it! Once you learn to ask smart questions, the answers you seek (even “stupid” questions) will come faster, and you will learn from experience.

11. Podcasts:
If you’ve got an iPod or CD player (use CD/RWs) in your car, there’s two podcasts that you may want to listen in on: The Linux Action Show is mainly news and is really fun show to listen to. Going Linux is about “how to get stuff done.” Going Linux is by far and above one of the most comprehensive podcasts I have listened to on ANY topic. Linux Reality is also notable. These are perfect for long commutes, and they’re free, so throw away your satellite radio and start learning something on your way to work or school.

If you are familiar with and utilize these 11 resources above, I promise that you will be able to rub elbows with fellow Linux users of any level of experience.

Stay tuned, and hit the RSS feed on the left if you like. I know it’s annoying. Am I going to change it? I know it’s not hard, but I think the RSS feed scrolly icon thinger going or staying should be a community choice. There will be a poll in the sidebar shortly.

I hope you all enjoyed this article, and for my regular readers – I am still working on the ‘cost of free software’ series part 3 and will hopefully be finished soon. I did NOT anticipate that it would take over 3 days to download the complete source code of Ubuntu.