• 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,  Ubuntu,  Unix,  VMware

    Sort ls Entries By Modification Times

    I find that when I’m trying to quickly sort directory listings in a terminal screen, the last thing I want is to have to open . to get a Finder screen and then sort that way. Luckily, I’m not the only one who needs to sort data by time stamp from time to time. To do so using ls, simply use the -alt options: ls -alt ~/Desktop Or to see the information in reverse: ls -altr ~/Desktop

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

    5 Ways To Manage Background Jobs In A Shell Environment

    When running commands that are going to take awhile, I frequently start them with the nohup command, disown the command from the current session or queue them for later execution. The reason is that if I’m running them from a Terminal or SSH session and the session is broken I want to make sure they complete. To schedule a job for later execution, use at. For example, if I want to perform a simple command, I can schedule it in a minute by running it as an echo piped to at: echo "goldengirlsfix.sh" | at now + 2 minutes Note, if using 1 minute, you’ll need that to be singular.…

  • cloud,  Network Infrastructure,  SQL,  Ubuntu,  Unix,  VMware,  Windows Server

    Scripting Azure On A Mac

    Microsoft Azure is Microsoft’s cloud services. Azure can host virtual machines and act as a location to store files. However, Azure can do much more as well, providing an Active Directory instance, provide SQL database access, work with hosted Visual Studio, host web sites or provide BizTalk services. All of these can be managed at https://manage.windowsazure.com. You can also manage Windows Azure from the command line on Linux, Windows or Mac. To download command line tools, visit http://www.windowsazure.com/en-us/downloads/#cmd-line-tools. Once downloaded, run the package installer. When the package is finished installing, visit /usr/local/bin where you’ll find the azure binary. Once installed, you’ll need to configure your account from the windowsazure.com site to…

  • Ubuntu,  Unix,  VMware

    Correcting SR_BACKEND_FAILURE_46 Error in XenSource

    If you try to start a VM in XenSource and you see an error that SR_BACKEND_FAILURE_46 then one way to resolve is to detach the storage and reattach while forgetting and resetting the VM’s uuid. To do so, first locate the VM in question and go to the Storage tab to find the SR. Click Properties and add _temp to the end of the name so that you can easily find it to reattach. Then click on the Detach button for the storage. From the Console for the host, run the following (assuming the VM is called JACKED): xe vdi-list name-label= “JACKED_temp” Note the VDI UUID and SR UUID, which…

  • VMware,  Windows Server

    ESX: Configure Virtual Machine's To Startup Automatically

    You shouldn’t have to reboot your ESX servers very often. But when you do, you might want the virtual machines to start up automatically. To configure a virtual machine to start up (or shut down) automatically select the host and click on the Configuration tab. Then click on virtual machine Startup/Shutdown and click on Properties, selecting “Allow virtual machines to start and stop automatically with the system”. As I mentioned in a previous article, you can also configure the operating system to start after a brief delay by providing a Default Startup Delay time, allowing time for booting systems to run scripts or to throw them into Safe Mode. You…

  • Active Directory,  Mac OS X,  Mac OS X Server,  Mac Security,  Network Infrastructure,  Ubuntu,  Unix,  VMware,  Windows Server,  Windows XP,  Xsan

    List All DNS Records For A Domain

    Sometimes you want to move a domain but you don’t have a copy of the zone file in order to recreate records. The easy way to do this is to grab a zone transfer. To do so, dig is your friend: dig -tAXFR mycompany.com Sometimes though (and actually more often than not) a zone transfer is disabled. In that case you’ll need to dig the domain a bit differently. I like to use +nocmd, query for any and list the results (+answer): dig +nocmd https://krypted.com/ any +answer Which results in the following: ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 39183 ;; flags: qr rd ra; QUERY: 1,…

  • Network Infrastructure,  Ubuntu,  Unix,  VMware

    Using the XenSource Command Line Interface

    XenSource has some pretty good GUI tools. There’s XenCenter and the xsconsole, both of which are pretty adequate in a free sense and get pretty darn interesting when you actually pay Citrix. But today I want to take a little look under the hood of XenSource. I had previously written about Xen. But note that this is a different beast. Before I get started talking about how to do some tasks in XenSource, I first want to throw out there a few terms. The first, is virtual machine. This is exactly what it sounds like, an operating system that runs on a virtual host rather than a physical hosts. So…

  • Ubuntu,  Unix,  VMware

    Some Basic Xen Commands

    The most important command for managing pretty much anything in Linux is vi. So if you only learn one command, learn that one. But if you want to learn another, the second most important command for managing Xen is then xm (well, once you’ve apt-gotten or yummied up the installation that is). The xm command has a number of easy verbs, each used for managing the Xen environment. xm info – Shows information about the Xen host xm list – Shows information about doms (states include r for running, b for blocked, c for crashed, p for paused and the worse, d for dying). xm network-list – Shows virtual interfaces…