Archive for April, 2008

removing ^M from the end of every line

Ever had someone send a file to you in *nix and you see a ^M at the end of every line? In the Windows world, the end of line is marked by a Carriage Return (^M) and a Line Feed. *nix treats the end of line differently – it does not use the ^M. This typically happens when someone transfer a text file from Windows to *nix using binary transfer in ftp as opposed to ascii.

To remove the ^M characters at the end of all lines in vi, do this :


Note that the ^v is a CONTROL-V character and ^M is a CONTROL-Shift-M. When you type this, it will look like this:


In *nix, you can escape a control character by preceeding it with a CONTROL-V, so here we are telling vi to globally replace the ^M character with nothing.


Leave a Comment

changing hostnames in Solaris and Linux

For Linux:
run hostname command or edit /etc/hosts file.

For Solaris 8, the following files have to be edited :
/etc/hostname.<interface name>

where <interface name> is the driver name followed by the instance number of the interface, i.e. ce0, bge0, hme0, qfe0, etc.. You can find all of your network interfaces by drivername and instance# by running the following command:

prtconf -D | grep network

or just go into /etc and do : ls hostname*

For Solaris 10, the following files have to be edited :
/etc/hostname.<interface name>

edit /etc/dumpadm.conf, and create the directory where it puts the dumps.

rename /var/crash/<oldhostname> to /var/crash/<newhostname>, then run hostname <newhostname>

A reboot is also recommended to make sure all settings were picked up.

Leave a Comment