• Mac OS X,  Ubuntu,  Unix

    cd To The Previous Directory

    The cd command has lots of fun little shortcuts. One I use frequently is the -. The ~ always takes you to your home directory, but using cd – will take you to the last directory you were in. For example, if you do the following on a Mac: cd ~ Then you do .. (which is a shortcut for the directory above the one you’re in): cd .. Then pwd will show that you’re in /Users. But, if you cd to – again: cd - Now you’re back in your home folder. The – expands to OLDPWD. Quick tip. Nothing more to see here.

  • Mac OS X,  Ubuntu,  Unix

    Bash: A Silly wc Example

    The wc command is used to count words, characters and lines. Here, we’ll run it a few different ways. -l shows the number of lines in a file. For example, in my home directory, I can use it to see how many lines are in my .gitconfig file: wc -l .gitconfig This would output something like the following: 11 .gitconfig Or count the number of characters with -c: wc -c .gitconfig Or check the number of words: wc -w .gitconfig You can also run it against multiple files. For example, here I’ll check the number of lines in both my .gitconfig file and my .gitignore_global files: wc -l .gitconfig .gitignore_global…

  • Ubuntu,  Unix

    Linux and Free Memory Space

    The free command in Linux is used to show memory utilization. When run without any options, you can see the used and available space of swap and physical memory. By default, the option is displayed in kilobytes but when run with a -b option it is shown in bytes or -m will show in megabytes or -g in gigabytes or -t in terabytes. So to see the free space in bytes run the following: free -b The -o option shows the output adjusted for the buffer. The -t option also adds a total column as well as a line for total that shows swap and physical, combined. The -s will update…

  • Mac Security,  Mass Deployment,  MobileMe,  Network Infrastructure

    Network Port Testing With Netcat

    You can do some pretty simple testing of ports and network communications using strategies I’ve outlined in the past with tcpdump, trace route, telnet, curl, stroke and of course ping. However, netcat has a few interesting things you can do with it; namely actually run a port super-quickly to test traffic between subnets, forcing scans of ipv6 traffic, debugging sockets, keeping connections alive, parodying through SOCKS 4 and 5 and just checking for daemons that are listening rather than actually sending data to them. In this first example, we’re going to just check that Apple’s web server is accessible (adding -v for verbose output): /usr/bin/nc -v www.apple.com 80 The result would be pretty verbose…

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

  • Unix

    Making the case for Solaris

    I recently read an article that Solaris is a dead OS (or will be rather shortly).  I beg to differ, proveded the hardware support is there.  Solaris can still multithread better than anyone.  Solaris’ ZFS is still the most superior file system available (although before the ReiserFS founder got put in prison for wasting his wife it looked poised for greatness) and the Sun hardware is still best of breed.  Sun as a company is also going to be building tighter integration into MySQL, which should help boost numbers.   But the pony-tail-laden chief of Sun definitely has his work cut out for him.  There are certain acquisitions that have…

  • Mass Deployment,  Unix

    LISA 2008

    No, this isn’t the new version of my wife (although there is a new version out and it’s awesome;).  Instead, LISA’08 is the 22nd year of the Large Installation System Administration conference in San Diego California.  LISA runs from November 9 to November 14th of 2008 and looks to be a conference those who do mass deployment might not want to miss.  The biggee this year is virtualization: ESX, ESX 3i, Xen, etc.  But there are alos talks on security, forensics, the Linux Kernel, Performance tools for Solaris and Linux, Perl mods, network performance tuning, wireshark, diskless Linux, SELinux, mass deployment of database servers, disk-to-disk backups for Unix, cfengine, directory…