Configure domain name in CentOS

Four things to do: Add the hostname entry to /etc/hosts. Use the format detailed here. If your hostname is “your_hostname”, type hostname your_hostname at a command prompt to make the change effective. Define the hostname in /etc/sysconfig/network to make this setting persist across reboots. Reboot the system or restart services that depend on hostname (cups, … Read more

Cent OS: How do I turn off or reduce memory overcommitment, and is it safe to do it?

Memory overcommit can be disabled by vm.overcommit_memory=2 0 is the default mode, where kernel heuristically determines the allocation by calculating the free memory compared to the allocation request being made. And setting it to 1 enables the wizardry mode, where kernel always advertises that it has enough free memory for any allocation. Setting to 2, … Read more

How can I configure netcat (or some other stock linux utility) to listen on a specific port on a secondary IP address?

The syntax depends on the netcat package. netcat-openbsd nc -l 192.168.2.1 3000 netcat-traditional nc -l -p 3000 -s 192.168.2.1 A simple way (at least in bash) for telling them apart in scripts is: if ldd $(type -P nc) | grep -q libbsd; then nc -l 192.168.2.1 3000 else nc -l -p 3000 -s 192.168.2.1 fi

Tcpdump on multiple interfaces

According to the tcpdump man page: On Linux systems with 2.2 or later kernels, an interface argument of ‘‘any’’ can be used to capture packets from all interfaces. Note that captures on the ‘‘any’’ device will not be done in promiscuous mode. So you should be able to run: tcpdump -i any in order to … Read more

How to save and exit crontab -e?

As others have pointed out, the first thing is to make sure you’re using an editor you like. We’re all admins here, so we all like vi (ducks, runs). export VISUAL=vi crontab -e (do some edits, finishing with ESCAPE) :wq And crontab -l should now show you your new crontab. If you prefer some other … Read more