Server Load

Here are some useful commands to check server load. iostat shows disk IO usage. %iowait shows how much time process wait for disk operation. This should be 0. If you are on VPS, check for %steal to see if host server is overloaded.

Checks for processes in ā€˜Dā€™ state

Top processes using CPU […]

Read More…

Show git branch in terminal

show git branch in terminal

When working with git, to avoid accidental commit to wrong branch, it will be better if terminal show the branch name you are currently in. To display “git branch” in terminal, edit .bashrc

Add following code to end of the file.

You will need to restart terminal after making changes to ~/.bashrc file […]

Read More…

Find Reverse-DNS/PTR using dig, nslookup, host

Reverse-DNS/PTR is used by mail servers. It is used to map an IP address to FQDN or hostname. To find Reverse DNS record for an IP address, run

In this example IP 51.38.246.115 have a Reverse DNS record ok.serverok.in Using dig You can also use dig command to find PTR record for an IP […]

Read More…

Disable SELinux on CentOS/RHEL

To disable SELinux Method 1

Method 2 edit file

Find

Replace with

Reboot the server with

You can disable selinux for current session by running command

See SELinux […]

Read More…

Show Hidden Files

For linux to show hidden files when you type ls command Edit ~/.bashrc

Add line

Save and exit. Now you need to re login to SSH to see the hidden files when you type “ls” After editing the file will look like

[…]

Read More…

curl using cookie

Here is some example of using curl to login to site, use cookie to do further requests.

See curl […]

Read More…