Monday, May 26, 2014

Multi-Move At The Command Line

For those who spend any time in the Linux command line, it doesn’t take long for an individual to build their own little “personal arsenal” of commands that are extremely handy or get used on a regular basis. The “mmv” command is one of those handy little command tools that people may not think about as in many cases it does not come as a standard tool in many distro’s. Most repositories will have it available though so it’s not that hard to get and it’s well worth the small amount of effort it takes to load it into one’s list of useful toolbox.

What this command does is allows a user to execute multi-file commands making it easy to deal with large amounts of files in just a few keystrokes without having to concern themselves with long strings of compounded commands or extended process of dealing with files on an individual basis. Lets take a look at just a few of the basic things this handy command makes easy for us.

As always, once installed, take a browse through the man page to get an idea of all the different variations that can be played on with this command tool. There is actually quite a bit that can be done with this less common command.


One of the more prominent uses for mmv is to modify extensions in bulk so that we can maintain unification throughout our system. In my opinion, having both upper and lower case extensions floating around is absolutely annoying and as we all know, this can happen from our phones, cameras and all sorts of other devices we may interface with. keeping extensions all in lowercase also helps identify file types more easily when working from the command line. Thus from the screenshot below, we can see how to fix this problem very easily with a simple command.


Another useful way of working with large groups of files is renaming. Below shows the results of removing the preceding portion of file names globally when possible. Suppose the month were wrong, name was wrong or something else that might need to be changed on a large scale.


Global name changing can, of course, be done in the reverse order as well. Performing this action can make identifying the contents of a directory that much easier to deal with. When working with file archives, this action comes in very handy as all the inclusive files within a directory archive can quickly and easily be matched so that anyone can easily recognize what directory that file came from or should be associated with.


Some other commands that mmv makes easy is selecting particular naming conventions to be moved to another directory. In the example below, all files starting with either “a” or “A” are being moved from directory “Test2” to directory “Test3” of which both share the same parent directory. This process can make sorting through various files at a granular level very easy to do.


For the last example, mmv can also be used as a way of changing the order of the names within a large number of files. The man page uses a good example such as large amounts of music files where someone may want to change the order of album, artist, and song title around. In the example below, I simply changed the order of words associated to one file as an example using the criteria of “an” to select just one particular file that started with those two letters to differentiate from all other files within the same directory.


In closing, mmv is very handy on multiple levels and particularly handy when organizing archives of files such as multiple file backups which may have taken place over a number of months or years. In any situation when a person needs to deal with a large amount of associated files, mmv is an invaluable tool that makes bulk management that much faster and easier to get done.






Wednesday, May 14, 2014

Text Browsing

As many people are aware there are a number of different browsers a person can use to surf the web. Everyone has their own testes of what to expect from a browser or one or two that seems to work best for them that produces the results or provides the type of functionality they require. When the average user thinks of a web browser they might think Chrome, Firefox, Internet Explorer, Safari, Opera, SeaMonkey, Konqueror, Chromium, Canary, or Arora. What many will not think of are text-only based browsers as this opens a whole new world of browsing many may not consider; enter the command line based browser Elinks.

Command line browsers or “text-based” browsers are just as one would expect; no images to get in the way. The following is the man (manual) page from the Elinks text based browser.



ELinks is a text mode WWW browser, supporting colors, table rendering, background downloading, menu driven configuration interface, tabbed browsing and slim code. Frames are supported. You can have different file formats associated with external viewers. mailto: and telnet: are supported via external clients.

While sifting through the man page is all fine and good, lets take a look at what working with a text-based browser looks like. Obviously this is not the type of entertainment for everyone as the majority of people would most prefer their standard graphics rendering, full function browser. However, for those who spend a lot of time working in the command line or are curious enough to want to learn how to get the most work done from inside a terminal without leaving as possible, text-based browsers are a neat way to surf without all the added distractions that come from graphical browsers.

When starting Elinks, this is the first screen everyone will see. A person can start here by typing in any web address which of course will take them directly to that site or, cancel this action and go directly to the browsers built in navigation to perform other actions.


For this demonstration, I wanted to use something that most people will immediately recognize even in text mode with no graphics rendering. It’s the same page as one would view from any other browser, but rendered with text only inside a CLI (command line interface).


Welcome to the all familiar Google search page!

Selected fields can be navigated using the arrow keys then learning to click enter to select a field, type in text then click enter again to submit that text to the web server. Elinks will produce pop-ups that ask for confirmation that the following action is really what a person wants to do.

Typing in “text based browsers” into the Google search field produces results that look like the screenshot below.



This probably looks familiar from a layout perspective, however missing all the added “bells and whistles’ that most people are accustomed to looking at. Working with a text based browser is really great for data mining though as it removes all the “distractions” commonly associated with graphical browsers.

In the upper left are the standard options provided by Google search pages but click on [Esc] and the Elinks menu is produced that allows us to utilize all the typical browser functions a person would expect. Below is just a sample from the first dropdown.



While some may think of a text browser as “stripped down” the functionality built in is by no means lacking in capabilities one can perform similar to any other graphics style browser.

Obviously text browsing is not for everyone. For those who take an interest in working solely from the command line interface or are simply curious as to all the command line has to offer, a text browser is a must have in any arsenal and being able to use and navigate through one is not a bad skill to have.

Tuesday, May 13, 2014

Play WMV on Kubuntu 14.04

Just a few days ago I had to work with some multimedia files shared through one of my IT teams at the university. Since I’m a Linux user among Windows users, sometimes we have to “clean up” after some files that Windows systems have a tendency to produce. One such situation involves both wmv files and mp3 files that come from Microsoft software products that don’t seem to like to play well with Linux systems; here’s how to get around that.

Checking the properties of the wmv files we find this added “baggage” that doesn’t need to be there. A little research on ASF produced from Wikipedia comes back with:

Advanced Systems Format (formerly Advanced Streaming Format, Active Streaming Format) is Microsoft's proprietary digital audio/digital video container format, especially meant for streaming media. ASF is part of the Windows Media framework.



So what we need to do is “clean” the file and remove the baggage out that is preventing us from playing the file just as any other format.We can do this easily by using a program called Format Junkie which may not easily be found from the Ubuntu Software Center but can be located with instructions on how to install through any web search; don’t worry, the binaries are available.



The interface is super easy to figure out so just add the file with the extra “bugs” in it and select the output type from the drop down. To change the output directory select Edit at the top and go into the Properties. If it seems like it’s not doing anything just be patient, it’s working.



Above is the screenshot of the “cleaned” file with the bugs missing. I changed the format type in this example but it’s easy to keep the type if one wants to. Below is VLC playing the file which once wouldn’t do anything for me on Kubuntu 14.04.



This file was originally a ppt that I converted to a wmv using MSO2010 then needed to inspect the output prior to having it hosted online.

As always, I hope this tutorial helps some others get around certain file types on their Linux systems as well so they can press forward with whatever projects they may be working on. In retrospect, wouldn't it be so much easier if all our operating systems could just play nice with each other?

Update 1/15/2015:

For those who would prefer not to rely on a GUI based format converter, try pacpl. This program is written in Perl and supports a substantial number of formats.

http://vorzox.wix.com/pacpl