Pages

Wednesday, February 6, 2013

Using wget to mirror a website



hackedOccasionally you need to mirror a website (or a directory inside one). If you've only got HTTP access, there are tools like httrack which are pretty good (albeit pretty ugly) at doing this. However, as far as I can tell, you can't use httrack on a password-protected website.

curl can probably do this too, and supports authentication, but it wasn't obvious.

So I ended up using wget, as it supports mirroring and credentials. But the issue here is that wget plays nice and respects robots.txt; which can actually prevent you mirroring a site you own. And nothing in the man page explains how to ignore robots.txt.

Eventually, I came up with this incantation, which works for me (access to password-protected site, full mirror, ignoring robots.txt):
wget -e robots=off --wait 1 -x --user=xxx --password=xxx -m -k http://web_site_name_to_mirror/

where:

  • -e robots=off obviously disables robots

  • --wait 1 forces a pause between gets (so the site doesn't get hammered)

  • --user and --password: self-evident

  • -x creates a local directory structure which "mirrors" (see what I did there?) the directory structure on the site you're mirroring

  • -m turns on mirror mode: "turns on recursion and time-stamping, sets infinite recursion depth and keeps FTP directory listings" (from the man page)

  • -k converts links after download so that URLs in the mirrored files reference local files


Don't use it carelessly on someone else's website, as they might get angry...

Thursday, January 31, 2013

The Linux File System - Explained

[youtube=http://youtu.be/2qQTXp4rBEE]

Published on Nov 17, 2012
In Linux, everything is a file. All the files the kernel can understand are displayed.

Thursday, January 24, 2013

How To Install LAMP (Linux, Apache, MySQL, PHP) On Ubuntu/Linux Mint

If you develop web applications and scripts, it will be nice testing them locally in your own computer before launching them online. This will require the installation of a webserver on your computer.LAMP (Linux, Apache, MySQL, PHP) is one of the easiest and perfect environment where you can test all your PHP codes. In this tutorial, we will help you install the LAMP webserver in the following Ubuntu/Linux Mint distributions:

  • Ubuntu 13.04/12.1012.04/11.10 or older

  • Linux Mint 14/13/12 or older


LAMP Installation

The LAMP webserver can be installed easily with this command (the caret (^) is required, don't exclude it):
sudo apt-get install lamp-server^

During the installation, you will be asked to enter a new root password for the MySQL database, submit it and press Enter:
MySQL-Password
You will be prompted to enter the password again for confirmation. Wait now until the installation is complete. You have now installed the LAMP webserver on Ubuntu 11.04/11.10. Let's now go to the next step.

Testing Apache

Launch your web browser (Firefox, Google Chrome, etc.) and open one of these addresses (or provide your server IP address if needed):
http://localhost/

or
http://127.0.0.1/

If you get this page, then Apache is started:
Apache-it-works

Otherwise try to restart Apache with this command:
sudo /etc/init.d/apache2 restart

Then give it another try.

Testing PHP

Let's now test PHP. You need to create an empty PHP file in /var/www  and insert this snippet of code into it:
<?php phpinfo(); ?>

You can easily do it with these two commands via the terminal:
echo "<?php phpinfo(); ?>" | sudo tee /var/www/test.php


sudo /etc/init.d/apache2 restart



Then open this address:
http://localhost/test.php

You should see a page like this:
test-php

Configuring MySQL

Since you are using the LAMP webserver locally, your MySQL database must uses the same IP address of your localhost which is: 127.0.0.1. Via the Terminal, run this command to verify it:
cat /etc/hosts | grep localhost

Here is the correct output you must get:

~$ cat /etc/hosts | grep localhost
127.0.0.1 localhost
::1     ip6-localhost ip6-loopback


Also verify that the bind address is set correctly by running this command:
cat /etc/mysql/my.cnf | grep bind-address

You should get this output:

~$ cat /etc/mysql/my.cnf | grep bind-address
bind-address = 127.0.0.1

If you get a different IP address, then edit the my.cnf file with this command:
sudo gedit /etc/mysql/my.cnf

Search for the line containing "bind-address" and correct its address by replacing it with 127.0.0.1.

phpMyAdmin Installation

If you want an easy GUI for managing your MySQL databases, you can install phpMyAdmin with this command:
sudo apt-get install libapache2-mod-auth-mysql phpmyadmin

During the installation you will be asked to select a web server that will be configured automatically to run phpMyAdmin. Select apache2 using your spacebar and press Enter:
select-apache2-lamp
You will be asked next to configure a database for phpmyadmin with dbconfig-common, select Yes and press Enter:

phpmyadmin-dbconfig-commonIn the next screen, enter the MySQL password you have submitted before and press Enter:

[
OR,

Select  NO and press ENTER
And, Type below command in terminal
sudo cp /etc/phpmyadmin/apache.conf /etc/apache2/conf.d

restart your apache server using
sudo /etc/init.d/apache2 restart

]

Congratulation! phpMyAdmin is now installed in your system. To test it, open simply this address via your web browser:
http://localhost/phpmyadmin/

Login to phpMyAdmin using root as username and the password you created earlier:

phpmyadmin (1)

phpmyadmin (2)

You have now successfully installed LAMP on your system. All your projects and files must be placed in /var/www so that you can run them.

Removing LAMP & phpMyAdmin

To uninstall the LAMP web server and phpMyAdmin, open the terminal and run this command:
for pkg in `dpkg -l *apache* *mysql* phpmyadmin | grep ^ii | awk '{ print $2 }'`; do sudo apt-get -y purge --auto-remove $pkg; done;

That's it!
Enjoy!


Install WordPress 3.5 'Elvin' On Ubuntu 12.10/12.04 and Linux Mint 14/13

WordPress-3.5WordPress has been updated to version 3.5 having this codename 'Elvin' in honor of Elvin Jones (drummer). This new version comes with a new media manager and Retina support. Users of WordPress will have a new experience when uploading images and creating galleries thanks to the new image uploader.

WordPress 3.5 comes also with various tweaks and a new default theme (Twenty Twelve). You can find full features here. In this tutorial, we will see how to install this blogging and CMS platform under the following Ubuntu/Linux Mint distributions:

  • Ubuntu 12.10/12.04/11.10 or older

  • Linux Mint 14/13/12 or older

  • Any other Ubuntu-based System


  1. Requirements

To be able to install WordPress 3.5 in Ubuntu/Linux Mint, we need to install a web server (Apache, PHP, MySQL, etc.). If you are following my previous tutorials, you will notice that I prefer to use the LAMP server, you can find here detailed instructions for installing it.

   2. Creating A MySQL Database For WordPress

For GUI mode, I recommend that you use phpMyAdmin to create a MySQL database and user for WordPress. For CLI mode, you can run this sequence of commands (change text in red to reflect your own database configuration):
## Connect to MySQL Server & Enter Password (if any or leave blank)## 
mysql -u root -p
Enter password:

## Creating New User for WordPress Database ##
CREATE USER wordpress@localhost IDENTIFIED BY "12345";

## Create New Database ##
create database wordpress;

## Grant Privileges to Database ##
GRANT ALL ON wordpress.* TO wordpress@localhost;

## FLUSH privileges ##
FLUSH PRIVILEGES;

## Exit ##
exit

The commands above will create these details:

  1. Hostname: localhost

  2. Database: wordpress

  3. Database User: wordpress

  4. Database User Password: 12345


3. WordPress 3.5 Installation

Via the terminal, download and move the WordPress folder to /var/www/ with these commands:
cd /tmp

wget -c http://wordpress.org/latest.zip

sudo unzip -q latest.zip -d /var/www/

sudo chmod 777 -R /var/www/wordpress

sudo /etc/init.d/apache2 restart

Open now this link to start the web-based installation:
      http://localhost/wordpress

NOTE: You can replace localhost with your server IP address.

In the first page, click Create a Configuration File:

wordpress-setup-1
Then follow setup instructions:
wordpress-setup-2 wordpress-setup-3 wordpress-setup-4 wordpress-setup-5 wordpress-setup-6 wordpress-setup-7 wordpress-setup-8













That’s it!
Enjoy!

Sunday, January 20, 2013

Recover Grub2 after installing Windows

[Recover grub back again after if it is lost of these reasons-- windows 7/xp/vista/8 installation, uninstalled package grub from Linux system.]

So you were enjoying life using Ubuntu and then one day you had to install Windows for that one application your boss makes you use and now no more Ubuntu. When we need a dual boot system it’s always best to install Windows first then Ubuntu due to Windows stripping out the boot loader but what if you have no choice? or a crash that corrupted the boot loader. Boot-repair  to the rescue.
So what is Boot-Repair?

Its a small graphical tool used to restore access to Ubuntu and other OS’s such as Windows when disaster strikes, it has two basic options.(See Figure)  and follow steps below-











Boot-repair



  •  run Ubuntu  media in live mode.

  •  connect Ubuntu to Internet source

  • open up a terminal and type the following:

  • sudo add-apt-repository ppa:yannubuntu/boot-repair && sudo apt-get update

  • sudo apt-get install -y boot-repair && boot-repair 

  • click "Recommended repair" and apply.  make sure you leave the "Reinstall GRUB" check-box ticked. Now reboot your system. now you can see GRUB back.

Saturday, January 19, 2013

Basic Linux Commands

If you are a new user, you must try these commands. And believe me Working with Terminal is simply interesting.

mkdir - make directories

Usage

mkdir [OPTION] DIRECTORY

Options

Create the DIRECTORY(ies), if they do not already exist.

 Mandatory arguments to long options are mandatory for short options too.

 -m, mode=MODE  set permission mode (as in chmod), not rwxrwxrwx - umask

 -p, parents  no error if existing, make parent directories as needed

 -v, verbose  print a message for each created directory

 -help display this help and exit

 -version output version information and exit

cd - change directories

Use cd to change directories. Type cd followed by the name of a directory to access that directory.Keep in mind that you are always in a directory and can navigate to directories hierarchically above or below.

mv- change the name of a directory

Type mv followed by the current name of a directory and the new name of the directory.

 Ex: mv testdir newnamedir

pwd - print working directory

will show you the full path to the directory you are currently in. This is very handy to use, especially when performing some of the other commands on this page

 rmdir - Remove an existing directory

 rm -r

Removes directories and files within the directories recursively.

chown - change file owner and group

Usage

chown [OPTION] OWNER[:[GROUP]] FILE

chown [OPTION] :GROUP FILE

chown [OPTION] --reference=RFILE FILE

Options

Change the owner and/or group of each FILE to OWNER and/or GROUP. With --reference, change the owner and group of each FILE to those of RFILE.

 -c, changes like verbose but report only when a change is made

 -dereference affect the referent of each symbolic link, rather than the symbolic link itself

 -h, no-dereference affect each symbolic link instead of any referenced file (useful only on systems that can         change the ownership of a symlink)

 -from=CURRENT_OWNER:CURRENT_GROUP

  change the owner and/or group of each file only if its current owner and/or group match those specified here.  Either  may  be  omitted,  in which case a match is not required for the omitted attribute.

-no-preserve-root do not treat `/' specially (the default)

-preserve-root fail to operate recursively on `/'

-f, -silent, -quiet  suppress most error messages

-reference=RFILE use RFILE's owner and group rather than the specifying OWNER:GROUP values

-R, -recursive operate on files and directories recursively

-v, -verbose output a diagnostic for every file processed

The  following options modify how a hierarchy is traversed when the -R option is also specified. If more than one is specified, only the final one  takes effect.

-H     if a command line argument is a symbolic link to a directory, traverse it

-L     traverse every symbolic link to a directory encountered

-P     do not traverse any symbolic links (default)

chmod - change file access permissions

Usage

chmod [-r] permissions filenames

 r  Change the permission on files that are in the subdirectories of the directory that you are currently in.        permission  Specifies the rights that are being granted. Below is the different rights that you can grant in an alpha  numeric format.filenames  File or directory that you are associating the rights with Permissions

u - User who owns the file.

g - Group that owns the file.

o - Other.

a - All.

r - Read the file.

w - Write or edit the file.

x - Execute or run the file as a program.

Numeric Permissions:

CHMOD can also to attributed by using Numeric Permissions:

400 read by owner

040 read by group

004 read by anybody (other)

200 write by owner

020 write by group

002 write by anybody

100 execute by owner

010 execute by group

001 execute by anybody

ls - Short listing of directory contents

-a        list hidden files

-d        list the name of the current directory

-F        show directories with a trailing '/'

            executable files with a trailing '*'

-g        show group ownership of file in long listing

-i        print the inode number of each file

-l        long listing giving details about files  and directories

-R        list all subdirectories encountered

-t        sort by time modified instead of name

cp - Copy files

cp  myfile yourfile

Copy the files "myfile" to the file "yourfile" in the current working directory. This command will create the file "yourfile" if it doesn't exist. It will normally overwrite it without warning if it exists.

cp -i myfile yourfile

With the "-i" option, if the file "yourfile" exists, you will be prompted before it is overwritten.

cp -i /data/myfile

Copy the file "/data/myfile" to the current working directory and name it "myfile". Prompt before overwriting the  file.

cp -dpr srcdir destdir

Copy all files from the directory "srcdir" to the directory "destdir" preserving links (-poption), file attributes (-p option), and copy recursively (-r option). With these options, a directory and all it contents can be copied to another dir

ln - Creates a symbolic link to a file.

ln -s test symlink

Creates a symbolic link named symlink that points to the file test Typing "ls -i test symlink" will show the two files are different with different inodes. Typing "ls -l test symlink" will show that symlink points to the file test.

locate - A fast database driven file locator.

slocate -u

This command builds the slocate database. It will take several minutes to complete this command.This command must be used before searching for files, however cron runs this command periodically  on most systems.locate whereis Lists all files whose names contain the string "whereis". directory.

more - Allows file contents or piped output to be sent to the screen one page at a time

less - Opposite of the more command

cat - Sends file contents to standard output. This is a way to list the contents of short files to the screen. It works well with piping.

whereis - Report all known instances of a command

wc - Print byte, word, and line counts

bg

bg jobs Places the current job (or, by using the alternative form, the specified jobs) in the background, suspending its execution so that a new user prompt appears immediately. Use the jobs command to discover the identities of background jobs.

cal month year - Prints a calendar for the specified month of the specified year.

cat files - Prints the contents of the specified files.

clear - Clears the terminal screen.

cmp file1 file2 - Compares two files, reporting all discrepancies. Similar to the diff command, though the output format differs.

diff file1 file2 - Compares two files, reporting all discrepancies. Similar to the cmp command, though the output format differs.

dmesg - Prints the messages resulting from the most recent system boot.

fg

fg jobs - Brings the current job (or the specified jobs) to the foreground.

file files - Determines and prints a description of the type of each specified file.

find path -name pattern -print

Searches the specified path for files with names matching the specified pattern (usually enclosed in single quotes) and prints their names. The find command has many other arguments and functions; see the online documentation.

finger users - Prints descriptions of the specified users.

free  - Displays the amount of used and free system memory.

ftp hostname

Opens an FTP connection to the specified host, allowing files to be transferred. The FTP program provides subcommands for accomplishing file transfers; see the online documentation.

head files - Prints the first several lines of each specified file.

ispell files - Checks the spelling of the contents of the specified files.

kill process_ids

kill - signal process_ids

kill -l

Kills the specified processes, sends the specified processes the specified signal (given as a number or name), or prints a list of available signals.

killall program

killall - signal program

Kills all processes that are instances of the specified program or sends the specified signal to all processes that are instances of the specified program.

mail - Launches a simple mail client that permits sending and receiving email messages.

man title

man section title - Prints the specified man page.

ping host - Sends an echo request via TCP/IP to the specified host. A response confirms that the host is operational.

reboot - Reboots the system (requires root privileges).

shutdown minutes

shutdown -r minutes

Shuts down the system after the specified number of minutes elapses (requires root privileges). The -r option causes the system to be rebooted once it has shut down.

sleep time - Causes the command interpreter to pause for the specified number of seconds.

sort files - Sorts the specified files. The command has many useful arguments; see the online documentation.

split file - Splits a file into several smaller files. The command has many arguments; see the online documentation

sync - Completes all pending input/output operations (requires root privileges).

telnet host - Opens a login session on the specified host.

top - Prints a display of system processes that's continually updated until the user presses the q key.

traceroute host - Uses echo requests to determine and print a network path to the host.

uptime - Prints the system uptime.

w - Prints the current system users.

wall - Prints a message to each user except those who've disabled message reception. Type Ctrl-D to end the message.

Record PC Speaker and Mic Audio via VLC

[youtube=http://youtu.be/QapKpjv-w24]

[youtube=http://youtu.be/LuFgZq6y6Fg]

The VIDEO was Uploaded by Gotbletu - Linux Tutorials
Requires/ What uploader used:
pulseaudio
alsa-utils
vlc
pavucontrol
gtk-recordmydesktop
------------
commands for vlc: Alt+F2 type
to pass to alsa:
vlc alsa://plughw:0,0
if u need for pulse:
vlc alsa://pulse
------
To restart alsa or pulseaudio, close other apps like browsers, music and video players 1st
For Alsa:
$ sudo /sbin/alsa force-reload
For Pulse
$ killall pulseaudio && pulseaudio

How to Make/Repair a Network Cable

The steps below are general Ethernet Category 5 (commonly known as Cat 5) cable construction guidelines. For our example, we will be making a Category 5e patch cable, but the same general method will work for making any category of network cables.

Steps



  1. Unroll the required length of network cable and add a little extra wire, just in case. If a boot is to be fitted, do so before stripping away the sleeve and ensure the boot faces the correct way.




  2. Carefully remove the outer jacket of the cable.



    Carefully remove the outer jacket of the cable. Be careful when stripping the jacket as to not nick or cut the internal wiring. One good way to do this is to cut lengthwise with snips or a knife along the side of the cable, away from yourself, about an inch toward the open end. This reduces the risk of nicking the wires' insulation. Locate the string inside with the wires, or if no string is found, use the wires themselves to unzip the sheath of the cable by holding the sheath in one hand and pulling sideways with the string or wire. Cut away the unzipped sheath and cut the twisted pairs about 1 1/4" (30 mm). You will notice 8 wires twisted in 4 pairs. Each pair will have one wire of a certain color and another wire that is white with a colored stripe matching its partner (this wire is called a tracer).




  3. Inspect the newly revealed wires for any cuts or scrapes that expose the copper wire inside.



    Inspect the newly revealed wires for any cuts or scrapes that expose the copper wire inside. If you have breached the protective sheath of any wire, you will need to cut the entire segment of wires off and start over at step one. Exposed copper wire will lead to cross-talk, poor performance or no connectivity at all. It is important that the jacket for all network cables remains intact.




  4. Untwist the pairs so they will lay flat between your fingers.



    Untwist the pairs so they will lay flat between your fingers. The white piece of thread can be cut off even with the jacket and disposed (see Warnings). For easier handling, cut the wires so that they are 3/4" (19 mm) long from the base of the jacket and even in length.




  5. Arrange the wires based on the wiring specifications you are following.



    Arrange the wires based on the wiring specifications you are following. There are two methods set by the TIA, 568A and 568B. Which one you use will depend on what is being connected. A straight-through cable is used to connect two different-layer devices (e.g. a hub and a PC). Two like devices normally require a cross-over cable. The difference between the two is that a straight-through cable has both ends wired identically with 568B, while a cross-over cable has one end wired 568A and the other end wired 568B.  For our demonstration in the following steps, we will use 568B, but the instructions can easily be adapted to 568A.

    • 568B - Put the wires in the following order, from left to right:

      • white orange

      • orange

      • white green

      • blue

      • white blue

      • green

      • white brown

      • brown



    • 568A - from left to right:

      • white/green

      • green

      • white/orange

      • blue

      • white/blue

      • orange

      • white/brown

      • brown





  6. You can also use the mnemonic 1-2-3-6/3-6-1-2 to remember which wires are switched.

    Image:Rj45568AB_955.gif


  7. Press all the wires flat and parallel between your thumb and forefinger. Verify the colors have remained in the correct order. Cut the top of the wires even with one another so that they are 1/2" (12.5 mm) long from the base of the jacket, as the jacket needs to go into the 8P8C connector by about 1/8", meaning that you only have a 1/2" of room for the individual cables. Leaving more than 1/2" untwisted can jeopardize connectivity and quality. Ensure that the cut leaves the wires even and clean; failure to do so may cause the wire not to make contact inside the jack and could lead to wrongly guided cores inside the plug.




  8. Keep the wires flat and in order as you push them into the RJ-45 plug with the flat surface of the plug on top.



    Keep the wires flat and in order as you push them into the RJ-45 plug with the flat surface of the plug on top. The white/orange wire should be on the left if you're looking down at the jack. You can tell if all the wires made it into the jack and maintain their positions by looking head-on at the plug. You should be able to see a wire located in each hole, as seen at the bottom right. You may have to use a little effort to push the pairs firmly into the plug. The cabling jacket should also enter the rear of the jack about 1/4" (6 mm) to help secure the cable once the plug is crimped. You may need to stretch the sleeve to the proper length. Verify that the sequence is still correct before crimping.




  9. Place the wired plug into the crimping tool.



    Place the wired plug into the crimping tool. Give the handle a firm squeeze. You should hear a ratcheting noise as you continue. Once you have completed the crimp, the handle will reset to the open position. To ensure all pins are set, some prefer to double-crimp by repeating this step.

  10. Repeat all of the above steps with the other end of the cable. The way you wire the other end (568A or 568B) will depend on whether you're making a straight-through, rollover, or cross-over cable (see Tips).




  11. Test the cable to ensure that it will function in the field.

    Test the cable to ensure that it will function in the field.
    Mis-wired and incomplete network cables could lead to headaches down the road. In addition, with power-over-Ethernet (PoE) making its way into the market place, crossed wire pairs could lead to physical damage of computers or phone system equipment, making it even more crucial that the pairs are in the correct order. A simple cable tester can quickly verify that information for you. Should you not have a network cable tester on hand, simply test connectivity pin to pin.
    [Or Check directly by inserting into your Router and PC]






    Tips


    • CAT5 and CAT5e are very similar cables, however CAT5e offers better quality especially on longer runs. If making a longer run, CAT5e is recommended, however CAT5 is still an option for small patch cables.

    • A key point to remember in making Ethernet patch cords is that the "twists" in the individual pairs should remain entwined as long as possible until they reach the RJ-45 plug termination. The twisting of the pairs in the network cable is what helps to ensure good connectivity and keeps cross-talk interference to a minimum. Do not untwist the wires any more than you need to.

    • A good idea on the long runs, especially those that you need to hang or snake around, is to crimp and test the cable before you run the cable. This is recommended especially to anyone who is first starting out crimping their own cables, as it ensures you are crimping the correct pin order now, rather than trying to trouble shoot later.

    • Always keep a box of Network Cable resting on one of the four 'end' surfaces, never on one of its two sides. This prevents loops falling across each other inside the box causing binding and knots.


    Warnings


    • Fire Codes require a special type of cover over the wires if the cabling is to be installed in ceilings or other areas that are exposed to the building ventilation system. This is usually referred to as plenum-grade cable or simply "plenum cable", and does not release toxic fumes when burned. Plenum cabling is more costly, perhaps double that of ordinary cable, so only use where necessary. Riser cable is similar to plenum, but is for use in walls or wiring closets to connect floors. Riser may not replace plenum cable so be aware of what area you are laying your cable. If in doubt, use plenum as it has the strictest and safest ratings.

    • RJ-45 is the common term most individuals use for the connectors present in CAT5 cabling. The correct name of the connector is simply 8P8C, where as RJ-45 is the name of a very similar looking defunct connector used in telecommunication. Most people will understand RJ-45 as 8P8C, but be careful when purchasing out of a catalog or online where you can't visibly determine which you are purchasing.

    • Unless you need to do a large amount of cabling work, it may be less frustrating and, due to the cost of tools, less expensive to purchase ready-made cables.

    • A cat5 cable can not exceed 100 meters, or 328 feet. It probably shouldn't go beyond 300 feet.

    • The ripcords, if present, are usually quite strong, so do not attempt to break them. Cut them.

    • Be aware of any shielding your cable may have. The most common type of cable is UTP (Unshielded Twisted Pair), but a number of shielding/foiling options exist for added protection against EMI. Be aware of what you are purchasing and what you need. In most environments, UTP will be fine.


    Things You'll Need


    • Crimper - This is the most essential tool and critical to the cable making process. If you don't have a quality crimper, then your cable connections will be bad. Inferior crimpers will make it difficult and/or nearly impossible to achieve a tight connection between the wires. Many better quality crimpers also have a ratcheting controlled closure for precise crimping. Crimpers with a plastic body will be more likely to develop a sloppy hip joint and give consistently poor cramps; a metal crimper is much preferred, and very common.

    • Tester (Optional) - Although not necessary for making cables, having a good cable tester can prevent and solve cable wiring configuration and installation problems. Most testers consist of two boxes (transmitter and receiver) you plug your patch cable into. The transmitter box tests the cable by sending test pulses down each individual wire, lighting up LED lights on the receiver box. Most testers will show you a result of the pass. Why do you want to test cables? Even if they are slightly damaged, network cables will work, but cause packet loss and data corruption to your hardware.

    • RJ45 Connectors - Ensure your RJ45 connectors are designed for the type of cable you are using (solid/stranded), as they have different types of teeth for piercing between multiple strands or around a solid single strand. Note: if you ask in an electrical trades store for RJ45 connectors, you may be asked whether you want "solid", "stranded" or "flat". The "flat" choice relates to the old flat "silver satin" cables used in 10Base-T, and should not be used in new Ethernet deployments.

    • Bulk Cable - Bulk cable can be found at computer stores, electrical stores, and home centers. You can obtain Category 5, Category 5e, and Category 6 cable, depending on your needs. For lengths shorter than 50' use a stranded/braided cable. For lengths greater than 50' use a solid cable.

      • There are two types of wire (solid or stranded) and which one you choose should be based on where and how the patch cable is to be used. See warning above about PLENUM cable. Stranded wire is best for a workstation patch as it can tolerate flexing without cracking the conductors; however, the trade off is that they're more susceptible to moisture penetration.[2] Solid is best used in a wire closet or for a patch that will be moved very infrequently, as the conductor tends to crack if bent and/or flexed. Cracked conductor leads to "reflections" which make for chatter on the LAN connection, hampering speed and reliability.



    • Boots (optional but preferred). It saves the cable in the long run and improves the looks. A boot is a molded piece of plastic that protects the connector from snagging, if it is pulled through the wall or conduit. It also provides strain relief on the cable, making it harder for the connector to be pulled off.

    • Straight edge wire cutter. You may find serrated snips work very nicely. Use something that gives an easy square cut; avoid diagonal pliers for this reason. You will find that many quality crimpers have a straight edge cutter built in.

    • Fish Tape - Fish tape is either a metal or plastic spool of guide wire. Strong enough not to buckle and bend while being pushed around, but flexible enough to be pushed past corners and bends, fish tape is a vital tool for some cable runs. Recommended conditions include: conduit, within walls, along structural beams and girders, in ducting, plenums, and dropped ceilings, or any situation where it's not physically possible to drag the cable along with you.


    [ Also, Look for:  What Is The Difference Between Cat 5, Cat 5e, and Cat 6 Cable?]





Monday, January 14, 2013

Installing and Configuring Samba Ubuntu 12.04

Installing and Configuring Samba Ubuntu 12.04
One of the most common ways to network Ubuntu and Windows computers is to configure Samba as a File Server.


Samba allows file and print sharing between computers running Windows and computers running Unix.  Samba sets up network shares for chosen Unix directories (including all contained sub-directories). These appear to Microsoft Windows users as normal Windows folders accessible via the network.


In this tutorial, we will configure Samba on Ubuntu 12.04 Desktop edition.


First thing to do is to make sure that your Ubuntu system is up-to-date with all the latest packages and updates.


To ensure this, run the following command:

# sudo apt-get update


Once the update completes, we can now setup the Samba server on Ubuntu.


First, we install the necessary Samba packages

# sudo apt-get install samba samba-common




The next thing to do is install Python-Glade.
# sudo pat-get install python-glade2

 
Before we move ahead further with the installation, it is recommended that you create a user for your Samba Server. This user will be a dedicated user account used with Samba.


To create a new user:

# adduser <username>


NOTE: You need to have root (sudo) privileges to run this command.



 
The last step is to install the Samba UI. This option is available ONLY in the Desktop editions of Ubuntu. In case you have a Ubuntu Server, then you need not run this command.


# sudo apt-get install system-config-samba



 
Once installed, we can view the Samba configuration utility by opening the dash and using the search bar to find Samba like so:



 
To share a folder with Samba, click the green ‘+’ (plus) icon to open a dialogue box called ‘Create Samba Share’ like so:

 

 
Complete the ‘basic’ tab with the required information.


  • Directory: Click ‘Browse’ to locate the relevant folder you wish to share.

  • Share Name: Use this field to specify a ‘human friendly’ name for your share folder.

  • Description: Type a description of the ‘share folder’ in this field.

  • Writable: Shared folders are ‘read-only’ by default, so place a tick in this box if you would like to enable ‘write’ access.

  • Visible. Place a tick in this box if you want your share folder to be ‘visible’ on the network.


 

Following this, we now need to set the permissions for your new share folder.


To do this, simply click the ‘Access’ tab in the same dialogue box like so:




You can select the users you want to have access to Samba Server from here.


NOTE: You can alternatively select "Allow Access to Everyone", but this setting is not recommended in production environments.

 

 
Once your settings are completed, you are now ready to test out your Samba Server

 

 
On your Windows system, go to "Network". If your Ubuntu system is not visible, just refresh the Network.

 

 
You will see your shared folder

 

 
Depending on your security setting, you may be prompted to enter credentials for the Shared Folder.

 


If all goes well, you now have a shared folder between your Ubuntu and Windows Server.


Thursday, January 10, 2013

6 Stages of Linux Boot Process (Startup Sequence)

6 Stages of Linux Boot Process

Press the power button on your system, and after few moments you see the Linux login prompt.

Have you ever wondered what happens behind the scenes from the time you press the power button until the Linux login prompt appears?

The following are the 6 high level stages of a typical Linux boot process.


1. BIOS



  • BIOS stands for Basic Input/Output System

  • Performs some system integrity checks

  • Searches, loads, and executes the boot loader program.

  • It looks for boot loader in floppy, cd-rom, or hard drive. You can press a key (typically F12 of F2, but it depends on your system) during the BIOS startup to change the boot sequence.

  • Once the boot loader program is detected and loaded into the memory, BIOS gives the control to it.

  • So, in simple terms BIOS loads and executes the MBR boot loader.


2. MBR



  • MBR stands for Master Boot Record.

  • It is located in the 1st sector of the bootable disk. Typically /dev/hda, or /dev/sda

  • MBR is less than 512 bytes in size. This has three components 1) primary boot loader info in 1st 446 bytes 2) partition table info in next 64 bytes 3) mbr validation check in last 2 bytes.

  • It contains information about GRUB (or LILO in old systems).

  • So, in simple terms MBR loads and executes the GRUB boot loader.


3. GRUB




    • GRUB stands for Grand Unified Bootloader.

    • If you have multiple kernel images installed on your system, you can choose which one to be executed.

    • GRUB displays a splash screen, waits for few seconds, if you don’t enter anything, it loads the default kernel image as specified in the grub configuration file.

    • GRUB has the knowledge of the filesystem (the older Linux loader LILO didn’t understand filesystem).

    • Grub configuration file is /boot/grub/grub.conf (/etc/grub.conf is a link to this). The following is sample grub.conf of CentOS.



#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-194.el5PAE)
root (hd0,0)
kernel /boot/vmlinuz-2.6.18-194.el5PAE ro root=LABEL=/
initrd /boot/initrd-2.6.18-194.el5PAE.img


  • As you notice from the above info, it contains kernel and initrd image.

  • So, in simple terms GRUB just loads and executes Kernel and initrd images.


4. Kernel



  • Mounts the root file system as specified in the “root=” in grub.conf

  • Kernel executes the /sbin/init program

  • Since init was the 1st program to be executed by Linux Kernel, it has the process id (PID) of 1. Do a ‘ps -ef | grep init’ and check the pid.

  • initrd stands for Initial RAM Disk.

  • initrd is used by kernel as temporary root file system until kernel is booted and the real root file system is mounted. It also contains necessary drivers compiled inside, which helps it to access the hard drive partitions, and other hardware.


5. Init



  • Looks at the /etc/inittab file to decide the Linux run level.

  • Following are the available run levels

    • 0 – halt

    • 1 – Single user mode

    • 2 – Multiuser, without NFS

    • 3 – Full multiuser mode

    • 4 – unused

    • 5 – X11

    • 6 – reboot



  • Init identifies the default initlevel from /etc/inittab and uses that to load all appropriate program.

  • Execute ‘grep initdefault /etc/inittab’ on your system to identify the default run level

  • If you want to get into trouble, you can set the default run level to 0 or 6. Since you know what 0 and 6 means, probably you might not do that.

  • Typically you would set the default run level to either 3 or 5.


6. Runlevel programs



  • When the Linux system is booting up, you might see various services getting started. For example, it might say “starting sendmail …. OK”. Those are the runlevel programs, executed from the run level directory as defined by your run level.

  • Depending on your default init level setting, the system will execute the programs from one of the following directories.

    • Run level 0 – /etc/rc.d/rc0.d/

    • Run level 1 – /etc/rc.d/rc1.d/

    • Run level 2 – /etc/rc.d/rc2.d/

    • Run level 3 – /etc/rc.d/rc3.d/

    • Run level 4 – /etc/rc.d/rc4.d/

    • Run level 5 – /etc/rc.d/rc5.d/

    • Run level 6 – /etc/rc.d/rc6.d/



  • Please note that there are also symbolic links available for these directory under /etc directly. So, /etc/rc0.d is linked to /etc/rc.d/rc0.d.

  • Under the /etc/rc.d/rc*.d/ directories, you would see programs that start with S and K.

  • Programs starts with S are used during startup. S for startup.

  • Programs starts with K are used during shutdown. K for kill.

  • There are numbers right next to S and K in the program names. Those are the sequence number in which the programs should be started or killed.

  • For example, S12syslog is to start the syslog deamon, which has the sequence number of 12. S80sendmail is to start the sendmail daemon, which has the sequence number of 80. So, syslog program will be started before sendmail.


There you have it. That is what happens during the Linux boot process

Linux Inspires

[youtube=http://youtu.be/GfU6ngCVips]

A video by Linux Foundation

 

20 Useful Terminal Commands and Tools that you May Need in Ubuntu/Linux Mint


Linux Terminal
Terminal is a text-based interface that grants users direct access to the UNIX system. You can use Terminal to run some specific commands, create files/folders, change system settings, and any other features that aren't available via programs with GUI.
In this article, I have collected 20 tools and commands that can be useful for Ubuntu/Linux Mint users. If you have more interesting commands or tools, you can mention them below.

1. Make An ISO From A Folder

If you want to make an iso file from a directory containing other files and sub-directories via the terminal, you can use the following command:
mkisofs -o image.iso -R /path/to/folder/

If you wish to backup the home folder, use this command:
mkisofs -o image.iso -R $HOME

2. Remove Non-Empty Folder

To remove a non-empty folder from the command line, you can use this command:
rm -rf /path/to/folder/

3. Checking Current CPU Architecture (32-bit or 64-bit)

To list your processor architecture in Ubuntu/Linux Mint, use one of these commands:
uname -m

or
arch

or
file /bin/bash | cut -d' ' -f3

4. Generate Random Passwords

To generate random passwords via the terminal, you can use the following commands:

a - makepasswd

makepasswd is a command line tool for generating passwords in Ubuntu/Linux Mint. Install it with this command:
sudo apt-get install makepasswd

To generate a password with 20 characters, enter this command:
makepasswd --chars=20

b- OpenSSL

You can also use OpenSSL to generate random passwords using this simple command:
openssl rand -base64 20

5. Check Uptime

To check for how long your computer or laptop has been running since you powered it on, issue this command:
uptime

To monitor system uptime in real-time, use this command:
watch -n 1 uptime

6. Check Information About Your Video Card

To list information about your graphics card (Nvidia, AMD, Intel, etc.), enter this command:
lspci -v -s `lspci | awk '/VGA/{print $1}'`

7. Download And Extract Tar Files In One Command

If you want to extract an archive file after being downloaded in a single command, you can use the following command for tar files:
wget URL-To-TAR-File -O - | tar xfz -

Here is an example:
wget http://garr.dl.sourceforge.net/project/multibootusb/MultiBootUSB_4.7.tar.gz -O - | tar xfz -

8. Block/Unblock Wifi/Bluetooth

To disable wifi or Bluetooth in Ubuntu/Linux Mint, we can simply use the rfkill command line tool. To deactivate wifi, enter this command:
rfkill block wlan

For Bluetooth:
rfkill block bluetooth

To unblock WiFi, enter this command:
rfkill unblock wlan

For Bluetooth:
rfkill unblock bluetooth

9. Check CPU Temperature

To get the current temperature of your processor, issue this command:
acpi -t

To check CPU temp in real-time, run this command:
watch -n 1 acpi -t


10. Change Read Speed Of A CD/DVD

Let's first get the maximum read speed of your optical drive with this command:
eject -X

To increase/decrease read speed of a CD/DVD inserted into your optical drive, enter this command followed by the desired speed:
eject -x 4

For more than one optical disc drive, use this command:
eject /dev/cdrom -x 4

11. Check RAM Speed

To check memory speed from the command line, run this command:
sudo dmidecode -t 17 | awk -F":" '/Speed/ { print $2 }'

12. Read/Write Speed Of A Hard Disk

To check read/write speed of your hard drive on the terminal, use this command:
sudo hdparm -tT /dev/sda

13. Monitor Network Usage

IPTraf is a command line utility that allows to monitor network activities in real-time. Install it in Ubuntu/Linux Mint with this command:
sudo apt-get install iptraf

Start monitoring using this command:
sudo iptraf

14- Downloading Websites

If you want to download an entire website via the terminal, enter this command:
wget --recursive --page-requisites --convert-links www.domain.com

15. Check Gmail Unread Messages

To check for unread messages in your Gmail account, use this command:
curl -u GMAILUSER --silent "https://mail.google.com/mail/feed/atom" | perl -ne 'print "\t" if //; print "$2\n" if /<(title|name)>(.*)<\/\1>/;'

16. Monitor HDD Temperature

Use hddtemp to monitor hard disk temperature on the terminal. Run these commands:
sudo apt-get install hddtemp

sudo hddtemp /dev/sda

17. Force Kill Apps

To force close an unresponsive software, run xkill from the terminal then click the software's window to close it.

18. Screen Recording

To capture your screen and record it in a video, use ffmpeg:
sudo apt-get install ffmpeg

ffmpeg -f x11grab -s wxga -r 25 -i :0.0 -sameq output.mpg

19. Check Current Kernel Version

You can simply use this command:
uname -r

20. Dtrx

The dtrx tool allows to extract most archive files without the hassle of memorizing the various extraction commands. To install it, run this command:

sudo apt-get install dtrx

Here are some examples:
dtrx file.zip

dtrx file.tar.gz

dtrx file.7z

Wednesday, January 9, 2013

Darktable: Opensource Alternative 4 Photoshop

Darktable is an application used for image managing and image editing.
Darktable is an open source photography workflow application and RAW developer. A virtual lighttable  and darkroom for photographers. It manages your digital negatives in a database, lets you view them through a zoomable lighttable and enables you to develop raw images and enhance them.we can import images from your computer as single file or a grop of images which is termed as film roll.The software also scans for external devices. Thumbnailing of this app is a bit slow. The app gives us options like lighttable darkroom and tethering.

lighttable

The left panel is for importing images, displaying Exif information, and filtering. Rating and categorizing buttons are at the top, while the right-side panel features various modules such as a metadata editor and a tag editor. A module used to export images is located at the bottom-right.

darkroom

This mode can be accessed by double-clicking on an image. The layout displays the image at center, with four panels around it; most tools appear on the right side. The left panel displays a pannable preview of the current image, an undo history stack, a color picker, and Exif information. A filmstrip with other images is displayed at the bottom, and can be sorted and filtered using lists from the upper panel. The latter also gives access to the preferences configuration. darktable's configuration allows custom keyboard shortcuts and personalized defaults.

tethering

A third mode allows tethering through gPhoto to cameras which support it like Canon (5D, EOS 30D, EOS 40D, EOS 400D, and EOS 550D), Nikon (D60, D70s, D90, D5000, and Nikon Coolpix P100), and the Panasonic Lumix DMC-FZ50.







Darktable support raw files from almost every camera,Import a variety of standard, raw and high dynamic range image formats like jpg, cr2, hdr, pfm etc.The powerful export system supports Picasa webalbum, flickr upload, disk storage, 1:1 copy, email attachments and can generate a simple html-based web gallery.darktable uses both XMP sidecar files as well as its fast database for saving metadata and processing settings.

Apart from usual image ,colour and effects options it comes with many features like watermarking ,framing,split toning ,vignetting,monochrome , highpass  , lowpass ,shadows and highlights which helps in image post processing.It also have many correction modules like spot removal,lens correctio,equaliser,sharpen,denoise etc.

On the whole darktable is a very good  photography workflow application and undoubtedly the best in open source

Darktable runs on GNU/Linux / GNOME, Mac OS X / macports and Solaris 11 / GNOME.


Website: http://www.darktable.org/

About Me

My photo

Android, Google, Hardware and Networking, Technologies, Linux GEEK, Open Source follower, and a NOSKian.
 

Search

Translate