Add local Node JS module to CLI path

To run a local Node module as if it was installed globally, add this to your login profile (or set up a script to run/reset as needed):

export PATH=$PATH:./node_modules/.bin

Linux memory usage command

cat /proc/meminfo

particularly useful in cases where you can’t use top.

more see: cyberciti.biz/faq/ram-size-linux/

Docker: fix for “Cannot connect to the Docker daemon”

Mac OS X (or similar VM’d docker environment) if your docker command stops working, check that it indeed works inside boot2docker, and if so, then run:

sudo route -nv add -net 192.168.59 -interface vboxnet1

Docker search retrieve tag info

Docker CLI doesn’t show all tags for images, you can use the Docker API to search and retrieve tag names, then use that tag to pull the specific image.

curl https://registry.hub.docker.com//v1/repositories/centos/tags | python -mjson.tool

CentOS 7 / RHEL firewalld settings

CentOS 7 has adopted firelwalld by default over the previous iptables, which will require some new steps to configure your firewall:

# new CentOS/RHEL 7 Firewall: 
	(see https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Security_Guide/sec-Using_Firewalls.html )
 
# create a new service e.g. for webmin:
 
$ cat /etc/firewalld/services/webmin.xml 
<?xml version="1.0" encoding="utf-8"?>
<service>
  <short>Webmin</short>
  <description>Server admin service. Do not leave running.</description>
  <port protocol="tcp" port="10000"/>
</service>
 
# add service to zone:
 
nano /etc/firewalld/zones/public.xml 
# OR
$ firewall-cmd --permanent --zone=public --add-service=webmin
 
# reload to add:
 
$ firewall-cmd --reload
 
# check:
$ firewall-cmd --zone=public --list-all
 
 
## apache / httpd:
$ firewall-cmd --permanent --add-service=http
$ firewall-cmd --permanent --add-service=https
$ systemctl restart firewalld

## more info: see:

http://linuxmanpages.net/manpages/fedora20/man5/firewalld.zone.5.html

http://searchdatacenter.techtarget.com/tip/A-few-ways-to-configure-Linux-firewalld?abRg=f

Show Apache / httpd memory usage and process size

ps -ylC httpd | awk '{x += $8;y += 1} END {print "Apache Memory Usage (MB): "x/1024; print "Average Proccess Size (MB): "x/((y-1)*1024)}'

thanks S.G. Vulcan

« Previous Entries