Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

How to Change Your Local IP Address

Your Public IP address is what identifies your computer when you to connect to the internet. It is assigned by your ISP and depending on the type of service you have subscribed to, your public IP may remain the same (Static IP) or is periodically updated (Dynamic IP). Basically if you want to change your public IP then the only way is to get in touch with your ISP or use a proxy service such as Tuxler or Hotspot Shield to hide/spoof your IP address. 

Each computer also have the local IP address. The local IP which is also referred as Private IP address is used to identify computers on the local network (behind the same router) and it is managed by the operating system. If required, the local IP of a machine can be changed via the router settings (refer to the manual provided with the router or check on the manufacturer's website) or you can change it via the Windows Control Panel.


Refresh your IP

There exists a simple command in Windows to refresh your current IP, which can be useful to fix IP address conflicts when two computers present on the same DHCP network share the same IP. But it should be noted that this procedure generates a "random IP" (within the allowed range). 

Click on Start > Run > type cmd and press Enter to open the Command Prompt. Next, type ipconfig
 to view the current address. Type  ipconfig / release , followed by ipconfig / renew


Change your local IP

Open the Control Panel > Network and Sharing Center > Change Adapter Settings Network Connections. A list of known connection will be displayed (Ethernet or Wi-Fi). Right-click on the desired connection and select Properties from the contextual menu. Under This connection uses the following items select Internet Protocol Version 4 (TCP / IPv4) and then click onProperties


Select the Use the following IP address option instead of Obtain an IP automatically (default) and register the IP address (within the pool of acceptable IP addresses and which is not already in use by another computer), Subnet MaskDefault Gateway and DNS Server addresses:


Click on Apply > Ok.

Save Web Pages as PDFs Without Installing Extensions

While there are plenty of PDF writing software and online conversion services around that can help you save web pages as PDF files, the fact is that you don’t need any of them as long as you have Google Chrome on your computer.

Open any web page inside Google Chrome, press Ctrl+P (or Cmd+P if you are on a Mac) to open the Print dialog and change the destination printer to “Save as PDF.” Hit the Print button and the current web page will instantly download as a PDF document. Simple!


You neither have to install any software on your computer nor any extensions in your browser because Google Chrome itself acts as the PDF writer.
This is especially useful for downloading PDF copies of web pages that involve transactions or session data – like the checkout page on a shopping website – because you often cannot pass such pages to any online PDF conversion service.
One more thing. You can also use Chrome’s PDF engine to convert your local image files, text files and any local HTML web pages to PDFs – if you an open a file in Chrome, it can convert the file to PDF.

Parallels Workstation for Windows & Linux – Free Download

Parallels Workstation is a commercial desktop virtualization program that lets you run multiple Operating systems on the single physical computer and you can easily switch between them without rebooting.




For instance, you could be running Windows Vista and but some of your programs (like your old Tally accounting software) require Windows 2000 or XP. In that case you can download Parallels Workstation, create a virtual machine for Windows XP and run it over Windows Vista just like any another software program. You can also use Parallels Workstation to run Linux on a Windows machine or vice versa.
If you are planning to rebuild a computer, it is recommended that you use a virtualization program like Parallels Workstation for all experimentation work – i.e., any software that you plan to use on a temporary or trial basis should be installed on the virtual machine and not on the main computer.
Parallels Workstation sells for $50 but you can request a licensed activation key for free using this Lunarpages offer. Key in your email address and they’ll immediately send you the download links for the trial version and serial number to convert the trial into a full retail version.
Virtual machines are very helpful for web designers as well as it lets you test websites on different browsers – you can have a virtual machine with IE 8 and another one with IE 6 while your main desktop is running the latest IE 7.
In case the above offer expires by the time you read this, you can always download the free Virtual PC (Microsoft) or Sun’s VirtualBox which is available for Mac as well. 

Use an Old Linux Computer to Put your Baby to Sleep

If you are not a geek, let me explain the logic of this very simple program. 






The program will first auto-eject the CD-ROM drive of your computer and then it will close that open tray. This open-close loop will run forever unless you terminate the program manually.
while [1 = 1]
 do
 #eject cdrom
 eject

 #pull cdrom tray back in
 eject -t
 done
Now the interesting part – using just these four lines of code, a geek turned his old Linux* computer into a baby rocker.

He attached a string between the tray of the CD-ROM drive and the baby seat and as the tray would open and close repeatedly, the smooth movements were enough to put his baby to sleep. Awesome.

[*] you are not on on Linux, you can build a similar Baby rocker program for Windows using Autohotkey software.

Essential Linux Commands for WordPress Users

If you have limited Unix / Linux experience but are starting to use the shell to manage your WordPress installation, here are some handy command line tricks that will help you do common things a lot faster. Also, the commands listed here aren’t specific to any shell so you should be able to use them in any Linux environment.


Handy Command Line Tricks for Linux

1. Linux comes in several flavors. The following commands will help you determine which Linux distro is installed on your host, what’s the version of your Linux kernel, the CPU model, processor speed, etc.
$ cat /etc/issue
$ cat /proc/version
$ cat /proc/cpuinfo
2. Find the total amount of RAM available on your Linux box and how much is free.
$ free -mto
3. The command cd.. takes you up one directory level but cd – will move you to the previous working directory. Or use the command pwd to print the full path of the current directory that you can copy-paste later into the shell.
$ cd  – 
$ pwd
4. The command history will show a list of all the recently executed commands and each will have an associated number. Use ! to execute that command again. Or, if the history is too long, use grep to search a particular command.
$ !
$ history | grep 
5. You can remove any particular command from the shell history by number.
$ history  – d 
6. If you made an error while typing a command name, just enter the correct command name and then use !* to reuse all the previous arguments.
$  !*
7. Re-run a command but after replacing the text abc in the command with xyz.
$ ^abc^xyz
8. This will list the size of all sub-folders of a directory in KB, MB or GB.
$ du  – sh */
9. A better version of the ls command that displays file sizes in KB and MB.
$ ls  – gho
10. You can use man  to learn more about the syntax of a command but what if you don’t remember the name of the command itself? Use apropos then.
$ apropos 
11. Compare the content of two text files to see what has changed.
$ diff wp-config.php wp-config.php.old
12. Find lines that are common in any two text files.
$ grep  – Fx  – f file-A.html file-B.html
13. Compare the content of two directories recursively.
$ diff  – urp /old-wp-directory /new-wp-directory
14. Find all files under the current directory that are larger than 10 MB in size.
$ find . -size +10M -exec du -h {} \;
15. Find all files on the system that have been modified in the last 2 days.
$ find .  – type f  – mtime -2
16. Find all files on the system that were modified less than 10 minutes ago
$ find .  – type f  – mmin -10
17. Find all PHP files that contain a particular word or phrase.
$ find . -name "*.php" -exec grep -i -H "matt mullenweg" {} \;
18. When copying or moving files, Linux won’t show a warning if you are overwriting an existing file. Therefore always use the – i switch to prevent overwrites.
$ cp  – i abc.txt xyz.txt
19. Backup the content of the current folder into a tarball file using gzip compression.
$ tar zcfv backup.tar.gz /wp-directory/
20. Find processes with the highest CPU usage. Then use kill – 9 pid to kill a process.
$ ps aux | sort -nrk 3 | head
21. Execute the following command in your Apache logs directory to determine hits coming from individual IP addresses.
$ cat access.log | awk '{print $1}' | sort | uniq -c | sort  – n | tail
22. Monitor hits from Google bots to your website in real-time.
$ tail  – f access.log | grep Googlebot
23. To find all files and web pages on your site that return a 404 error, run the following command in the Apache logs directory.
$ awk '$9 == 404 {print $7}' access.log | uniq -c | sort -rn | head
24. Find the 100 most popular pages of your site using Apache server logs again.
$ cat access.log | awk '{print $7}' |sort |uniq -c |sort -n |tail -n 100
25. Quickly find and replace a string in or more files.
$ find . -type f -name "*.php" -exec sed -i 's/wordpress/WordPress/' {} \;

How to Install Linux on your Windows Computer

Are you a Windows user who is curious to try Linux (Ubuntu in particular) because you have heard so many good things about the OS from your geek friends?  


There are two ways to use Linux on a Windows computer. You can either install the full Linux OS alongside Windows, or if you are just starting with Linux for the first time, the other easy option is that you run Linux virtually with making any change to your existing Windows setup.
The former option will offer the best performance because all your system resources will be available to Linux but the latter option is absolutely risk-free and therefore recommended for novice users. You’ll be able to test drive Linux but without changing a single file on your Windows computer.

Running Linux with Windows – Your Options

Let’s look at some of the easiest ways to use Linux on a Windows computer. Linux is available in multiple flavors (your friends may call them Linux distros) but here, let’s focus on the desktop edition of Ubuntu, perhaps the most popular and actively developed Linux distribution.

A: Test-Drive Linux Online as a Web App

Perhaps the easiest way to try Linux on your Windows Desktop is inside your web browser. Go to edubuntu.org, fill that simple form and within a minute, you’ll have the full version of Ubuntu Linux running on your desktop inside a Java applet.
There’s absolutely no need to download or install anything on your computer and a single session can last up to two hours. You get access to all the features that are available in the standard desktop edition of Ubuntu Linux including the ability to download and install new packages from the Linux repository.

B: Run Linux from a USB Stick or a CD

The most popular option to test-drive Linux on Windows is a LiveCD. Though it says “CD,” you can also use a USB Flash Drive as a LiveCD (without having to burn a CD).
To get started, download the latest version of Ubuntu to your desktop. This is an ISO file (also known as a CD image) that is around 650 MB in size. If you don’t have a great Internet connection, you can always borrow the Ubuntu CD from a friend (yes, its perfectly legal) or order a readymade live CD from OSDisc.com.

Once you have Ubuntu ISO image file, grab an empty USB disk and use UNetbootin to quickly turn that USB drive into a bootable Ubuntu disk for Ubuntu without having to burn a CD. Insert the bootable USB flash drive into your Windows computer and reboot. If this doesn’t work, go to the BIOS boot menu and change the boot sequence.
You should see an option at the boot menu that says “Try Ubuntu without any change to your computer” – choose that and you are good to go. Once inside Linux, you can install new programs, create files and everything else that you normally do at a computer though your changes won’t be written to the disk.
The Ubuntu portal has more details on creating and troubleshooting a LiveCD.

C: Run Linux in a Virtual Machine

The term virtualization may sound very geeky but in simple English, all it means is that you can another OS over an existing OS. For instance, you can run Windows on a Mac or you may install Linux on a Windows 7 machine using virtualization software.
To get started, download and install the free VMware Player on your Windows desktop. Then download the VMware image for Ubuntu and extract the zip file (I use PeaZip). Now double-click the Ubuntu.vmx file that you just extracted and the Linux virtual machine will load inside the VMWare Player. Simple!
Technically, Linux will be the “guest” operating system while “Windows” will be considered the host OS. And other than VMware, you may also VirtualBox to run Linux inside windows. The VirtualBox installer and the Ubuntu Linux images for VirtualBox for can be downloaded for free from oracle.com.

D: Install Linux like a Windows Software

Wouldn’t it be nice if you could install Linux like a native Windows app – something like Microsoft Office? For instance, if you have Office running on Windows, you can always uninstall the software later without affecting any other Windows programs or system settings.
Meet Wubi – short for Windows-based UBuntu Installer – a tiny utility that will help you install Ubuntu Linux alongside any other Windows application. Run the installer, choose a password for your Linux environment and the software does the rest.
It will download the necessary Linux ISO from the Internet and will install it on your machine. Alternatively, if you have previously download the ISO, you can just place the .iso file in the same folder as Wubi and it will pick it up.
Now the next time you restart / reboot your computer, it will offer you a choice of Linux (Ubuntu) and Windows. This is a real Linux installation and thus the overall performance should be good as well. If you ever want to uninstall Linux, simple boot into Windows, go to the Add-Remove problems and uninstall Wubi.

E: Run Linux inside the Web Browser

If you are just starting to learn Linux and are looking for an easy way to practice the various Linux commands, check out the very-impressive JSLinux project.
This is an emulator that lets you use Linux inside your web browser. You may write shells scripts using Sed and Awk, master regular expressions, play around with popular text editors like Vi and Emacs, look up man pages of various Linux command and much more – all inside your browser.

Which is the Best Linux Distribution for your Desktop?

Linux today comes in several different flavors or distros as they are known in Linux circles.



Some Linux distributions are light-weight (they’ll run just fine on your old laptop), some are targeted at people who just want to try out Linux without replacing their main OS while other desktop distros (say Ubuntu) include a more comprehensive collection of software applications and also support a wide variety of hardware devices.

Choose the Right Linux Distro for your Desktop

Ubuntu, Xubuntu, Xandros, Knoppix, Fedora, openSUSE etc. are just some of the popular Linux distros but you’ll be surprised to know that there exists over 650 active distros in the world according to DistroWatch, a site that tracks the popularity of various Linux distributions.
Determining the perfect Linux distribution that will meet your requirements can therefore be a difficult task so here’s a handy guide that lists different scenarios and the Linux distros that will be the most appropriate for each of them.

1. For people who just want to try Linux out

Live CD distributions like Knoppix boot directly from the CD-ROM so you can try out Linux without you having to install anything on your computer. The user can run many different software applications and he may also save documents / files created during a Live CD session to persistent storage like a hard disk or a flash drive.
A Linux Live CD can also be used in situations when your windows has crashed and you want to save your existing data on another media before reinstalling windows. The only problem is that such distributions tend to run slower than fully installed Linux distributions.
If you aren’t too happy with the speed of a Live CD, you can use a Wubi to install the Ubuntu Linux distro on your Windows desktop. Wubi allows you to install and uninstall Ubuntu on your computer just like any Windows application. As compared to other Linux distributions, Ubuntu has got a fixed release cycle and support period and a wealth of both official and user contributed online documentation.
There’s another interesting option as well – you may install Linux in a virtual environment and run it alongside other Windows /Mac applications. Virtualization software like Virtual PC (Microsoft), Virtual Box (Sun) or VMare can be easily used for this purpose. Just download the Linux ISO (or use the Linux installer CD if you have one) and follow the wizard to set up your new Linux virtual machine.

2. For people who are new to Linux

Among the GNU/Linux desktop distributions, Linux Mint provides an ease of use and elegance not seen in other distributions. Linux Mint is is based on Ubuntu (which itself is based on Debian) so users have a large collection of software programs and packages to choose from. If something works for Ubuntu or Debian, it’ll probably work on Linux Mint as well.
Linux Mint CD comes with a utility called mint4win that will let you install Linux on your Windows computer on other partition without touching any of your existing setup. The performance won’t be that great but you can easily uninstall Linux from your Windows PC using the Add/Remove applications tool within Windows.
Ubuntu (Desktop edition) is also a great choice for Linux users who are beginners. It supports a wide-variety of hardware devices, has a standard release cycle (every six months) and, if you don’t have a great Internet connection, you can ask Ubuntu to ship you installation DVDs for free anywhere in the world.
OpenSUSE (Novell) and Fedora (Red Hat) are other popular Linux distros for the desktop that are both free and user-friendly.
Among the commercial distros, Xandros Home Edition is perhaps the most useful Linux desktop operating system for newbies. Xandros includes CodeWeavers CrossOver so you can easily run Microsoft Office, Adobe Photoshop and many other Windows applications inside Xandros.

3. For installing Linux on old computers

Puppy Linux is a Live CD distribution that has a small installer and will run just fine on computers with RAM as little as 64 MB. Puppy Linux can boot from several media including USB flash drives, CD or a zip drive. Puppy Linux will run totally in RAM so make sure you save the modified personal files to a disk else you’ll lose the changes when the system shuts down.
Xubuntu, a variant of Ubuntu is also a possibility. Xubuntu uses xfce, a desktop environment that uses less system resources than GNOME that comes with the Ubuntu distribution. Xubuntu versions are released twice a year, coinciding with Ubuntu releases.
antiX is another good choice for old computers – it should run on systems that were considered slow when Windows 98 was released (like the Pentium II series). Damn Small Linux and Zenwalk are other variations that have minimal hardware requirements.

4. For using Linux at work

Redhat Enterprise Linux and and SUSE Linux Enterprise Desktop (formerly known as Novell Linux Desktop) are the front runners in the business category of Linux distros. Traditionally though, Redhat has concentrated more on the server market than the desktop market. Xandros Desktop is another choice except that Xandros is a small company and most business organizations would prefer to deal with large stable vendors.
Red Hat Enterprise ServerSUSE Enterprise and Ubuntu Server are possible contenders for deploying Linux on server machines. Some factors that go in favor of Red Hat are extensive security updates schedule (7 years), large number of new packages included in the distro and a strong training and certification program which is very useful for organizations that do not have in house skills.

5. Linux for Netbook computers

Netbooks are like your regular notebook computers but with small screens, they consume less power but also have less powerful hardware. Linux distros that are suitable for running on netbooks include Ubuntu Netbook, Moblin and Jolicloud.
Ubuntu Netbook requires an Intel Atom processor. If you already have a Ubuntu installer, you can install the desktop version of Ubuntu on your netbook, change the default repository to point to Ubuntu Network Editor repository and then install the relevant packages.
Jolicloud is suitable for running on low-powered computers that don’t have enough memory or storage space. The interface of Jolicloud is gorgeous and different from all other Linux distros. It is based on Ubuntu so any app that works with Ubuntu will run on Jolicloud as well. You may install Jolicloud alongside your Windows OS or download the ISO to install Jolicloud on a separate partition.
Moblin, another Linux distro from netbooks, was initially a project of Intel but is now part of the Linux Foundation. You can run Mobile from a live USB image or you install the OS on to the netbook. Going forward, Moblin and Maemo* will merge into MeeGo and will be available for download in Q2   ’10.
[*] Maemo is Debian Linux based software platform from Nokia.

6. For power users who want control

Arch Linux is a recommended distro for power (experienced) users as it allows them to create a customized Linux installation built from the ground up. It does not have a graphical install interface.
Once the Arch Linux installation is done, there is no post-install account creation or login manager screen. Instead, there is a screen full of configuration files that have to be tweaked to suit the network and system configuration. This allows the user to tailor the system from the ground up as compared to a ‘user-friendly’ distro where one would get a standard set of packages and will have to remove the ones that are not needed.
Slackware is another distro that deserves mention in this context. As compared to Arch Linux, Slackware Linux provides more stable packages and is thus more conservative. However, Arch Linux provides a more usable package management system that takes care of dependencies.
Slackware third party packagers on the other hand, have to ensure that everything is included in the package or available for download from the same web page. It is the oldest surviving Linux distribution. Since Slackware philosophy is to use vanilla packages, it tends to run faster than other distros.
References and Resources:
  • List of Linux distributions – We only touch a dozen Linux distros but this Wikipedia article will provide you detailed information (including screenshot images) of all popular Linux distributions.
  • Netbook Distros – Detailed comparison of netbook oriented Linux distributions.
  • Linux Distribution Chooser – This is a web based wizard that will help you find the right Linux distribution for your needs.
  • Comparison of Linux distributions – You can compare the various Linux distros from a technical point of view like what processors they support, what is the base distribution, etc.
  • Linux Releases – This page tracks the upcoming releases of various Linux distros.
  • Linux Gaming – If you use Linux for playing games, this article has a list of popular video games that are currently available for Linux.

Print Files on Linux Remotely using Dropbox

If you have a printer attached to a Linux machine, you can easily send print jobs to that printer from another remote computer using Dropbox (see similar solutions for Windows and Mac).
The idea is that you create a shell script to monitor a local Dropbox folder. As soon as a new file is added to that folder from a remote computer (or mobile phone), the script will send the file to the attached printer. Once the the printing job is completed, the file is removed from the incoming queue.
The implementation is easy. Kurt Granroth sent me this improved* shell script that you can use in any Linux environment. You only have to setup a cron job against this script such that it runs after every ‘n’ seconds (or minutes).

  1. #!/bin/bash
  2.  
  3. export PrintQueue="/root/Dropbox/PrintQueue";
  4.  
  5. IFS=$'\n'
  6.  
  7. for PrintFile in $(/bin/ls -1 ${PrintQueue})
  8.  
  9. do
  10.  
  11. lpr -r ${PrintQueue}/${PrintFile};
  12.  
  13. done

To initiate a print job, simply add some files to the PrintQueue Folder in Dropbox from either a remote computer or upload them via your mobile phone. Within seconds, the script will start printing the files to your local printer.
If you have multiple printers attached to Linux computer, use the – p parameter to specify the printer name.
Also, if you are on Ubuntu, you may use “sudo apt-get install gnome-schedule” (Gnome Schedule) to setup a scheduled task for the script with recurrence set to “every minute.”

Dropbox Printing with Linux Decoded

Here’s an annotated version of the script, courtesy Kurt again, that will help you easily understand how the script works:
#!/bin/bash — Specific bash directly since its feature set and behaviors are consistent everywhere
export PrintQueue — It’s necessary to ‘export’ in order for the environment variable to show up in the later $() subshell
IFS=$’\n’ — By default, spaces will wreak havoc with the ‘for / in’ loop. Resetting the field separator handily works around that
/bin/ls -1 — Directly use /bin/ls to bypass the common color-enabling aliases. Use -1 to force all files into one column. There’s no need to search for the beginning of the file name using this
lpr -r — The -r option deletes the file after it successfully prints. This is better than doing an ‘rm’ later since it only does the delete on a successful print.