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

    Working With Files Whose Name Starts with a “-“

    Recently I needed to create a bunch of files that had names starting with a dash. If you simply run touch followed by the filename, if the filename starts with a dash, it will throw an error that there’s an illegal option. Therefore, you must escape out the dash by passing a double dash in front of it. For example, to create a file with a dash in the name, use the following syntax: touch -- -man Likewise, to remove that file: rm -- -man You can also use the double dash when passing commands to ssh rather than have ssh interpret them as arguments, making it useful for command…

  • 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.…

  • Mac OS X,  Mac OS X Server,  Mac Security,  Unix,  Xsan

    Migrate Metadata From Xsan to StorNext

    I’ve written about moving Metadata LUNs from one LUN to another with Xsan in the past, available at https://krypted.com//unix/replacing-xsan-metadata-luns. There, we were using sndiskmove, which works when moving Metadata LUNs from Xsan to Quantum appliances as well (e.g. a 440 or 662). However, the drives that Quantum provides in these appliances are much smaller (and much faster) than those in a traditional Xsan environment. Therefore, the sndiskmove approach would fail as you’re moving from a larger to a smaller LUN. Because the amount of space that you’re using on a Metadata LUN, you should be able to gracefully move metadata to a much smaller LUN. To do so, Quantum provides…

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

    Sanity Check Your Cups

    I recently came across an issue with a corrupt cups config file. Been awhile since I saw something like that, but it turned out to be a setting that was manually configured, so no big surprise. Luckily, cups has a sanity checker built in. Let’s look at the cups config file in Mac OS X. To do so, run cupsd with the same commands you’d normally use to fire it up, but append a -t at the end (lots of daemons actually allow the use of a -t): cupsd -f -c /private/etc/cups/cupsd.conf -t The output would, if working properly provide the following: "/private/etc/cups/cups-files.conf" is OK. "/private/etc/cups/cupsd.conf" is OK. Otherwise you’d…

  • 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…

  • cloud,  Ubuntu,  Unix

    25 Helpful Chrome OS Shell (crosh) Commands

    To open Crosh: Control-Alt-T Find commands: help Find debugging commands: help_advanced To switch to a more bash-like command prompt: shell To see the version of Chrome OS running on your Chromebook: sudo /opt/google/chrome/chrome –version To show the operating system name: uname -a If the operating system is a bit old, update it using the update_engine_client command: update_engine_client -update To see the bios of your Chromebook, open up a command prompt (Control-Alt-T) and use the following command: sudo /usr/sbin/chromeos-firmwareupdate -V To record some sound from the microphone, use the sound command: sound record NUMBEROFSECONDS Look for (or grep for) BIOS version in the output. To see the Vital Product Data, or…

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

    Use awk To Display Lines That Exceed A Number of Characters

    The number of characters n a line of text can be a difficult thing to calculate in a given app. If you have data in a text file, you can use awk to view the number of characters in a given line of the file. This is very helpful, for example, if you have code that you’ve put into documentation that exceeds the character maximum and therefore wraps. When going to print, you need to split these lines up. Here, we’re going to use the awk command to review all lines that exceed 56 characters: awk 'length($0) > 56' ~/Repo/Chapter1.xml

  • Ubuntu,  Unix

    Locate All Files Installed By a Linux Package

    RPM is a package manager available for most versions of Linux. The rpm command is used to install and uninstall software from the command line. Once software is installed, you can use the -q option to query for installed packages. The -a option shows all. So to see a list of all packages installed, use both: rpm -qa When you locate the name of a package you’d like to know more about, use the -i to get more information, along with the -q to query, followed by the name of the package: rpm -qi libcap This shows a list of all the files installed as part of the package.

  • Ubuntu,  Unix,  Xsan

    Remove StorNext FX From RHEL

    When you remove a RHEL system with StorNext FX running on it from the network that has an Xsan the system won’t boot properly any longer. There are two things that need to happen in order to get around this. When done proactively the system can safely be moved. When done reactively, you’ll need to boot using the “I” key and disable all of the cvfs and fsmpm entries during the boot process. Once booted, or if being done proactively, edit fstab and then remove the cvfs files. First, we’re going to edit /etc/fstab. Simple open it in vi and then put a # in front of each line that…