rubysecurity.org

Cloud Architect / DevOps Engineer / SRE / Developer | /root

Home About Books Blog Portfolio Archive

Tag Cloud


Currently Reading

Certified Kubernetes Administrator (CKA) Study Guide
Certified Kubernetes Administrator (CKA) Study Guide
38 / 155 Pages


Latest Book Reviews

Latest Posts


March 28, 2015

PF syntax check

by Alpha01

[root@freebsd10 /etc]# pfctl -nf /etc/pf.conf 
/etc/pf.conf:4: syntax error
Tags: [ freebsd pf networking ]
February 13, 2015

Restarting single network interface in FreeBSD

by Alpha01

service netif restart em0
Tags: [ freebsd networking ]
February 5, 2015

Logging your terminal output using script

by Alpha01

I remember when I first discovered the tab key autocomplete in Bash and being absolutely jollied because of it. Having just found the existence of the script utility, it feels almost identical.

script gives you the capability of logging every thing within your current shell session. In the past, I would always resort to manually copying the text output of my terminal window to a file. In some cases, I would have a really long command line session that I wanted its output saved, which resulted in the entire terminal window crashing when being manually copied due to the extremely large output buffer! Thankfully with script those problems are a thing of the past.

Example

Its usage is dead simple:

tony@alpha05:~$ script logmyshit.log
Script started, file is logmyshit.log
tony@alpha05:~$ echo "script is fucking awesome!"
script is fucking awesome!
tony@alpha05:~$ exit

Contents of logmyshit.log:

Script started on Wed 04 Feb 2015 10:15:32 PM PST
tony@alpha05:~$ echo "script is fucking awesome!"
script is fucking awesome!
tony@alpha05:~$ exit

Script done on Wed 04 Feb 2015 10:16:00 PM PST

Tags: [ bash ]
October 5, 2014

System Update using Ansible

by Alpha01

CentOS

ansible centosbox -m yum -a 'name=* state=latest'

Ubuntu

ansible debianbox -m apt -a 'update_cache=yes name=* state=latest'
Tags: [ ansible centos ubuntu ]
October 4, 2014

Perl - Remove all blank lines from a file

by Alpha01

Remove all blank lines from a file using Perl:

perl -ne 'print unless /^\s+$/ ' test.txt 
Tags: [ perl ]