How to Play Ogg Vorbis Files from the Linux Command Line

HeadphonesIf you’re a dedicated user of free and open source software, chances are your dedication goes beyond just software. You probably try to use as many open file formats as you can. Document formats, video formats, and audio formats. Especially audio formats.

In the world of free and open source software, a popular format is Ogg Vorbis. Ogg Vorbis offers comparable audio quality and file compression as MP3, but without all the potential hassles the come from the patents that apply to MP3.

Just about every free and open source desktop media player supports Ogg Vorbis. But what if you want a player that’s a little lighter, or are using a stripped-down Linux distribution on an older, underpowered computer? The obvious answer: turn to the command line.

Using a command line application called ogg123, you can play back your Ogg Vorbis files without a lot of overhead.

Installing ogg123

ogg123 isn’t a standalone application. It’s part of a package called vorbis-tools. vorbis-tools comes pre-installed with a number of Linux distributions. To find out if it’s installed in yours, open a terminal window and type the following command:

which ogg123

If the command returns something like the following (/usr/bin/ogg123 in this example), then you’re ready to go.
Is ogg123 installed?

Otherwise, you need to install vorbis-tools. You can do that using your favorite package manager. If vorbis-tools isn’t available, then you can download and install it manually.

Using ogg123

Open a terminal window and change to the directory containing the files that you want to play. Then type the command ogg123 *.oga. This will play all of the files in the directory, in order.

That’s not very exciting, is it? If you want to shuffle the tracks to play them randomly, then type ogg123 -z *.oga.

Playing an Ogg Vorbis file

If you’ve ripped songs off of a CD, chances are the ripping process created a playlist file (with the extension .m3u). You can use that with ogg123 by typing the command ogg123 -@ playlist.m3u, substituting the actual name of the file for playlist.

To jump to the next track, press CTRL+C on your keyboard.

Note that ogg123 has a number of options. You can view them by typing ogg123 at the command line or viewing this reference.

Dealing with Cover Art

Music files, no matter what their formats, contain a number of tags. These tags include the title of the track, the name of the album, the artist, and the like. One of the tags also points to cover art. When you play the file in a graphical music player, an image of the album’s cover appears in the player.

If an Ogg Vorbis file you’re playing with ogg123 contains the cover art tag, ogg123 will try to render the art. However, you won’t get the image. Instead, you’ll get a stream of numbers and letters, like this:

Trying to render cover art. Not pretty!

There’s no way to suppress this, sorry.

Summing Up

ogg123 is a simple yet effective media player for the Linux command line. It’s easy to use and does a very good job. It has one or two small quirks, but those are easy to ignore. In fact, once you start using ogg123 you might just wind up using it instead of your favorite GUI music player.

Photo credit: celiece

5 Basic Commands Every Linux User Should Know

Typing commands

Typing commandsSo you’ve been using Linux for a while but have never gone to the command line. Hmm … guess what? That’s not uncommon. While you don’t need to go to the command line to effectively use Linux, knowing even a few basic commands can be useful. That knowledge can open a few doors, expand your computing experience, and in some cases save your bacon.

But if you’re thinking about taking your first steps at the Linux command line, where do you start? There are literally hundreds of commands and it can be difficult to know which ones are useful to you.

Let’s take a look at five basic Linux commands that every user should know. Not only are these commands immediately useful, they’re a good foundation on which to build your knowledge of the command line.

1. cd

When you pop open a terminal window, you’re probably not in the directory in which you want to be. So, how do you get there? By using the cd command. Short for change directory, cd lets you quickly move around the command line.

To change to a directory, just type cd [directory_name] — for example, cd documents. Obviously, you can use this command to navigate to subdirectories, too.

What happens when you’re several subdirectories deep and want to move up a directory or two? To move back up one directory, type cd ... To move two directories up, type cd ../... You can see a pattern emerging here …

2. ls

You’ve moved into a directory and now you want to see what’s in there. To do that, type ls.

What the ls command returns

That’s all fine and dandy, but what if you want to find out more about one or more files? Like how big it is or when it was created or last modified? Type ls -l.

ls with the -l option

The -l option lists the permissions on the file, who owns it, who last edited it, its size in kilobytes, and the date and time when it was last modified.

While many people use ls with an entire directory, you can also use it with a single file or groups of files. How? For a single file, type ls [file_name]. For multiple files, use a wildcard — for example, ls *.html.

3. cp

Next up, the command to copy files: cp. There are a number of ways to use cp. The most common way to use this command is to copy a file to another directory.

To copy a file to another directory, type cp [file_name] [directory_name]. Say you want to copy a file named blue_background.png to the directory web_graphics/backgrounds. The directory is two levels above the directory you’re currently in. Type cp blue_background.png ../../web_graphics/backgrounds.

Remember that unless you’re at the top of your home directory (for example, /home/scott) or are copying a file to a directory that’s below the one you’re in, you need to do one of the following:

  • Enter the full path to the directory into which you’re copying a file
  • Specify how many levels up the target directory is (using ../)

Of course, you can copy multiple files with cp by using a wildcard — for example, cp *.odt myDocuments.

4. mv

Now that you know how to copy files, it’s time to learn how to move them around. That’s where the mv command comes in. You can use that command to either move files to another directory or rename them in place.

When you want to move a file to another directory, mv uses the same command syntax as cp: mv [file_name] [directory_name]. Let’s say you want to move a file named blue_background.png to the directory web_graphics/backgrounds. The directory is two levels above the directory you’re currently in. Type mv blue_background.png ../../web_graphics/backgrounds.

And, as with the cp command you can move multiple files by using a wildcard — for example, cp *.pdf Reports.

To rename a file, just type mv [file_name] [new_file_name] — for example, mv 14217_6794.jpg fast_typing.jpg.

5. rm

Finally, one of the more dangerous commands you’ll run into: rm. Use this command to delete files, but remember to use it with caution. You aren’t warned that you’re about to delete one or more files. Once you delete something, it’s gone.

To delete a file, type rm [file_name] — for example, rm presentation_template_2009.odp. To delete multiple files, use a wildcard — for example, rm *.odp.

Delving Deeper

Maybe this article has whetted your appetite for the command line and you want to learn more. Not just about other commands, but also the other options for the five commands that were just introduced. There are a number of excellent resources available to do just that.

I usually recommend two. First, Linux Phrasebook by Scott Granneman. It’s an indispensable dead-trees book. If your tastes are more aligned with the online world, then check out out Introduction to the Linux Command Line by the folks at FLOSS Manuals. It’s easily one of the best guides to the command line out there.

Photo credit: mulligand

How to Learn the Linux Command Line with CLI Companion

CLI Companion

CLI CompanionContrary to an enduring myth, you don’t need to constantly jump to the command line in order to effectively use Linux. There are people who spend all their time ensconced in their favorite window manager who’ve never, and never will, type a string of esoteric commands.

Having said that, there are times when knowledge of the command line can be useful. More than that, it can be beneficial. But what if you’re new to the command line, or just use it infrequently?

There are dozens of good books on the subject, and even more websites and other online resources. Having to grab a book or go to a website to find out, or refresh your memory about, how to do something can really disrupt your workflow. What if you could have a list of the commands that you use available right in your terminal window?

If you’re an Ubuntu user and that’s what you’re looking for, then it’s time to give CLI Companion a look.

CLI Companion?

CLI Companion is a yet another terminal application. But it’s a bit more than that. What sets CLI Companion apart is that you can store commands that you use frequently (or even just every so often). CLI Companion saves those commands in a text file (called a command dictionary) named .clicompanion2 found in your /home directory.

To get CLI Companion, you can download an installer here. After you’ve downloaded it, double-click on the file with the extension .deb to install. You can also install CLI Companion through a Personal Package Archive (PPA). Do that by opening a terminal window and entering the following commands:

sudo add-apt-repository ppa:clicompanion-devs/clicompanion-nightlies sudo apt-get update sudo apt-get install clicompanion

Now that it’s installed, let’s start working with CLI Companion.

Using CLI Companion

Start CLI Companion by selecting Applications > Accessories > CLI Companion. You can then type the command that you want to run in the main area of the CLI Companion window.

CLI Companion main window

Simple enough, but what about the command dictionary? Click on Command List to open it.

CLI Companion command dictionary

CLI Companion comes pre-loaded with a number of commands, ranging from commands to list the contents of a directory to networking commands. To run a command, click on it in the dictionary and then click Run.

You’ll notice that some of the commands in the dictionary have one or more question marks after them. This means that when you run the command, you’ll need to enter some information — for example, a directory path or the name of one or more files. When you run one of those commands, a dialog box pops up asking for the additional information.

Prompting for options

Just type the required information and then click OK.

Saving your own commands

What gives CLI Companion its power and flexibility is the ability for you to add your own commands to the dictionary. This is especially useful if you want to save commands that you use infrequently, but which are handy.

Click the Add button. A dialog box opens.

Dialog box for adding a command

Type the command that you want to run on the Command field. You might need to consult your favorite command line reference. That’s OK. You’ll only need to do it once for a command.

If you need to input one or more options when the command is executed, remember to add the correct number of question marks. Then, type a hint for each option in the User Input field. Finally, type a short description of the command in the Description field.

A custom command

Click OK to save the command. Simple, no?

CLI Companion is a great way to learn the command line, or to refresh your memory about commands that you haven’t used in some time. While I’m no command line tyro, I find CLI Companion very useful. Especially for those commands that I don’t regularly use.

Using the Linux Command Line with Nautilus Terminal

Nautilus logo

Nautilus logoOne myth about Linux that just won’t die is that you absolutely need to understand and use the command line to get the most out of it. I know a number of Linux users who’ve never cracked open a terminal window, and they’re quite happy.

That said, I find the command line to be an essential part of my toolkit. And, like much in the Linux world, there are a number of options for getting to the command line. One of my favorites is an add-on for the Nautilus file manager called Nautilus Terminal.

Let’s take a look at it.

A Terminal in Nautilus?

That’s what’s advertised, and that’s what you get. Nautilus Terminal embeds a terminal at the top of the Nautilus window. You can run any command from Nautilus Terminal and no matter what directory you’re in, that’s where the terminal opens.

Nautilus Terminal

And if you move around directories in Nautilus, the terminal follows you. So, if you start in /usr/local/bin and move to the directory /usr/share, Nautilus Terminal changes to /usr/share automatically. No need to use the cd command to move around.

Getting Up and Running

That’s pretty easy. You can download the source code for Nautilus Terminal and compile it yourself. Or, you can get packages for Ubuntu, Fedora, Frugalware, and Gentoo. The Nautilus Terminal download page explains how to get those packages.

Once you’ve installed Nautilus Terminal, fire up Nautilus. The embedded terminal will be open.

Customizing Nautilus Terminal

I don’t know about you, but I find having the terminal open all of the time a bit annoying. It takes up a lot of space and can be distracting. You can either click the Close button to hide the terminal, or you can change the settings by clicking the Preferences icon.

Setting preferences

In the Preferences window, click the Start Nautilus Terminal hidden checkbox.

Notice that you can also change:

  • The number of lines to display in the terminal window
  • Whether or not to show a scrollbar
  • The shape of the cursor in the terminal
  • The colors that you use with Nautilus Terminal
  • The font used in the terminal

Using Nautilus Terminal

Let’s assume you’ve set up Nautilus Terminal to hide until you need it. Whenever you need to use Nautilus Terminal, just click the Show button. From there, type the command(s) that you need to run and then press Enter.

Nautilus Terminal in action

Then, click the Close button and continue with what you’re doing.

While I don’t spend an enormous amount of time in Nautilus, I do quite a bit of work — file management, maintenance, and the like — with it every day. Having an embedded terminal window makes it easier on those frequent occasions when I need to use the command line.

Take Your To Do List to the Command Line

If you’re serious about your to do list and want to be sure that you can use it in the future, then you should think about embracing your inner geek by 1) going text only, and 2) doing everything at the command line. The best way to do that is with Todo.txt.

Hold On … The Command Line?

You’re probably wondering why you should use the command line instead of popular Web applications like Remember the Milk, Toodledo, Todoist, or Ta-Da Lists. They’re all great, no doubt about it. But you need to be connected to the Internet to use them. And it’s not easy to export or move data between those apps or to other services.

With Todo.txt, you’re using a text file. And let’s be honest, the format of a text file hasn’t changed in … well, a long time.

Getting Going

Todo.txt is a shell script. To use it, you’ll need a bash shell. That’s not a problem if you use Linux or Mac OS — they both come with one built in. Windows users, on the other hand, are out of luck. Unless, of course, they use something called Cygwin (tools that add a Linux-like environment to Windows).

Once you have a bash shell, now all you need to do is download the archive containing the script. When you pop that archive open, you’ll see it contains two files:

  • todo.sh, the shell script
  • todo.cfg, a configuration file

Extract the files to a folder in your path — on my Linux-powered laptops, I put them in /usr/local/bin. Then, edit the file todo.cfg to point the shell script to where you want to store the actual to do list file. Look for the entry EXPORT TODO_DIR= and change the path.

Editing the configuration file

Using Todo.txt

Let’s start by adding a task. Open a terminal window and then type todo.sh add [task] — for example, todo.sh add Edit Chromium FLOSS Manual. Then, press Enter.

Adding a task

Obviously, you’ll want to check your to do list from time to time. Do that by typing todo.sh list in a terminal window.

Listing your tasks

Notice that each item in the list has a number. That number is useful to know when you want to add a priority to a specific task or mark the task as complete.

Why add a priority? Well, some tasks are more important than others. Adding a priority moves them up in the list. Priorities start at A (most important), and move down from there.

To add a priority, type todo.sh p [task number] letter, where letter is a letter of the alphabet. For example, todo.sh p 7 B. That adds a priority of B to task 7 in the list.

Marking a task as done

Finally, when you’ve completed a task you can mark it as done and remove it from the list by typing todo.sh do [task number] — for example, todo.sh do 7.

Todo.txt can do a lot more. To learn about all of the available options, type todo.sh -h to read the help.

Going Graphical

You say you like the idea of Todo.txt, but the command line part is a bit geeky for you. If you have an Android-powered phone or tablet and an account with Dropbox (an online file storage and syncing service), then you can install an app called Todo.txt Touch on your phone from the Android Market.

Todo.txt Touch everything that todo.sh does at the command line, but on a touchscreen. The app saves your to do list to a folder in Dropbox. From there, you can share the list with your computer and/or with any other Android-powered devices you might own.

Todo.txt on your phone

Final Thoughts

Even though using the command line sounds difficult and a tad geeky, Todo.txt is easy to learn and use. Even for the most ardent GUI addict. And by using Todo.txt Touch on your Android device, you can literally have your to do list anywhere and in a format that won’t be obsolete anytime soon.

Image credit: Dean Shareski

How To Enable The Telnet Client In Windows 7

As a system administrator, having all of your software utilities quickly accessible can make your job easier.  One piece of software often used by admins is the Microsoft Telnet Client.

Unlike previous versions of the Windows operating system, Windows 7 does not have the Microsoft Telnet client installed by default.  System administrators can quickly see this when typing ‘telnet‘ on the Windows 7 command line.

In this guide I will show you how to enable the Telnet client in Windows 7.

Step 1

Click the Start menu and navigate to Control Panel > Programs > Programs and Features and select Turn Windows features on or off.

Step 2

In the new window that opens, scroll down until you see Telnet Client.  Check the box and click OK.

Step 3

Start the Microsoft Telnet Client by clicking Start and typing ‘telnet’ into the search.

Thanks to hillzy76 for this tip.

If you have any article ideas or other tips, be sure to send them to tips@techerator.com.