How To Add Cron or Cron-like Jobs To Mac (With MAMP or Otherwise)

The Mac runs on Unix, which makes it incredibly powerful. You might be running MAMP or a stand-alone version of Apache, and one of the things that you might want to run is cron, which is a scheduling tool. Instead of cron though, you could actually have your Mac just run a launch daemon. Just go to terminal, and type: cd /Library/LaunchDaemons/ Now type: sudo vim yourfile.cron.plist You’ll be asked for your administrator password, and after entering it, you’ll be

Continue Reading

How To Find The Location Of An Executable Program In The Mac Terminal

The Mac platform is amazing, and what makes it even more powerful is that it’s running on Unix, so you have the incredible power of bash and the shell terminal at your disposal. For instance, what takes 5 clicks and 30 minutes of your time might just be solved by running one command in Terminal – and that’s underestimating it. Take for instance, this scenario: Sometimes you’ll need to find out the path of something in Terminal when you’re using

Continue Reading

How To Make and Run Batch Files In Terminal In Mac OSX

I use batch files sometimes when I was using Windows because it saves a lot of time when you need to run a batch of commands frequently. With a batch file, you save all the commands into one file, and just run the batch file, instead of your gazillion commands individually. I was facing the same situation in Mac OSX when I realised that I didn’t know how to create a batch file in Mac OSX. Turns out it’s pretty

Continue Reading

Recursively Delete Selected Files or Folders In Windows

I was looking around for a way to recursively delete files and folders of a specific name in Windows. For example, imagine having “/folderA/folderB/file1.doc” and “/folderA/folderC/file1.doc”, and I wanted to remove all instances of file1.doc. Now imagine this file1.doc being presented in hundreds of folders. Deleting each file manually would drive anyone crazy. I know Unix has a more powerful commandline interface, so operations like this should be a snap, but I was certain Windows had a similar functionality too.

Continue Reading

How do I create and remove a symbolic link?

I was fiddling around with symbolic links in my unix box and realised how cool they were. Basically symbolic links (or symlinks) create a virtual copy of the master file. This virtual copy has almost 100% of the master’s functionalities and characteristics (you’ll need to play around with the owner and file permissions sometimes though), and the really good thing about symlinks is that if you update the master files, your symlinks automatically get updated too! Here’s the Code for

Continue Reading

Recursively Download Folders using FTP with wget in UNIX (even SSH)

Okay, so you don’t have SSH access to your server, but you do have FTP access to it, and you need *all* the files in a folder. Worse, your directory structure is many levels deep, and extremely messy. Normal FTP won’t cut it, because command-line FTP doesn’t do recursive downloading of folders. Turning off interactive mode and using mget doesn’t work too. The easiest solution? Use wget to recursively download folders using FTP. Here’s the wget command: wget -r ftp://username:password@yourftphostname.com/directory1/directory2/

Continue Reading

Running UNIX commands in your Java application

I was looking around for a method to run commands from the prompt automatically from within my Java application, and then I found it. Here’s the solution – and it works like a charm! static void doExec1() throws IOException { // use pipes and I/O redirection // but without using a shell Runtime runtime = Runtime.getRuntime(); runtime.exec(“ls | wc >out1”); }

Site Footer

Sliding Sidebar

Disclaimer

The contents on this blog are not intended as professional advice. The author disclaims any liability, loss, or risk taken by individuals who directly or indirectly act on the information contained on this blog.