osx

Cheat Sheet: Crontab by Example

Today's article may be pretty basic for regular readers but hopefully some may find it useful. This article will cover creating a crontab entry and show some examples of common crontabs. The Cron daemon is a service that runs on all main distributions of Unix and Linux and specifically designed to execute commands at a given time. These jobs commonly refereed to as cronjobs are one of the essential tools in a Systems Administrators tool box.

Unix Shell: The Art of I/O Redirection

One of the primary tricks in my sysadmin bag-o-tricks is Input/Output Redirection; I have found that while many people use Shell I/O Redirection throughout their day not everyone fully understands why and how it works. The Input and Output In the Unix environment there is always 3 streams open stdin, stdout, & stderr; these special streams are used for interacting with the user input and program output within the Unix/Linux shell environment.

dscacheutil: Clearing DNS cache on OSX

This is something I ran into recently over the weekend. I made modifications to the DNS of a domain and I couldn't get my mac to recognize the change. The culprit was DNS caching, after flushing my DNS cache all was well. # dscacheutil -flushcache

Filename manipulation with sed, awk and cut

Working with files is one of the most common tasks for systems administrators; because of that there are numerous ways to work with files in the Linux/Unix environment. Here is 2 quick examples on how to rename files. Example: imadmac:testing madflojo$ ls -la total 32 drwxr-xr-x 6 madflojo wheel 204 Aug 4 20:11 . drwxrwxrwt 6 root wheel 204 Aug 4 20:10 .. -rw-r--r-- 1 madflojo wheel 8 Aug 4 20:11 1.

Truncating a large log file

This is actually one of my favorite questions to ask Jr. Systems Administrators. I believe the way they answer this question really helps me gauge where they are at in their Administration skills. How do you clear a large log file that an application is actively writing to? Some will answer honestly and say “by removing the file” and others will pretend like they careful of everything and say “move the file out of the way and create a new one”.

Editing big files on systems with little memory

A friend of mine had a question on how to edit a huge (like as in xbox hueg) file without using vi. He probably didn't want to use vi because when you vi a file it will load the entire file into memory. This can be very bad if your system doesn't have enough memory to accommodate the file size. So how do you edit a specific line of a file without loading it into memory?