Linux

Port forwarding using netcat.

This example shows how to create a custom xinetd service, in this case to forward radmin (port 4899) to another server using netcat. Create a file in /etc/sysconfig/xinetd.d/ (call it what you want – but for this example radmin would be a good choice) Create a definition in your /etc/services file contains a mapping for […]

Linux

How do I turn on IP forwarding on Linux?

Turn on IP forwarding in Linux IP. To turn forwarding on temporarily, use the following command as root: (this will be disabled after a reboot) echo “1” > /proc/sys/net/ipv4/ip_forward Or to make it permanent add the following to /etc/sysctl.conf net.ipv4.ip_forward = 1 In older versions of Redhat / CentOS you can edit /etc/sysconfig/network and enable […]

Linux

How to fix weird fonts when using Midnight Commander & PuTTY?

Some distributions of Linux use a different default screen font, resulting in strange fonts when using MC in PuTTY. The following fixes this problem. Backup /etc/sysconfig/i18n – then clear the contents of the existing file and add the following lines: LANG=”en_GB.iso885915″ SUPPORTED=”en_GB.iso885915:en_GB:en:en_US.iso885915:en_US:en” SYSFONT=”lat0-sun16″ SYSFONTACM=”iso15″ Log out and back in again, and MC will now display […]

Linux

Search and replace in vi / vim

vi search and replace: (in command mode) The following strings illustrate how to perform a search and replace in the Unix vi editor. :g/old_text/s//new_text/g Replace EOL (end of line) :g/$/s//new_string/g where $ is EOL and \t = a tab The start of line can be equally easily searched and replaced – using the carat ^ […]