Linuxtipstricks – Just another /linux/blog

June 6, 2009

How to find my pc IP address – aka – what is my IP?

Filed under: user tipstricks — Antonio Portuesi @ 7:27 pm
Tags: , , , , , , , , , , , , , ,

Your computer (PC, MAC, handeld and so on…equipped with Windows, Linux, MacOS, every distro/release OS) has an Internal IP address and an External IP address.
It may have been set manually or it may have been set automatically. That doesn’t matter.
Regardless of how it was set there are times when you need to know what that IP address is.
In other words you ask to yourself: How can I find my pc IP?
The easiest way is to go to www.mypcip.net and check out the result in the top of page.
There you can also find some useful information about IT (IP, DNS, WHOIS, MAC, IPv4/6 and counting)

The easier, the better!

Advertisements

November 29, 2008

How to open files with gedit using the right click menu in Ubuntu

Filed under: user tipstricks — Antonio Portuesi @ 3:55 pm
Tags: , , , , , , , ,

Many times it could be useful to open and edit a file in a straightforward way with a mouse click without any further action.

Let’s open a terminal window and type in the following command, which will create a new script file in our nautilus scripts directory

user@pc:~$ gedit ~/.gnome2/nautilus-scripts/Open\ file\ with\ gedit

Write the following script lines:

filesall=””
while [ $# -gt 0 ]
do
files=`echo “$1″ | sed ‘s/ /\?/g’`
filesall=”$files $filesall”
shift
done
gedit $filesall&

Save the script and close gedit, then execute the already known command to make the script executable:

chmod u+x ~/.gnome2/nautilus-scripts/Open\ file\ with\ gedit

Now when you right click a file in gnome environment, you should see the related context menu item “Open file with gedit”

November 15, 2008

How to handle e2dk links with Firefox easily

Filed under: user tipstricks — Antonio Portuesi @ 5:29 pm
Tags: , , , , , ,

In most Linux systems, self-compiled aMule will install the ed2k utility in /usr/local/bin/ed2k, while package-installed aMule version will install it in /usr/bin/ed2k. SuSE packages put it in /usr/local/bin/ed2k.

Even if you installed Debian or Ubuntu distros you have to get “amule-utils” package to allow everything working properly.

Handling ED2k links in Firefox can be configured in two different ways: for an individual user or for all computer users as well.

Configuration for Firefox 2

  1. Open up your browser
  2. Write about:config in the address bar
  3. Right click on the list, select New, then Boolean
  4. Insert network.protocol-handler.external.ed2k as Preference Name and set Value to true
  5. Right click again, select New and String
  6. Insert network.protocol-handler.app.ed2k as Preference Name and set Value as /path/to/ed2k (path to where the file is installed on your linux box)

Configuration for Firefox 3

Follow the above todo list and:

7.  Right click on the list, select New, then Boolean, insert network.protocol-handler.expose.ed2k as Preference Name and set Value to false

After those steps, click an ed2k link, and Firefox should ask which application you want to use to open the same link. Choose /usr/local/bin/ed2k and it should work fine.

November 1, 2008

How to check if Linux kernel supports IPv6

Filed under: user tipstricks — Antonio Portuesi @ 3:35 pm
Tags: , , , , , , , , , ,

As we know, IPv6 addresses are classified into three types:

  1. Unicast addresses: A unicast address identifies a single network interface. The protocol delivers packets sent to a unicast address to that specific interface. Unicast IPv6 addresses can have a scope which is reflected in more specific address names: global unicast address, link-local address, and unique local unicast address.
  2. Anycast addresses: An anycast address is assigned to a group of interfaces, usually belonging to different nodes. A packet sent to an anycast address is delivered to just one of the member interfaces, typically the “nearest” according to the routing protocol’s choice of distance. Anycast addresses cannot be identified easily: they have the structure of normal unicast addresses, and differ only by being injected into the routing protocol at multiple points in the network.
  3. Multicast addresses: A multicast address is also assigned to a set of interfaces that typically belong to different nodes. A packet that is sent to a multicast address is delivered to all interfaces identified by that address. Multicast addresses begin with the first octet being one (1) bits, i.e., they have prefix FF00::/8. The four least-significant bits of the second address octet identify the address scope, i.e. the span over which the multicast address is propagated.

What if I would like to start using IPv6 on a Linux system? How could I test, whether my Linux server system is IPv6 ready or not? If not, how could I enable IPv6 support under Ubuntu, OpenSuSE, Mandriva, Gentoo, Fedora and so on?

Many people know that Linux kernel has IPv6 support since 1996 release. All you need to do is compile kernel with IPv6 networking support. However, there is a so easy way to find out if Linux kernel is already compiled with IPv6 settings.

Check if the current running kernel supports IPv6 taking a look at your /proc-file-system:

user@pc:~$ cat /proc/net/if_inet6

Following lines should be shown:

user@pc:~$ 00000000000000000000000000000001 01 80 10 80 lo
user@pc:~$ fe800000000000000219d1fffe2abaa8 02 40 20 80 ath0

ipv6 module has IPv6 protocol stack for Linux. If above cat command fails the IPv6 module is not loaded.

Just type the following command:

user@pc:~$ sudo modprobe ipv6

Now to test again if all is ok write on your console:

user@pc:~$ lsmod | grep ipv6

that generates an output like that:

user@pc:~$ ipv6 411425 18

Now your system is ready for IPv6 jobs.

October 5, 2008

How to create a separate home partition in Linux (Ubuntu, OpenSuSE, Mandriva, Gentoo, Fedora and so on)

Filed under: user tipstricks — Antonio Portuesi @ 4:26 pm
Tags: , , , , , , , , , , , ,

This simple guide is just another way to make a separate /home partition if you already installed Linux with a embedded /home partition (aka /home folder inside your / partition).

Getting a separate /home partition allows you to reinstall your Linux distro (Ubuntu, OpenSuSE, Mandriva, Gentoo, Fedora and so on) and retain all your personal files and settings. This is for your convenience and you should seriously think on it as soon as possible if time really matters to you. Do not forget to run a complete back up of your data before go trough.

You are strongly encouraged to use a self booting live CD for this process, for those reasons:

a) In order to resize your existing root partition, it needs to be unmounted. The only way to unmount it is for it not to be in use, which means you cannot boot to your regular linux environment while resizing it so you need a external and autonomous system as a live CD or a bootable USB device.
b) If you damage your linux system by accident, you can use for sure the live CD to restore your old settings and, in a very bad situation, at least recover your important data.

Before you start please note that if you are not confident in what you are doing or in repairing or recovering from the above listed process, then do not step to the outlined instructions. Creating a separate /home partition involves resizing at least one existing partition. In almost all situations, the resizing process of partitions does not carry out data loss, but there still exists a (however minimal) risk of data loss, so you should back up your data before attempting to modify your hard disk partitions.

I cannot help you troubleshoot problems you could have following this tutorial.

Now, after you made the new target partition will host your /home open a the terminal, I’m going to mount /dev/sda1 and /dev/sda2 by pasting in these commands (please remember to change the partition device names to the ones appropriate for your setup)

sudo mkdir /first
sudo mkdir /second
sudo mount -t ext3 /dev/sda1 /first
sudo mount -t ext3 /dev/sda2 /second

Now we are going to copy all the content from the original /home to the new target partition…

cd /first/home
find . -depth -print0 | cpio --null --sparse -pvd /second/

…and to get a backup copy of /home too, useful in a troubleshoot process:

sudo mv /first/home /first/home_backup
sudo mkdir /first/home

Right now, after you made a backup copy of fstab, we will specify how the system should use the brand new partition as /home:

sudo cp /first/etc/fstab /first/etc/fstab_backup

sudo gedit /first/etc/fstab (if you are a Gnome lover) or

sudo kedit /first/etc/fstab (if you are a KDE lover).

The /etc/fstab should be shown in the text editor.

Add the next line at the end of the file and remember to double check the right name of your partition before save the file and close the editor:

/dev/sda2 /home ext3 nodev,nosuid 0 2

In order to avoid error messages after reboot with the new /home partition you should set the proper ownership typing:

sudo chown user_managed:user_managed /home/user_managed -R

If everything is ok and you are running a system without problems you could delete the old /home directory and get some free space on your disk:

sudo rm -rf /home_backup

If you incur some issue you can restore the old /home by changing back the fstab removing the line you added before as described above.

Blog at WordPress.com.