Saturday, February 19, 2011

Sending email or mail with attachment from command or shell prompt


If you are looking to send email with attachment via shell script or at shell prompt/command line (read as bash prompt), use mutt command.
Mutt is a small but very powerful text based program for reading electronic mail under UNIX /Linux operating systems, including support for color terminals, MIME, and a threaded sorting mode.
Please note that mutt is a pure MUA and cannot send e-mail without proper email server . You need a working Mail Transfer Agent (MTA) such as sendmail or postfix. I am assuming that you have configured email server.

Friday, February 18, 2011

Tuesday, February 15, 2011

sudoers file


The file /etc/sudoers, has the rules that users have to follow when using sudo command.

If you are (or was) running Ubuntu, you may know that by default the root account is not usable in Ubuntu, because it has no password, you may assign one and use it as in every other Linux, but that is another story. On normal Ubuntu Linux machines you need to use sudo command to perform operations as root.
I like that approach, and even though I am using Debian, I always give my account root rights, so I can run commands as root without changing to root.
sudo make me a sandwich
Comics from XKCD
As you can see from this funny picture, using sudo makes your system reacts as if was another user who are given the order.
Two of the best advantages about using sudo are:
  • Restringed privileges
  • Logs of the actions done by users
Well but in order to use sudo we first need to configure the sudoers file.

Monday, February 14, 2011

Make batch scripts in Linux



This is a tutorial about how to create simple batch scripts in linux console. I will use "/home/" as my root folder. It can be applied on any folder.


First, I'll Create a file known as "mybatch", if the file does not already exist. If the file already exists the accessed / modification time is updated for the file mybatch


touch /home/mybatch


Sunday, February 13, 2011

Building Custom WordPress Theme

As WebDesignerWall stated in this article:

1. The Blog Frontend

Before you start, let’s take a look at the WordPress default theme and see how it is structured. Take note of the elements (header, post title, search form, navigation, footer, etc.).

default homepage
Default Frontpage (index.php)

default homepage
Default Single (single.php)

Perfect Setup: Ubuntu Hardy + Nginx + MySQL5 + PHP5 + Wordress


The Perfect Setup:

Ubuntu Server 8.04.1 LTS Hardy (supported to 2013) + EngineX (NGINX) Web Server built from sources + MySQL 5 + PHP 5.
(Or LEMP )
Tested on 256MB VPS slice at SliceHost. Should work for other hardware.
From baremetal/barebone/empty fresh install of Ubuntu Server to shiny, fast and SEO-friendly WordPress Portal propelled by WP Super Cache plugin.
All configured and powered by NGinx WEB Server.
Step by step copy/paste instructions - from "zero to hero" with everything on a single page (albeit long one) and in the right order. Just what your granma was asking for!
Every time I need to quickly utilize new product or technology it always made me wonder "why don't someone came up with a simple step by step instructions on which buttons to press to make this thing work?". So instead of waiting for someone to do it this time I decided to make one myself.
After spending countless hours and days hunting for scripts, searching for clues, scrolling through misleading posts, extracting bits from articles, eliminating blubber and fluff, bugging busy geeky people for hints and getting all necessary pieces together in the right order I finally came up with this instructional post. It all boils down to step-by-step copy/paste instructions that should take you less than 1 hour to get from freshly installed Ubunty server to fully functioning, search engine optimized business-ready WordPress-powered website.
I tested it all on 256MB VPS image offered by SliceHost but the same instructions should work just just fine on any real hardware as well.
Most credits goes to excellent set of articles by PickedOnion at SliceHost plus to some more sources, acknowledged within this post.
This article assumes your username is 'jsmith' and your domain is 'mydomain.com'.
Now it's time to get our hands dirty!