Saturday, January 11, 2014

How to mount remote windows partition (windows share) under Linux

How to mount remote windows partition (windows share) under Linux

How to mount remote windows partition (windows share) under Linux

by NIX Craft on April 26, 2004 · 61 comments· LAST UPDATED August 3, 2007

in CentOS, File system, Howto

All files accessible in a Linux (and UNIX) system are arranged in one big tree, the file hierarchy, rooted at /. These files can be spread out over several devices. The mount command serves to attach the file system found on some device to the big file tree.

Use the mount command to mount remote windows partition or windows share under Linux as follows:

Procedure to mount remote windows partition (NAS share)

1) Make sure you have following information:
==> Windows username and password to access share name
==> Sharename (such as //server/share) or IP address
==> root level access on Linux

2) Login to Linux as a root user (or use su command)

3) Create the required mount point:
# mkdir -p /mnt/ntserver
4) Use the mount command as follows:
# mount -t cifs //ntserver/download -o username=vivek,password=myPassword /mnt/ntserver

Use following command if you are using Old version such as RHEL <=4 or Debian <= 3:
# mount -t smbfs -o username=vivek,password=D1W4x9sw //ntserver/download /mnt/ntserver

5) Access Windows 2003/2000/NT share using cd and ls command:
# cd /mnt/ntserver; ls -l
Where,

  • -t smbfs : File system type to be mount (outdated, use cifs)
  • -t cifs : File system type to be mount
  • -o : are options passed to mount command, in this example I had passed two options. First argument is password (vivek) and second argument is password to connect remote windows box
  • //ntserver/download : Windows 2000/NT share name
  • /mnt/ntserver Linux mount point (to access share after mounting)

 

Thursday, January 9, 2014

Install Android Emulator on Centos 6

Install Android Emulator on Centos 6

 

Why would I want to have the Android Emulator? Well, I needed to test several custom Android  Packages and also develop apps for Android. This meant, I could keep testing the Android Packages without having to install on a physical Android phone such as the Sony Ericsson X10 or Samsung S3.

 

I have written on this topic for Centos 64bits, before and seems like it still depends on 32bit libraries:

 

    http://tboxmy.blogspot.com/2012/04/installing-java-on-centos-6.html

    http://tboxmy.blogspot.com/2012/07/develop-android-apps-with-eclipse-on.html

 

 

A good reference for everything Android is at http://developer.android.com/sdk/index.html

 

Here are steps for Centos 6.4 (64bits), open up a terminal as root;

 

Step 1: Install Java development kit (JDK)

# yum update

# yum install java-1.7.0-openjdk-devel.x86_64

 

Verify installation with following command:

# javac -version

 

Step 2a: Install library for 32bits

yum install glibc.i686 ncurses-libs.i686 libstdc libstdc++.i686 libzip.i686 SDL.i686 gegl.i686  mesa-libGL.i686

 

Note: Optional package to install: libX11.i686 libXrandr.i686

 

Step 2: Install the Android SDK and ADT

Get the latest Android ADT from the Android Developer site or use following:

wget http://dl.google.com/android/adt/adt-bundle-linux-x86_64-20130729.zip

 

This will provide us with (Size if 440MB):

 

    Eclipse + ADT plugin

    Android SDK Tools

    Android Platform-tools

    The latest Android platform

    The latest Android system image for the emulator

 

Note: If you are in Malaysia and cant download because of Internet problem (Some day this will improve) and really have no other way of getting the ADT and JDK for Centos 6 64bits, just email me your contact details (e.g. address) and we can work something out.

 

Allow groups named devel to access development. Create the directory /opt/android and extract adt-bundle-linux-x86_64-20130729.zip

 

# mkdir /opt/android

# useradd -m devel

# chown devel.devel /opt/android

# chmod g+rwsx,+t /opt/android

# unzip -d /opt/android/ adt-bundle-linux-x86_64-20130729.zip

 

Step 3: Post installation.

What can we do after installation? Well, you can run the Eclipse IDE to develop application and there is also the Android Emulator (to test APK). Info on the Android Emulator can be found at http://developer.android.com/tools/devices/emulator.html

 

I suggest that you login as the devel user or a user with that group access to continue (Represented as $ in steps below).

 

Start Eclipse with

$ /opt/adt-bundle-linux-x86_64/eclipse/eclipse

 

Starting with the emulator

1. Listing the available emulators

$ cd /opt/android/adt-bundle-linux-x86_64/sdk/tools

$ ./android list targets

 

Available Android targets:

----------

id: 1 or "android-18"

     Name: Android 4.3

     Type: Platform

     API level: 18

     Revision: 1

     Skins: WSVGA, WVGA800 (default), WVGA854, WQVGA432, WQVGA400, WXGA800, QVGA, WXGA720, HVGA, WXGA800-7in

     ABIs : armeabi-v7a

 

2. Creating an instance of the emulator

Here it is called practiceandroid4.3 with the target id 1 (as above). Items in RED are optional. For further details see http://developer.android.com/tools/devices/managing-avds-cmdline.html

$ android create avd -n practiceandroid4.3 -t 1 --skin WVGA800

$ emulator -avd practiceandroid4.3

 

 

APK can be installed into the Android emulator

$ adb install bin/MyFirstApp-debug.apk

 

 

Trouble shooting:

 

    If there is a problem running Eclipse or the Emulator, try the Step 2a above.

    For error "./emulator: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory", ensure the step 2a is done.

    When upgrade Centos 6.3 to Centos 6.4 on Virtualbox, it hangs at the boot progress bar. Fix is at http://bugs.centos.org/view.php?id=6306

Wednesday, January 8, 2014

How to Delete all files in directory except the ones that start with the letter ?

Delete all files in directory except the ones that start with the letter

In Unix, to delete all the files in a directory except the ones that start with the letter "a", do the following:

rm [!a]*

But let's say there are many files, and you want to delete everything except a file called "my_file". Use grep's inverse matching capability here:

rm $(ls * | grep -v my_file)

Of course if there are other files with "my_file" as part of their filename, then those won't be deleted either. The following will ensure that this doesn't happen:

rm $(ls * | grep -v '^my_file$')

How to Change MAC address in Linux Ubuntu Redhat Fedora ?

How to Change MAC address in Linux Ubuntu Redhat Fedora

If you wish to change your MAC address in Linux, all you have to do is bring the interface down then use the hw ether switch:

ifconfig eth0 down
ifconfig eth0 hw ether 02:01:02:03:04:08
ifconfig eth0 up
if you want your pc to change its MAC address on boot add that to a script in /etc/init.d/ folder, and also add symbolic link(ln) to /etc/rc2.d, /etc/rc3.d, /etc/rc4.d, /etc/rc5.d which refers to the script in /init.d/

---------------------------

#!/bin/bash

ifconfig eth0 down
ifconfig eth0 hw ether 02:01:02:03:04:08
ifconfig eth0 up
/etc/init.d/networking restart

How to find ram processor type linux ?

How to find ram processor type linux
How to find ram processor bios cache connector slot system board type linux

     # man dmidecode
     # dmidecode -t memory
     # dmidecode -t processor
     # dmidecode -t bios
     # dmidecode -t cache
     # dmidecode -t system
     # dmidecode -t connector <---------
     # dmidecode -t slot <---------
     # dmidecode -t baseboard
     # dmidecode -s processor-version

How To Protect Linux files accidental deletion ?

Protect Linux files accidental deletion

You can protect your most important files from accidental deletion by giving them a “sticky bit” attribute:

#chmod +t filename

#chattr +i filename

How to locate command across external devices in Linux ?

How to locate command across external devices in Linux


By default, updatedb indexes only your root partition when run. To be able to extend locate’s reach and get updatedb to index external devices such as USB harddisks and flash drives, edit the /etc/updatedb.conf file. Modify the following line:

PRUNEPATHS=”/tmp /var/spool /media”

so that it reads

PRUNEPATHS=”/tmp /var/spool”
This adds the devices mounted in the /media directory to the search path

How to Find active IPs Linux LAN ?

HOWTO Find active IPs Linux LAN

#for ip in $(seq 1 254); do
ping -c1 -w1 192.168.1.$ip>/dev/null && echo “192.168.1.$ip is UP”
done

This will ping each computer on the 192.168.1.x subnet one time, with a one second interval between pings. The output should be something like
192.168.1.1 UP
192.168.1.17 UP
192.168.1.24 UP

------------------ OR

      # netdiscover -r 192.168.0.0/24
      # fping -g 192.168.1.0/24
      # nmap -sP -n $ip
           (replace eth0 with your NIC):
     # sudo arp-scan -I eth0 -l

Thursday, January 2, 2014

Vodafone Blackberry settings

Whenever you activate Vodafone blackberry internet plan on BB device then please do not forget to change your access point name to 'www.blackberry.net' to ensure your Blackberry service free usage.

 

You can do so by following steps.

 

Go to Options -> Advance Options -> TCP/IP -> Enable APN setting option & put APN name as www.blackberry.net

 

Then press Back button & save the settings.