Archive for August 31, 2013

how to Clear bash history -linux – Mac OS X

bash

Bash is a Unix shell written by Brian Fox for the GNU Project as a free software replacement for the Bourne shell (sh).[3][4] Released in 1989,[5] it has been distributed widely as the shell for the GNU operating system and as a default shell onLinux and Mac OS X.

how stuff work:  normally after typing commands bash will keep the history in ~/.bash_history file  up on log out

 

you can login and edit / remove .bash_history file in your home folder will do the trick

macbook-pro-2:~ ajay$ vim .bash_history

it helps even if you only need to delete last 10 commands you run..

[FIXED] Speaker Not Working After Using Headphone for few days – Mac Book pro

earbud-headphones-and-headphone-jack

Question: My Speaker Does not work after using my head phone for a few days i tried everything to make it work, but no luck…..

 

ANSWER: Just pull the headphone jack in and out a few times very quickly — dont know the reason but it works !  :)

i had to pull in and out for around 6 times

change mysql table column from ENUM to VARCHAR

 

 

mysql> ALTER TABLE database.table MODIFY column-name varchar(255) default ’10M’;

 
Query OK, 12137 rows affected (1.40 sec)
Records: 12137 Duplicates: 0 Warnings: 0

Network interface settings – CentOS

ethernet_cable

Configuration of the “/etc/sysconfig/network-scripts/ifcfg-eth0″ file

In this file, you would find your basic network device configuration. Here, ifcfg-eth0 is the first Ethernet device; ifcfg-eth1 would be the second Ethernet NIC (network interface card), and so forth. In this file, you can have quite a few settings.

Directives Required / Optional Expected Settings Comment
DEVICE= Required ethX You must have this entry specifying the Linux device name.
ONBOOT= Optional yes / no Start the device on boot? This will default to yes.
BOOTPROTO= Required static / dhcp / none Static hard set our IP, or do we want a dhcp assignment? “dhcp”, “none” is the same as static.
IPADDR= Optional IP address of machine The address we want if we are setting a static IP for the interface.
NETMASK= Optional Subnet mask Required for static IPs. The subnet mask.
NETWORK= Optional Network address Recommended for static IPs. The network that we are on.
BROADCAST= Optional Network broadcast address Recommended for static IPs. The broadcast address.
HWADDR= Optional Device MAC address The MAC address of our network card. Normally provided by the Anaconda installer at install time.
USERCTL= Optional yes / no Allow normal non-administrative user to take down and bring up the device. Defaults to “no”.
GATEWAY= Optional IP address of gateway The network gateway IP address.

Not all of these are necessary for proper operation, and the order they are in is irrelevant. I prefer to specify the additional directives of NETWORK and BROADCAST in my /etc/sysconfig/network-scripts/ifcfg-eth0 on machines that I want to have a hard-set IP address, mainly servers of any sort. If you want to use a DHCP-assigned address, your /etc/sysconfig/network-scripts/ifcfg-eth0 file would look something like this:

# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth0
BOOTPROTO=dhcp
HWADDR=08:00:27:4B:3B:06
ONBOOT=yes

Mount NTFS partition in Linux

nfsundercover

Mount NTFS partition in Linux

Mount NTFS partition in Redhat Enterpris Linux / Ubuntu Linux

Enterprise Linux distributions like Redhat Enterprise Linux ( RHEL ) does not provide native support to Windows NTFS partitions. However you may wand to mount a NTFS formated partiiton in your RHEL box. Here is a simple howto to mount NTFS partitions in your RHEL box.

First of all you need to install a couple of packages. You can use YUM for installing the packages. The rpmforge yum repo contains required rpm packages for mounting NTFS partitions on Linux server. The packages are fuse and fuse-ntfs-3g.

# yum install fuse fuse-ntfs-3g
Yes, you are done now you can mount ntfs partitions on your rhel server using the mount commandas follows.

# mount -t ntfs-3g /dev/device-name /mount-point

For example:
# mount -t ntfs-3g /dev/sdb1 /media

This one also works!!!!!

# mount.ntfs-3g /dev/sdb1 /media
Newer Ubuntu distributions like Ubuntu 10.04 LTS natively supports NTFS partiitons, so in a Ubuntu server you can mount NTFS partition by just using the above mount commnad.