Change HostName From Command Line Linux

To change the  hostname, follow the steps shown below. 1. Use hostname command to Change Hostname In this example, we’ll change the hostname from dev-server to prod-server. hostname command by default will display the current hostname as shown below: # hostname dev-server The following will change the hostname to prod-server. # hostname prod-server Once the … Read more

TOP command in Linux

Top-Command

top provides an ongoing look at processor activity in real time. It displays a listing of the most CPU-intensive tasks on the system, and can provide an interactive interface for manipulating processes. It can sort the tasks by CPU usage, memory usage and runtime. can be better configured than the standard top from the procps suite. … Read more

find the number of CPU cores on Linux

Multi-core CPU processors are common nowadays, including dual-core processors (e.g., Intel Core Duo), quad-core processors (e.g., Intel Core i5), and hexa-core processors (e.g., AMD Phenom II X6). Also, many server-grade physical machines are equipped with more than one CPU processor. To find the number of physical CPUs: $ cat /proc/cpuinfo | grep “^physical id” | … Read more

WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!

WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! Someone could be eavesdropping on you right now (man-in-the-middle attack)! It is also possible that the RSA host key has just been changed. The fingerprint for the RSA key sent … Read more

How to find/display your MAC Address: Unix/Linux

Linux As the root user (or user with appropriate permissions) Type “ifconfig -a” From the displayed information, find eth0 (this is the default first Ethernet adapter) Locate the number next to the HWaddr. This is your MAC address The MAC Address will be displayed in the form of 00:08:C7:1B:8C:02. Example “ifconfig -a” output: eth0 Link … Read more

Execute root commands via PHP

I have a CentOS 5.7 linux server and use php5.3.x. On a pfSense system, you can restart services-that required root permissions using a php web page. I’m trying to do something similar, I have written some php code to execute shell commands. For example, to restart the sshd service: <?php exec(‘/sbin/service sshd restart’); ?> and … Read more