• Mac OS X,  Mac OS X Server,  Mac Security,  Mass Deployment,  Network Infrastructure,  Programming,  Ubuntu,  Unix

    Opposite Day: Reversing Lines In Files

    The other day, my daughter said “it’s opposite day” when it was time to do a little homework, trying to get out of it! Which reminded me of a funny little command line tool called rev. Rev reads a file and reverses all the lines. So let’s touch a file called rev ~/Desktop/revtest and then populate it with the following lines: 123 321 123 Now run rev followed by the file name: rev ~/Desktop/revtest Now cat it: cat !$ Now rev it again: rev !$ You go go forward and back at will for fun, much more fun than homework… Enjoy!

  • Mac OS X,  Mac OS X Server,  Mac Security,  Mass Deployment,  Network Infrastructure,  sites,  Ubuntu,  Unix

    Manage Apex Domains In OS X

    OS X Server supports running a traditional bind implementation of DNS. You can define a record for most any name, including google.com, www.google.com, www.www.google.com, etc. You can use this to redirect subdomains. In this example, we’ll create an A Record to point www.google.com to 127.0.0.1 without breaking other google.com subdomains. To get started, let’s use the DNS service in the Server app to create test.www.google.com. The reason for this is that OS X will then create a zone file for www.google.com. If we created www.google.com instead, then OS X would automatically create google.com, which would break the other subdomains. To do so, open Server app and click on the DNS Service. Then…

  • Ubuntu,  Unix

    Installing the Docker for OpenStack Heat

    Docker is an engine that automates deploying applications as highly portable, self-sufficient containers, independent of hardware, language, framework, packaging system and hosting provider. Heat is the main project used when it comes to OpenStack orchestration. There is a Docker plugin for Heat. To install this plugin, you’ll need to use the stable/icehouse branch (which seems like what’s made the tool so mature rather than simply being available for Nova) to install Heat via apt-get install. Once downloaded, extract the contrib/docker folder and delete the tests directory. Then copy the contrib/docker folder to the OpenStack controller. Here we’ll put it at /usr/lib/heat directory. This results in the path of /usr/lib/heat/docker/docker. Next, install python-pip:…

  • Active Directory,  Mac OS X,  Mac OS X Server,  Microsoft Exchange Server,  Network Infrastructure,  Ubuntu,  Unix,  VMware,  Windows Server

    Stashbox: Turning a Mac Mini Into A Logstash and Kibana Server

    You have a lot of boxes. You would like to be able to parse through the logs of all those boxes at the same time, searching for a given timestamp across a set of machines for a specific string (like a filename or a port number). elasticsearch, logstash and kibana are one way to answer that kind of need. This will involve downloading three separate packages (which for this article, we’ll do in /usr/local) and creating a config file. First, install the latest Java JDK. This is available at jdk8-downloads-2133151.html. The following is going to download the latest version of logstash and untar the package into /usr/local/logstash (I like nesting…

  • iPhone,  Mac OS X,  Mac OS X Server,  Mac Security,  Mass Deployment,  Microsoft Exchange Server,  Network Infrastructure,  Ubuntu,  Unix,  VMware

    Quick nmap Hacks

    The nmap application is a pretty easy-to-use tool that can be used to port scan objects in a network environment. To obtain mmap in an easy-to-use package installer, for OS X check out the download page at http://nmap.org/download.html#macosx (use the same page to grab it for Windows or *nix as well). Once downloaded run the package/rpm/whatever. Before I scan a system, I like to pull the routing table and eth info to determine how scans are being run, which can be run by using the mmap command anong with the —iflist option: nmap —iflist Basic Scanning To then scan a computer, just use the mmap command followed by the host…

  • Mac OS X,  Mac OS X Server,  Mac Security,  Ubuntu,  Unix,  VMware

    Show Line Numbers When Viewing A File

    The nl command is used to show line numbers when viewing a file (unless you use the -b option along with an n, which seems to be one of the more pointless things to ever do at the command line, but then what do I know…). So if you’d like to see the line numbers for a file called xsbackup.sh: nl xsbackup.sh The output would look like this: 1 # 2 #!/bin/bash 3 # 4 # Script Name: Or at least, that’s how I used to do it. For decades I never noticed that cat had a -b option. So if you’d like to use cat to see line numbers…

  • Mac OS X,  Mac OS X Server,  Mac Security,  Network Infrastructure,  Network Printing,  Ubuntu,  Unix,  VMware

    Use Netstat To Locate What Process Is Using A Port

    You’re installing software on some host. The installation goes well and then you go to access the information you need or connect to the service from another host. Wait, what’s that? Port is already in use? Crap. We’ve all been there. The quick and dirty answer: netstat. Let’s say you’re trying to use port 8080: netstat -tuln | grep 8080 Let’s say the response is httpd. OK, let’s see where that’s located using whereis: whereis httpd And what kind of file is httpd: file /usr/sbin/httpd Which responds with: /usr/sbin/httpd: Mach-O 64-bit executable x86_64 I guess we knew that since it had a port open, but what type of executable is…

  • Mac OS X,  Mac OS X Server,  Mac Security,  Mass Deployment,  Ubuntu,  Unix,  Xsan

    compgen like a boss

    I’ve traditionally used the apropos command to find new commands. But you can also use the compgen command, which looks at the completion matches for given words, to find a list of commands that you can run, simply use compgen with a -c option: compgen -c You can parse information for a single command: compgen -c | grep apropos You can also use -a for aliases, -b for bash built-ins and -k for bash keys, as well as `-A function` for functions. You can then string ’em together: compgen -abckA function I won’t paste the output but I’ll let you pipe it to grep to compgen like a boss. Enjoy!