Linux Fundamentals


Welcome to “Linux fundamentals,” the first of four tutorials designed to prepare you for the Linux Professional Institute’s 101 exam. In this tutorial, we’ll introduce you to bash (the standard Linux shell), show you how to take full advantage of standard Linux commands like ls, cp, and mv, explain inodes and hard and symbolic links, and much more. By the end of this tutorial, you’ll have a solid grounding in Linux fundamentals and will even be ready to begin learning some basic Linux system administration tasks. By the end of this series of tutorials (eight in all), you’ll have the knowledge you need to become a Linux Systems Administrator and will be ready to attain an LPIC Level 1 certification from the Linux Professional Institute if you so choose.

This particular tutorial (Part 1) is ideal for those who are new to Linux, or those who want to review or improve their understanding of fundamental Linux concepts like copying and moving files, creating symbolic and hard links, and using Linux’ standard text-processing commands along with pipelines and redirection. Along the way, we’ll share plenty of hints, tips, and tricks to keep the tutorial meaty and practical, even for those with a good amount of previous Linux experience. For beginners, much of this material will be new, but more experienced Linux users may find this tutorial to be a great way of rounding out their fundamental Linux skills.

For those who have taken the release 1 version of this tutorial for reasons other than LPI exam preparation, you probably don’t need to take this one. However, if you do plan to take the exams, you should strongly consider reading this revised tutorial.

All 4 tutorials!


Sed by Example


In the UNIX world, we have a lot of options when it comes to editing files. Think of it — vi, emacs, and jed come to mind, as well as many others. We all have our favorite editor (along with our favorite keybindings) that we have come to know and love. With our trusty editor, we are ready to tackle any number of UNIX-related administration or programming tasks with ease.

While interactive editors are great, they do have limitations. Though their interactive nature can be a strength, it can also be a weakness. Consider a situation where you need to perform similar types of changes on a group of files. You could instinctively fire up your favorite editor and perform a bunch of mundane, repetitive, and time-consuming edits by hand. But there’s a better way.

Awk by Example


In this series of articles, I’m going to turn you into a proficient awk coder. I’ll admit, awk doesn’t have a very pretty or particularly “hip” name, and the GNU version of awk, called gawk, sounds downright weird. Those unfamiliar with the language may hear “awk” and think of a mess of code so backwards and antiquated that it’s capable of driving even the most knowledgeable UNIX guru to the brink of insanity (causing him to repeatedly yelp “kill -9!” as he runs for coffee machine).

Sure, awk doesn’t have a great name. But it is a great language. Awk is geared toward text processing and report generation, yet features many well-designed features that allow for serious programming. And, unlike some languages, awk’s syntax is familiar, and borrows some of the best parts of languages like C, python, and bash (although, technically, awk was created before both python and bash). Awk is one of those languages that, once learned, will become a key part of your strategic coding arsenal.

Menu driven SSH


I have quite a lot of servers where I need to ssh at workplace and I generally don’t remember all of them, so I wrote a simple yet useful script. In all the servers I have already copied my key so I dont need a password to login. Without much ado, here is the script.

echo “Enter the server name:”
echo “1. redhat”
echo “2. fedora”

read server

if [ “$server” = “1” ]; then
ssh amit@redhat
else if [ “$server” = “2” ]; then
ssh amit@fedora
echo “Not a valid choice”

You can download the script ssh_menu here.

CDNs+Alternative DNS=Higher Latency?


“Alternative DNS services, such as OpenDNS and Google Public DNS, are used to bypass the sluggishness often associated with local ISP DNS servers. However, as more websites, particularly smaller ones, use content distribution networks via embedded ads, widgets, and other assets, the effectiveness of non-ISP DNS servers may be undermined.

Why? Because CDNs rely on the location of a user’s DNS server to determine the closest server with the hosted content. Sajal Kayan published a series of test results which demonstrates the difference, and also provided the used so you can test which is the most effective DNS service for your own Internet connection.”

How Linux works: The Ultimate Guide


Ever wanted to learn how the internals of your Linux desktop work? Yes, we’ve already published detailed “how it works” articles about things like sound, the kernel, LVM, PAM and filesystems, but in this article we’re going to take a wider view and explain how everything in a modern Linux distro works, start to finish.

We’ve opted for a top-down view, tackling each stratum of Linux technology from the desktop to the kernel as it appears to the average user. This way, you can descend from your desktop comfort zone into the underworld of Linux archaeology, where we’ll find plenty of relics from the bygone era of multi-user systems, dumb terminals, remote connections and geeks gone by. We’re also going to be showing you some commands you can use to poke around on your own system, because where’s the point of learning stuff you can’t use?

This is one of the things that makes Linux so interesting: you can see exactly what has happened, why and when. This enables us to dissect the operating system in a way we couldn’t attempt with some alternatives, while at the same time, you learn something about why things work the way they do on the surface. Sound awesome? Sure it does – read on!

A Herd of Print Linux Magazines


Print isn’t dead, it’s just changing despite the best efforts of the titans of industry to resist and foil all change. Here is a roundup of excellent Linux print publications, and for no extra charge a bold prediction of the future of print.
The glossy print magazine is alive and well, and this is good because a lot of us old fossils still hang out in bookstores and newsstands, and like reading the printed page. It’s nice not having to plug something in to read it, and it’s a good outreach to people who are not familiar with Linux. Most magazines now have online editions with extra content, so we can have it all.

There is one more benefit of a print publication that you have to actually pay some money for, and that is that advertisers do not completely rule the roost. Remember the Golden Rule? The one with the gold makes the rules. Many Web publications have capitulated to advertisers and publish “web content” rather than genuine journalism, because their only revenues are from advertising. Independent voices are dwindling. Paying subscribers help keep the independent voices alive.

Linux Journal

Linux Journal is the grandaddy of them all, founded in 1994 by Phil Hughes. Now it is published by Belltown Media, owner Carlie Fairchild, who acquired Linux Journal in 2006. Over the years Linux Journal has been home to regular writers like Marcel Gagne and his “Cooking With Linux” column, which was the most controversial LJ feature. Why? Not because he used bad language, or flamed anyone, but because of his Chez Marcel and French-waiter-serving-wine schtick. It was both a regular Reader’s Choice winner, and the recipient of the most hate mail.
LJ has always covered a wide range of topics, such kernel programming, system and network administration, security, desktop, multimedia, games, and industry news.

Linux Pro Magazine

Linux Pro Magazine is called Linux Magazine outside of the US and Canada; in the US there is another Linux Magazine. There is no relation between the two except a confusing similarity of names. Linux Pro Magazine covers all the usual topics, plus extensive Linux conference coverage. Their Event Calendar is comprehensive, and they provide live and archived videos of many conferences. Linux Pro Magazine is distributed in several countries and languages, such as Poland, Spain, Germany, and Brazil.
There is a new sister publication to Linux Pro, Ubuntu User. Ubuntu User features good tech articles, and informative pieces from Ubuntu insiders such as Jono Bacon and Amber Graner.

Linux Magazine

This is the Not-Linux Pro Magazine, just plain old Linux Magazine. They no longer have a print edition, which ceased publication in 2008. I’m mentioning them here to (hopefully) clear up the confusion between the two Linux Magazines. It’s an excellent publication even if they don’t sell nice glossy printed pages anymore.

Linux Format

Linux Format is based in the UK. Every issue includes a DVD full of distros, software, and tutorials. Linux Format has PDF archives, podcasts, and boatloads of great content.
Is Print Doomed?

Science fiction stories from decades ago predicted a future where print publications were all print-on-demand. You could download and print your own favorite publications, or buy them at newsstands that were also print-on-demand. If you didn’t want to pile up hard copies, recycling was free and accessible. This put the whole world at any individual’s fingertips.
Sadly, we are rather far from that pretty scenario. Digital Rights Management insanity and personal color printers that are also DRM-infested and crazily expensive to use are just two of the hurdles. Recyling is pretty commonplace, so we have one out of three. It’s pretty amazing to me that the content industry’s frenzy and fear over digital distribution is so extreme. Don’t ever assume that big business people are smart or farsighted. Mainly they’re ruthless and connected.

I don’t believe print is doomed, it’s just going to be done differently, and by individuals rather than conglomerates. Someday. Meanwhile, please enjoy your pretty print Linux magazines!

HT Password manger


HT Password manger manages apache’s htpasswd files. Manage multiple password files with separate per-file administrator. Administrators can add/delete/search and reset password for all users & users can change their own passwords.

* Manages multiple htpasswd files
* Administrators can be specified for each file.
* Identifies the role of logged in user and redirects apporpriately
* Administrators can: Add/Remove/List/Search/Reset Password for all users
* Normal Users can reset their own password

Installation and configuration.
Download the package – here
Copy the package into a desired location under your webroot and open config.php file.
For each passwd file, set the following three values:

$realm[0] -> A friendly name to identify the passwd file. Users will see only this name.
$pwdfile[0] -> Path to the passwd file(can be absolute or relative to webroot). The file should be writable by webserver user(nobody/apache).
$admin[0] -> User with administrative privilege. Should be a memeber of the $pwdfile. Multiple administrators can be specified by comma seperation.