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

Monday, December 1, 2008

Configure cisco devices via console port with Linux using USBserial cable!

Hi,

If you were using Windows, then you might not notice any problem trying to configure cisco devices via a console port usign usbserial cable, just plug it in the USB of your laptop and install the appropriate driver, and you are done.

You will not notice a problem with MAC OS X either, some usbserial cables even do not need any driver.

But, when you are using Linux, then you are wondering, how to obtain the driver.

In Linux ,for ease of understand, comparing to Windows, drivers = kernel modules. So, you need to load the appropriate kernel module, to have the cable works.

Here is how to have this up and running, after reading this tutorial you will be able to configure your cisco devices or any other server via console port with your laptop using usbserial cable.

If you don't know how the usbserial cable looks like, here I have a picture for mine:













Steps:
1. Load the kernel module: 'sudo modprobe pl2303'


pl2303 is the kernel module that will enable using the usbserial, to verify that is has been loaded successfully use this command, 'echo $?', if the result is "0", then it is ok.


use: 'lsmod | grep pl2303' to see what are the modules that are loaded currently or depends upon by ours.
###
lsmod | grep pl2303

pl2303 22020 0
usbserial 35816 1 pl2303
usbcore 146412 7 pl2303,usbserial,usbhid,hci_usb,ehci_hcd,uhci_hcd
###
You can see that usbserial/usbcore modules are depended upon by pl2303.

2. plug the cable into any USB port in your laptop, and issue 'screen /dev/ttyUSB0 9600', supposing that your device's speed is 9600 and using the default for flow control and other parameters. If your devices uses speed other than 9600, then you have to specify it, if any of the parameters are different then you have to specify it either, read the manual page of the screen to see how.

3. your are now in your device console.

Cheers,

Friday, November 7, 2008

Resolving the APM issue, reducing HD Load_Cycle.

Hi,

There is a noticeable issue for whom using Linux (say Ubuntu) on laptops, which is the HD load cycle.

When you leave your laptop on battery power, HD generates a strange sound, maybe 3 time per minute or once every 10 seconds, this is the sound of parking/unparking.

This happens even during activity, and this severely shortens the life of hard drives, this bug is reported on the launchpad under the name: " Bug #59695 : High frequency of load/unload cycles on some hard disks may shorten lifetime".

Now, I think they managed to resolve the problem in the latest Ubuntu release 8.10. Yet, I am using Ubuntu 8.04.1 Hardy and the problem still exist.

Therefore, I have fixed this problem temporally until there is an official fix for this issue in the next update.

My solution will effectively keep this parameter at reasonable amount: 193 Load_Cycle_Count. You can know your number by executing this command in a shell: 'sudo smartctl -a /dev/sda', you have to install "smartmontools" program before you can use this command.

Steps:
1. install smartmontools by issuing this command in a shell: 'sudo aptitude install smartmontools'
2. create a new file named: "hdparm" in the /etc/init.d
3. edit /etc/hdparm.conf to add the following lines in it:

/dev/sda { #Your HD's name maybe different
apm = 255
spindown_time = 0
}

4. edit /etc/init.d/hdparm to add the following line in it:
#!/bin/sh
hdparm -B 255 /dev/sda #Or whatever your HD name is.
hdparm -S0 /dev/sda #Or whatever your HD name is.

5. give hdparm execute permission: 'sudo chmod +x /etc/init.d/hdparm'
6. edit /etc/acpi/power.sh: 'nano /etc/acpi/power.sh', to replace the 1 from the command '$HDPARM -B 1 /dev/$drive 2>/dev/null' with 255, the new command will be: '$HDPARM -B 255 /dev/$drive 2>/dev/null'
7. update the rc by issuing this command: 'sudo update-rc.d hdparm defaults', this will make hdparm script start at boot time.
8. DONE

This will reduce the number of spinning down per min/hour/day significantly.

Thanks

Wednesday, September 10, 2008

Enjoy man pages colorized

Hi everyone,

Linux users know that manual pages (aka man pages), is initially black and white.

Yet, we can colorize them with two simple steps: (I use Linux mint/ubuntu here)

-- Open a shell and execute this:
sudo aptitude install most
-- After application is installed successfully, execute the following:
sudo update-alternatives --set pager /usr/bin/most

That is it, now enjoy a beautiful colored man pages..

Cheeeeeeeers.

Sunday, September 7, 2008

How to look up in the dictionary, via CLI (Command Line Interpreter)

Hi,

Have you been in a problem, when you don't have a GUI, and want to look up a word in the dictionary.

Here is how to do it, so let's begin:

Everybody heard about www.dict.org. Oh, you did not! so let me tell you, dict.org is a WWW interface to several freely available on-line dictionaries.

This is the first resource, second, is DICT protocol, which is a protocol to access dictionary services on the Internet (like www, a protocol to access hyper-text transfer services on the Internet, i.e. web browsing).

So, we need a combination, to make DICT to transfer data from dict.org via CLI. Yes, we have curl.

CURL, is a tool to transfer data from or to a server, using one of the supported protocols HTTP, HTTPS, FTP, FTPS, SCP, SFTP, TFTP, DICT, TELNET, LDAP or FILE). The command is designed to work without user interaction.

Now, how to use curl to transfer dictionary queries from dict.org to our CLI, here is how:

curl dict://dict.org/d:<word_to_look_in_the_dictionary>

for example: curl dict://dict.org/d:lion, will give the following results:

220 aspen.miranda.org dictd 1.9.15/rf on Linux 2.6.18-6-k7 <675471.1393.1220856699@aspen.miranda.org>
250 ok
150 1 definitions retrieved
151 "Lion" gcide "The Collaborative International Dictionary of English v.0.48"
Lion \Li"on\ (l[imac]"[u^]n), n. [F. lion, L. leo, -onis, akin
to Gr. le`wn. Cf. {Chameleon}, {Dandelion}, {Leopard}.]
1. (Zool.) A large carnivorous feline mammal ({Panthera leo},
formerly {Felis leo}), found in Southern Asia and in most
parts of Africa, distinct varieties occurring in the
different countries. The adult male, in most varieties,
has a thick mane of long shaggy hair that adds to his
apparent size, which is less than that of the largest
tigers. The length, however, is sometimes eleven feet to
the base of the tail. The color is a tawny yellow or
yellowish brown; the mane is darker, and the terminal tuft
of the tail is black. In one variety, called the {maneless
lion}, the male has only a slight mane.
[1913 Webster]

2. (Astron.) A sign and a constellation; Leo.
[1913 Webster]

3. An object of interest and curiosity, especially a person
who is so regarded; as, he was quite a lion in London at
that time.
[1913 Webster]

Such society was far more enjoyable than that of
Edinburgh, for here he was not a lion, but a man.
--Prof.
Wilson.
[1913 Webster]

{American lion} (Zool.), the puma or cougar.

{Lion ant} (Zool.), the ant-lion.

{Lion dog} (Zool.), a fancy dog with a flowing mane, usually
clipped to resemble a lion's mane.

{Lion lizard} (Zool.), the basilisk.

{Lion's share}, all, or nearly all; the best or largest part;
-- from Aesop's fable of the lion hunting in company with
certain smaller beasts, and appropriating to himself all
the prey.

{Lion of Lucerne}, a famous sculptured lion at Lucerne,
Switzerland, designed by Thorwaldsen and dedicated in 1821
as a memorial to the Swiss Guards who fell defending Louis
XVI. in the attack of the mob on the Tuileries, Aug. 10,
1792. The animal, which is hewn out of the face of a rock,
is represented as transfixed with a broken spear and
dying, but still trying to protect with its paw a shield
bearing the fleur-de-lis of France.

{Lion of St. Mark}, a winged lion, the emblem of the
evangelist Mark, especially that of bronze surmounting a
granite column in the Piazzetta at Venice, and holding in
its fore paws an open book representing St. Mark's Gospel.


{Lion of the North}, Gustavus Adolphus (1594-1632), King of
Sweden, the hero of the Protestant faith in the Thirty
Years' War.
[1913 Webster + Webster 1913 Suppl.]
.
250 ok [d/m/c = 1/0/17; 0.000r 0.000u 0.000s]
221 bye [d/m/c = 0/0/0; 0.000r 0.000u 0.000s]

Thank you for viewing,

Saturday, August 30, 2008

Change the MAC address of a NIC in Debian system

Hi,

Today we will see how to change the MAC address of a Network Interface Card (NIC) in a Debian/Debian like system.

There are a lot of reasons you might want to manually set your MAC address for your network card.

To do so, we need to edit the "/etc/network/interfaces" file.
Run this command in a shell:
gedit /etc/network/interfaces
OR
vim /etc/network/interfaces

We should see the line for the NIC, it should be eth0 for the first Ethernet interface, or wlan0 for the first wireless Lan. If we have dhcp enabled, it will look like this:

auto eth0
iface eth0 inet dhcp

By adding another line we shall change the NIC MAC address:

auto eth0
iface eth0 inet dhcp
hwaddress ether 00:13:e8:a5:2a:c9

MAC address (Media Access Control), is a 6 bytes address in hexa format, its format should look like this: xx:xx:xx:xx:xx:xx. Each x is a number from 0-9, or a letter from a-f.

Now, we have to restart the networking service for the changes to take effect, by running this command in a shell as root:
/etc/init.d/networking restart

After changes take effect, we have successfully changed the MAC address of our happy NIC.

Regards,

Sunday, July 20, 2008

How to make firefox faster

Mozilla Firefox is a graphical web browser developed by the Mozilla Corporation.

Mozilla Firefox is a cross-platform browser, providing support for various versions of Microsoft Windows, Mac OS X, and Linux.

Although not officially released for certain operating systems, the freely available source code works for many other operating systems, including FreeBSD,OS/2, Solaris, SkyOS, BeOS and more recently, Windows XP Professional x64 Edition.

I am providing some Very Useful Tips to speedup your Firefox.

Lets begin:


In your location bar (URL), type about:config

Tip1
In the filter bar type network.http.pipelining
Normally it says ” false ” under value field , Double click it so it becomes ” true “.

Tip2
In the filter bar again and type network.http.pipelining.maxrequests
Default it says 4 under value field and you need to change it to 8

Tip3
Go to the filter bar again and type network.http.proxy.pipelining
Normally it says ” false ” under value field , Double click it so it becomes ” true “.

Tip4
Go to the filter bar again and type network.dns.disableIPv6
Normally it says ” false ” under value field , Double click it so it becomes ” true “.

Tip5
Go to the filter bar again and type plugin.expose_full_path
Normally it says ” false ” under value field , Double click it so it becomes ” true “.

Tip6
Now you need to Create new Preference name with interger value for this got to Right click -> New -> Integer
Here you need to type nglayout.initialpaint.delay and click ok
Now you need to enter 0 in value filed and click ok

Tip7
Now you need to Create one more Preference name with interger value for this got to Right click -> New -> Integer
Here you need to type content.notify.backoffcount and click ok
Now you need to enter 5 in value filed and click ok

Tip8
Now you need to Create one more Preference name with interger value for this got to Right click -> New -> Integer
Here you need to type ui.submenuDelay and click ok
Now you need to enter 0 in value filed and click ok

Some more Tweaks
Enable the spellchecker for inputfields and textareas (default is textareas only)
layout.spellcheckDefault=2

Open lastfm://-links directly in amarok
network.protocol-handler.app.lastfm=amarok
network.protocol-handler.external.lastfm=true

Firefox Memory Leak Fix
Open a new tab. Type “about:config” without quotes into the address bar and hit enter/click Go.
Right-click anywhere, select New, then Integer. In the dialog prompt that appears, type:
browser.cache.memory.capacity


Click OK. Another dialog prompt will appear. This is where you decide how much memory to allocate to Firefox. This depends on how much RAM your computer has, but generally you don’t want to allocate too little (under 8MB), but if you allocate too much, you might as well not do this. A good recommended setting is 16MB. If you want 16MB, enter this value into the dialog prompt: 16384

(Why 16384 instead of 16000? Because computers use base-12 counting. Thus 16 megabytes = 16384 bytes. Likewise, if you want to double that and allocate 32MB, you’d enter 32768.)

Click OK to close the dialog box, then close all instances of Firefox and restart. If your Firefox still uses the same amount of memory, give it a few minutes and it should slowly clear up. If that fails, try a system reboot.

Now your Firefox will now be 3 - 30 times faster in loading pages.



Original article can be found in: www.ubuntugeek.com

How to make fonts in Ubuntu Linux more clear

This is how to make fonts in Ubuntu Linux more clear and nicer.
Four very easy steps and all done, so lets get started:

-- Open a terminal window and write this line into it:
sudo ln /etc/fonts/conf.avail/10-autohint.conf /etc/fonts/conf.d/. -s

-- edit the file ~/.fonts.conf, which is in your home directory, or create it if it does not exist:
gedit ~/.fonts.conf

-- then write the following xml code in it:

code

Done, save and exit gedit.

-- Finally run the following command in the opened terminal window:
fc-cache -vf

Now you are done, but one more step further, restart your graphical session ;-)

You will notice the fonts are very clear and much more sharper and nicer.

Regards,