Tuesday, April 8, 2014

How to determine mysql table storage engine

So you're trying to find out which storage engine is being used by tables in your mysql database? Thank to Ronald Bradford's blog entry, the best answer I found is this:
mysql> use database_name;
mysql> SELECT table_name,engine FROM INFORMATION_SCHEMA.TABLES WHERE table_schema=DATABASE();

Monday, February 24, 2014

Switching keyboard layout on Ubuntu 13.10

Found this after digging around in AskUbuntu:
It's still possible to make the change from the command line using dpkg. Credit goes to this site: http://www.humans-enabled.com/2013/10/ubuntu-1310-enable-controlaltbackspace.html. To sum up what's written there, you can open a terminal and enter

$ sudo dpkg-reconfigure keyboard-configuration

This will take you through a series of options for the keyboard; for the first 4 or 5 just hit enter to keep things as is, and you'll end up with the option to enable Ctrl-Alt-Backspace.

Sunday, November 24, 2013

Quick ping-scanning a network using bash

So you want to know who answers to pings in said network or IP range?
Certainly not the best way to map a network, but it's useful enough to find a forgotten IP number without having to check with your DHCP:

$ for ip in 10.0.0.{000..255};do ping -c1 -t1 $ip > /dev/null 2>&1 && echo "${ip} is up" & done|grep up|sort

This method can also be used to run multiple commands in multiple terminal windows by using gnome-terminal -e "your command here".

Tuesday, October 8, 2013

Non interactive ftp for Linux users

FTP. Yes, people are still using it.

  1.  non interactive ftp login:
    $ ~/.netrc
    machine server_name/ip
    login username
    password password


    $ chmod 600 ~/.netrc
    Now you can simply ftp to said machine and it will auto-login.

  2.  Copying a file to the ftp server:
    • echo put FILE.ext | ftp server_name
      or
    •  curl -T FILE.ext ftp://server_name --user username:password

Wednesday, October 2, 2013

Checking your NIC is connected using bash

A simple yet effective way to test your network adapters connection status using  command line.

Requires: ethtool


# ifconfig -a|grep eth|while read line;do echo ${line%% *} && ethtool ${line%% *}|grep Link;done

Thursday, July 18, 2013

Slow ssh in RHEL/CentOS

It's everywhere and so it's also here, if ssh to Red Hat or CentOS takes forever, here's a quick fix:
# sed -i 's/^#UseDNS yes/UseDNS no/g' /etc/ssh/sshd_config
# sed -i 's/^#GSSAPIAuthentication no/GSSAPIAuthentication no/g' /etc/ssh/sshd_config
# sed -i 's/^GSSAPIAuthentication yes/#GSSAPIAuthentication yes/g' /etc/ssh/sshd_config
# service sshd restart

Monday, May 6, 2013

BASH CLI turn monitor off / blank screen

So you want to get your screen blank or get your monitor into standby mode from the CLI?
Add the following to your .bashrc:


alias blank='sleep 1 && xset dpms force standby'

From there on, just use the command blank from your terminal.