Tech Tips
When using ps aux | grep to look for processes, I get annoyed when I find the grep process in my search. For example:
$ ps aux | grep firefox user ... /usr/lib/firefox-3.5.8/firefox user ... grep --color=auto firefox
To avoid this issue, I use a character class regular expression that is only one character long. Simply put, I enclose one of the letters in my search term in brackets, like this:
$ ps aux | grep firef[o]x user ... /usr/lib/firefox-3.5.8/firefox
This prevents the grep process itself from matching the search term, because the search term is “firefox”, but the grep command contains “firef[o]x”.
The pacpl command-line tool allows you to extract the audio from any type of video format. The command usage is like so:
pacpl -to OUTPUT-FORMAT INPUT-FILE
For example, to extract the audio from an .mov video and store it in an .mp3 file, do the following:
$ pacpl -to mp3 2010-01-Five_Minutes_SpringRoo.mov Perl Audio Converter - 4.0.5 Converting: [2010-01-Five_Minutes_SpringRoo.mov] -> [mp3] ..done. Total files converted: 1, failed: 0
The output is stored in the 2010-01-Five_Minutes_SpringRoo.mp3 file in the same directory.
If you want to convert a PDF document to a JPEG image, first use pdftoppm to convert it to a PPM (Portable Pixel Map) file, and then use ppmtojpeg to convert it to a JPEG file.
First, convert the PDF:
$ pdftoppm input.pdf output
This generates one PPM image per PDF page in files named output-N.ppm (where N is the page number). If you want only part of the document, specify the first page to convert with -f N and the last page to convert with -l N.
Finally, to convert all the PPM files to JPEG images, you can do something like this:
$ for file in *.ppm
> do
> ppmtojpeg $file > ${file/.ppm/.jpg}
> rm $file
> done
Most DivX/Xvid movies you download from Torrent sites are packed in multiple RAR archives. It takes some time and space to extract each of them. If you don't want to wait, or use the space, you can use VLC and unrar to play the files without extracting them. You won't be able to rewind and fast-forward within the file, but you'll be able to play and stop the movie without actually unarchiving the video file. Here's how:
$ unrar p -inul /path/to/movie_folder/movie.name.r00 | vlc -
Send a tech tip to techtips@linuxjournal.com, and if we publish it in the magazine, we'll send you a free T-shirt.
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Designing Electronics with Linux | May 22, 2013 |
| Dynamic DNS—an Object Lesson in Problem Solving | May 21, 2013 |
| Using Salt Stack and Vagrant for Drupal Development | May 20, 2013 |
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
- Linux Systems Administrator
- New Products
- Senior Perl Developer
- Technical Support Rep
- UX Designer
- Web & UI Developer (JavaScript & j Query)
- Designing Electronics with Linux
- Dynamic DNS—an Object Lesson in Problem Solving
- Using Salt Stack and Vagrant for Drupal Development
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Favorite (and easily brute-forced) pw's
58 min 41 sec ago - Have you tried Boxen? It's a
6 hours 50 min ago - seo services in india
11 hours 22 min ago - For KDE install kio-mtp
11 hours 22 min ago - Evernote is much more...
13 hours 22 min ago - Reply to comment | Linux Journal
22 hours 8 min ago - Dynamic DNS
22 hours 42 min ago - Reply to comment | Linux Journal
23 hours 40 min ago - Reply to comment | Linux Journal
1 day 31 min ago - Not free anymore
1 day 4 hours ago
Enter to Win an Adafruit Pi Cobbler Breakout Kit for Raspberry Pi

It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Pi Cobbler Breakout Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- 5-21-13, Prototyping Pi Plate Kit: Philip Kirby
- Next winner announced on 5-27-13!
Featured Jobs
| Linux Systems Administrator | Houston and Austin, Texas | Host Gator |
| Senior Perl Developer | Austin, Texas | Host Gator |
| Technical Support Rep | Houston and Austin, Texas | Host Gator |
| UX Designer | Austin, Texas | Host Gator |
| Web & UI Developer (JavaScript & j Query) | Austin, Texas | Host Gator |
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?




Comments
Another solution for Grep
In the first tip it's possible to use twice grep, like this:
ps aux | grep -v grep | grep firefox
The -v option. Invert the sense of matching, to select non-matching lines.
The first grep exclude lines which have a "grep" word.
Best practices: There probably should be quotes on var refer
Best practices: There probably should be quotes on variable references.
> ppmtojpeg $file > ${file/.ppm/.jpg}
> rm $file
Randall Schulz has detailed explanation here:
http://lists.opensuse.org/opensuse/2006-11/msg02249.html