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

    Get Ze Fuser!

    A quick and easy way to figure out what process ID and user has a file open is to use fuser. While fuser sounds like maybe some rad command that could emit lasers out of your laptop and fuse together your frenemies, it’s not. It also can’t put that bowl you just dropped off the table that you made when you were 6 and your mother still gushes over. I told you not to use it as an ash try she’ll say. Also, I don’t use it often as lsof can do such things as well. But sometimes you don’t wanna’ wait that long. So let’s look at using fuser.…

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

    Clear Squid Proxy Caches

    Every now and then you run into a problem with a caching server that causes you to need to clear out the cache. If running Squid, you can look in the /etc/squid/squid.conf configuration file and find a setting in that file called the cache_dir, which is a path. For example, we’ll use /var/squid/cache in this article. You can clear the cache of a Squid proxy then, by deleting that directory: rm -Rf /var/squid/cache Then recreate the cache directory: mkdir /var/squid/cache Then run squid with a -z option: squid -z Then fire up squid again: squid

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

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