Wednesday, April 24, 2013

How to Browse From the Linux Terminal With W3M


W3M is a terminal web browser for Linux. It’s got a few tricks up its sleeve, including support for images, tabs, tables, frames and other features not usually included with terminal web browsers.
If you’ve used Linux for a while, you probably remember using a terminal browser to Google up a solution for your hardware when the X server refused to load. Modern X servers have advanced far beyond this, but W3M and other terminal browsers can still be useful.

Installing W3M

W3M isn’t included by default on most Linux distributions. You’ll want to install the main w3m package and the w3m-img package if you want inline image support. Use the following command on Ubuntu:
sudo apt-get install w3m w3m-img

Basic Browsing

W3M has quite a few command-line options, but none are mandatory. The only thing you need to specify is a web page address. Want to bring up Google? Just use the w3m google.com command.

You can use the arrow keys to move the cursor around or click at a desired location to move the cursor there. If you want to type in a text box, select the text box with your cursor and press Enter before typing your text. W3M treats your keystrokes as commands if you just start typing.

Load a hyperlink by selecting it with your cursor and pressing Enter. You don’t have to select hyperlinks manually — press the Tab key to position your cursor over the next hyperlink on the page.

Shift-B will take you back a page. If you want to load a different URL, press Shift-U and you’ll get an URL prompt. Press Shift-H to view the help page if you want to see a more complete list of keyboard shortcuts.

Images in the Terminal


W3M supports images, so where are they? Well, terminals like GNOME Terminal and KDE’s Konsole can’t display W3M’s images. Other terminals, such as Xterm, can. W3M will also display images if you’re running it in a framebuffer console, so you don’t need an X server running to take advantage of this feature.

Another feature that doesn’t work in GNOME Terminal or Konsole is W3M’s right-click menu.

Browser Tabs

How did we ever live without tabs? They’re an essential feature for desktop web browsers. W3M includes tabs, too. Just press Shift-T to open a new tab.

You can switch between tabs by clicking them, but we’re trying to be terminal ninjas here. Use the { and } keys to switch between tabs without touching your mouse (that’s Shift-[ and Shift-]).

Gmail in the Terminal

W3M isn’t stuck in the past, like Lynx (another web browser for the terminal) is. It can render tables, frames and even has support for Gmail’s basic HTML interface.

You’d probably feel more comfortable accessing Gmail with an IMAP client from your terminal, but hey — it works.

More Documentation

In addition to pressing Shift-H to view W3M’s help page, you can view the full manual on W3M’s website. The manual lists all of W3M’s command-line switches and key bindings.

Heads-Up Display (HUD) to Replace Application Menus in Unity [Ubuntu News]

Mark Shuttleworth has made an announcement introducing a new UI enhancment in the upcoming 12.04 LTS release. Application menus will be replaced by a new Heads-Up Display (HUD) that utilizes an intelligent search-based approach to access the menu items you need and expands on the Unity experience.
Image courtesy of Mark Shuttleworth’s Blog.
From Mark’s blog post: This is the HUD. It’s a way for you to express your intent and have the application respond appropriately. We think of it as “beyond interface”, it’s the “intenterface”. This concept of “intent-driven interface” has been a primary theme of our work in the Unity shell, with dash search as a first class experience pioneered in Unity. Now we are bringing the same vision to the application, in a way which is completely compatible with existing applications and menus.
The HUD concept has been the driver for all the work we’ve done in unifying menu systems across Gtk, Qt and other toolkit apps in the past two years. So far, that’s shown up as the global menu. In 12.04, it also gives us the first cut of the HUD.
You can see the new Heads-Up Display (HUD) in action in the following video.
This is definitely going to be a step above and beyond the work already done with Unity. What are your thoughts on the new Heads-Up Display (HUD)? Do you think this is a good direction for Ubuntu or do you feel it will alienate users? Is this a good enhancement for Unity or a step further in the wrong direction? Let us know your thoughts in the comments!

Bonus

You can try out the new Heads-Up Display (HUD) in Ubuntu 12.04 now by visiting the Ubuntu Vibes blog post linked below for installation details!
Introducing the HUD. Say hello to the future of the menu. [via OMG! Ubuntu! and Ubuntu Vibes]
Introducing the HUD to Ubuntu [YouTube]

How to Make Programs Start Automatically in Linux Mint 12

sshot-2
In Windows we have the Startup folder where we can easily place a shortcut to a program that we want to launch automatically. In Linux Mint there is a way easier way to manage startup applications–here’s how to do it.
Note: Since this is just for demonstration purposes I will be setting VLC Media Player to start automatically. However, this will work with any application.
The first thing you are going to want to do is click on the Applications menu, then select Other and launch “Startup  Applications”

You will now be able to see the applications that are set to startup

Go ahead and click on the Add button

Give your startup item a name, I will just call mine VLC

Now click on the browse button and navigate to where your application is installed. For most applications this is at:
File System > usr >  bin
Now select your application and click on the open button

Now click on the add button

Your application is now set to startup automatically

Pro Tip

If you have been using Linux Mint for a while you might notice that the Startup Applications Preferences has far fewer entries than before. This is because most of them are hidden by default, to get them back launch Terminal and run the following command:
sudo sed -i 's/NoDisplay=true/NoDisplay=false/g' /etc/xdg/autostart/*.desktop
Now you will be able to see all the applications and services that are set to automatically start

Install Linux Mint’s New Cinnamon Desktop on Ubuntu


Tired of Ubuntu’s Unity desktop environment? Try Cinnamon, the latest desktop environment from Linux Mint. Cinnamon offers a more traditional, GNOME 2-like layout, but it’s based on the modern GNOME Shell — and you can install it on Ubuntu.
One day, Cinnamon will be Linux Mint’s default desktop environment. It’s forked from GNOME Shell instead of being based on GNOME 2, so it can take advantage of modern technologies and shed GNOME 2’s outdated software.

Cinnamon vs. MGSE vs. MATE

Linux Mint has quite a few different desktop environments. Mint GNOME Shell Extensions (MGSE) offers several extensions that modify the way GNOME Shell works — Cinnamon builds on MGSE and replaces it. Linux Mint also includes the MATE desktop, which is a fork of the outdated GNOME 2 desktop environment. Cinnamon is more forward-looking than MATE, but doesn’t abandon GNOME’s traditional interface like GNOME Shell does.

Installing Cinnamon

You don’t have to use Mint to get the Cinnamon desktop. It’s available in a personal package archive (PPA) for Ubuntu 11.10 and 12.04.

First, you’ll need to bring up a terminal and run the following command, which adds the personal package archive to your Ubuntu system as a software source:
sudo add-apt-repository ppa:merlwiz79/cinnamon-ppa
Press Enter when it prompts you

Second, download a list of available packages by running this command:
sudo apt-get update
Now you’re ready to install Cinnamon’s packages with this command:
sudo apt-get install cinnamon cinnamon-session cinnamon-settings
Type Y and press Enter when prompted.

Use another Linux distribution? You can find instructions for your distribution, or just a link to download the source code, on Cinnamon’s official download page.

Starting Cinnamon

Cinnamon doesn’t replace your existing Ubuntu desktop environment. It just adds a new option to your login screen. You’ll need to log out before starting Cinnamon.

After logging out, select Cinnamon from the login screen and log back in.

Using Cinnamon

Cinnamon comes with a single panel on the bottom of the screen, just like Linux Mint’s GNOME 2 desktop environment did. At the left side, you’ll find a menu that’s more similar to Linux Mint’s traditional applications menu than it is to GNOME Shell’s full-screen applications menu. Unlike GNOME Shell, the panel also contains a traditional window list.

At the right side, you’ll find music and network icons, a clock and workspace switcher. The music applet is particularly polished — it lets you control music players from your panel.

You can launch the Cinnamon Settings application from the menu, but it has few options at the moment. Linux Mint want Cinnamon to be much more configurable — another difference from GNOME 3 — but most options aren’t available yet.

Disabling the Global Menu


You might notice Ubuntu’s global menu bar still appears at the top of the screen. If you want to get rid of it, just run the following command, then log out and back in:
sudo apt-get remove appmenu-gtk3 appmenu-gtk appmenu-qt
Want it back? Just replace “remove” with “install” to reinstall the packages:
sudo apt-get install appmenu-gtk3 appmenu-gtk appmenu-qt

Cinnamon is still new, so don’t be surprised if some features are rough around the edges. Still, it’s an impressively modern take on a traditional Linux desktop layout. Cinnamon and Linux Mint are projects to keep an eye on.

How To Customize Ubuntu’s Message of the Day


Ubuntu displays an informative message, known as the message of the day, when a user logs in at the terminal. The MOTD is fully customizable — you can add your own text and other dynamic data.
When a user logs in, the pam_motd process executes the scripts in the /etc/update-motd.d directory and dynamically creates the message of the day. You can customize the MOTD by modifying the scripts, removing them or writing your own scripts.

The Default Message of the Day

The message of the day is only shown when you log into Ubuntu in text mode, not graphical mode. You can access a virtual terminal with the Ctrl-Alt-F1 shortcut if you’re using a graphical desktop — use the Ctrl-Alt-F7 shortcut to get back to your graphical desktop, also known as your X server. Ctrl-Alt-F2 through Ctrl-Alt-F6 will take you to other virtual terminals.

Here’s Ubuntu’s standard MOTD. It shows the typical system version numbers you’ll be familiar with if you’re a long-time Linux user. It also shows dynamically generated information about available updates and static messages about Ubuntu’s license.

Adding a Custom Message

Let’s say you want to add a custom message users will see when they log into your Ubuntu system. Ubuntu’s MOTD is generated by scripts when you log in, so you can’t just add it to the /etc/motd file. The place to put your own static messages is /etc/motd.tail — the contents of this file are added to the end of the MOTD when it’s generated.
Let’s use the Nano text editor to open the /etc/motd.tail file with the following command: (Linux terminal wizards can use Vi or Emacs, but Nano is easier for newbies)
sudo nano /etc/motd.tail

This file is completely empty by default. Just enter any message you like — feel free to go crazy with black-and-white ASCII art here. Once you’re done, save the file with Ctrl+O and Enter, then exit Nano with Ctrl+X.

The next time any user logs in, they’ll see your custom message. If you want to check it out immediately, log out of the terminal with the exit command and log back in.

Removing Information

Now let’s say we want to remove some of the default information. It’s not just a matter of editting a single file — each section is automatically generated from a script located in the /etc/update-motd.d directory.
You can get a full list of the files in this directory by typing /etc/update-motd.d at the terminal and pressing Tab.

The scripts are run in numerical order, which is why they’re prefixed with numbers. You could rename the script files and change the numbers to rearrange the order of the different sections in the MOTD, if you liked.
To remove a script’s information from the MOTD, we just have to prevent it from running. We can do this by removing its execute permissions with the chmod -x command.
If we wanted to remove the documentation text in the MOTD, we’d run the following command:
sudo chmod -x /etc/update-motd.d/10-help-text

The next time a user logs in, they won’t see the documentation line.

Adding Dynamic Information

We can write our own scripts to add any dynamic information we like to the MOTD. As an example, let’s try using the weather-util package to create a script that adds the current local weather to the MOTD.
It’s not installed by default, so let’s install it with the following command:
sudo apt-get install weather-util

You’ll need your local International Civil Aviation Organization code, which you can get from this website. Here’s how to use weather-util with your code:
weather -i CODE

Now let’s use the following command to create a script in the appropriate location and open it with Nano:
sudo nano /etc/update-motd.d/98-weather
After Nano opens, enter the following code, replacing CODE with your local weather code:
#!/bin/sh
echo
weather -i CODE
echo
Press Ctrl-O and Enter to save, then press Ctrl-X to quit.

Make the script executable with chmod +x or it won’t run:
sudo chmod +x /etc/update-motd.d/98-weather
Now users will see a local weather forecast when they log in. There’s nothing special about weather-util — you can use any command that prints text to the terminal.


The MOTD isn’t only displayed when users log in locally. Any users that log in remotely with SSH or Telnet will also see your customized MOTD.

How to Install Screenlets for Desktop Widgets in Linux Mint 12

00_screenlets_added_to_desktop
Screenlets are small applications that are similar to Gadgets in Windows 7, that allow you to place things like sticky notes, clocks, calendars on your Linux Mint desktop. Screenlets represent items you might keep on a physical desktop, plus more.
We’ll show you how to install the Screenlets program, add screenlets to your desktop and remove them, and how to add screenlets that you download from the internet.
To install the Screenlets program, select Other | Software Manager from the Applications menu.

Enter “screenlet” (without the quotes) in the search box in the upper, right corner of the Software Manager window. You do not need to press Enter, because the results displays as you type. Click “screenlets” in the list that displays.

Click Install on the screen that displays.

You must authenticate when installing software. Enter your password in the Password edit box and click Authenticate.

The progress of the installation displays at the bottom of the Software Manager dialog box.

You may notice that the Software Manager dialog box still says the application is not installed even though the installation has finished. That seems to be a minor bug. To fix it, click Search results at the top of the dialog box, and then click “screenlets” in the list of search results again.

The dialog box should now say Installed and show a Remove button, as well.

To close the Software Manager, select Close from the File menu.

To open the Screenlets application, select Accessories | Screenlets from the Applications menu.

For this example, we will add the ClearWeather screenlet to the desktop. To do this, select the ClearWeather screenlet in the pane on the right side of the Screenlets Manager dialog box. Click Launch/Add.

The screenlet is added to your desktop. You can move it to a different location by clicking and holding down the mouse button on the screenlet as you move it.
Right-click on the screenlet to access a menu for it allowing you to change settings, add another instance of the screenlet, or remove the screenlet from the desktop. To change the zip code for the ClearWeather screenlet, so you can view weather for your current location, right-click on the screenlet and select Zip Code from the popup menu.

On the Zip Code dialog box, enter the desired zip code in the edit box and click OK.

The ClearWeather screenlet should now display the weather for you chosen location. However, by default, it displays the temperature in Celsius. If you’re used to Fahrenheit, you can change this. Right-click on the screenlet and select Properties from the popup menu.

On the ClearWeatherScreenlet dialog box, click the Options tab and then click the Weather sub-tab. To view the temperature in Fahrenheit, select the Use celsius temperature check box so there is NO check mark in the box. Click Close to accept your changes and close the dialog box.
NOTE: The Screenlet sub-tab is available for all screenlets and allows you to change properties common among all screenlets. It may be the only sub-tab available if there are no specific settings for the current screenlet.

You can also add screenlets to your desktop that you download from the internet. The following sites are two places containing screenlets you can download for free.
Once you have downloaded one or more screenlets to a folder on your system, open the Screenlets Manager again and click Install.

On the Install dialog box, make sure Install Screenlet is selected (it should be the default selection) and click OK.

On the Install a Screenlet or SuperKaramba theme dialog box, navigate to the folder in which you saved the downloaded screenlets and select a screenlet. The screenlets should be .tar.gz files. Click Open.

Once the screenlet has been added to the Screenlets Manager, the following dialog box displays. Click OK to close it and return to the Screenlets Manager.

Select the newly installed screenlet in the right pane and click Launch/Add on the left.

The screenlet is added to the desktop. You can change properties for it just as described earlier.

When the Screenlets Manager is running, an icon displays on the panel. Right-click this icon to access options for the Screenlets Manager. You can quickly open the Screenlets Manager after you have minimized it by selecting Screenlets Manager from this popup menu. You can also easily install Screenlets, get more Screenlets, launch installed Screenlets, close or restart all Screenlets, and quit the Screenlets program.

To close a specific Screenlet, right-click on the screenlet on the desktop and select Quit this <name of screenlet> from the popup menu. If you have more than one of the selected Screenlet open, you can close all of them by right-clicking on any one of that particular Screenlet and selecting Quit all <name of screenlet>s.

You can add many different kinds of screenlets to your desktop, such as a wireless monitor, a network monitor, and a CPU meter. There is also a screenlet that allows you to follow your friends tweets and post your own, and one to display your Google Calendar events on your desktop.