In the terminal, it's quite simple - you can use the file command, like this:
[xperiment:~/Documents/downloads] berto% file download.php download.php: gzip compressed data, deflated, last modified: Fri Feb 23 18:17:34 2001, os: Unix
(Line break added to shorten the line width!) The file command looks at the file, and compares it to a database of types, and then gives you its best guess at the filetype.
In this real-world example, I couldn't figure out how to expand the file ... the file output lets me know I need to use gzip! For full information on file, make sure you check out the manual pages by typing man file in the terminal window.
"How do I perform Terminal commands on any items on my Mac that have spaces in their pathnames? Because Finder allows spaces in file and directory names, I'm often creating such with spaces but then if I try to cd to one in the Terminal the space kills the command. How is this done?"
There are three ways that I know of to handle this. They are:
Drag-and-drop the file or directory onto the terminal; this will preserve the spaces.
Enclose the path name in single quotes, like this:
cd '/Users/username/temp/directory with spaces'
Quote the space character with a backslash, like this:
cd /Users/username/temp/directory\ with\ spaces
Any of these will allow you to easily navigate files and directories with spaces in their names.
In the hint on fixing the security hole in SSH, one of the possible solutions was to install OpenSSH 2.3. No detail was provided on exactly how to do this, however! I had thought this link was already posted on the site somewhere, but a quick search failed to find it ... so I'm posting it now (again?).
To install OpenSSH 2.3, head on over to stepwise.com, and follow the excellent page of instructions written by Scott Anguish which will walk you through the process.
I have not built OpenSSH 2.3 on my machine, so you're on your own to see if it actually works. I'm sure it does, but I haven't tested it myself yet.
If you leave your OSX box up and running 24/7 and have been burning some midnight oil, you might have noticed some system activity in the early hours. If you look in /etc/crontab, you'll see that the root user runs some nightly, weekly and monthly security and maintenance tasks. Whenever cron produces output, it gets emailed to the job owner, so in this case root will be sent email nightly, weekly and monthly.
Unless you're in the habit of logging in as root and reading the email there it's more useful to have all of root's email redirected to your own mailbox. As with most (all?) unix systems, you can do this by creating a .forward file for the root user. Read the rest of this article if you'd like instructions on how to create this file.
I'm trying to get jed running so I have to install slang first. I finally got onto ADC and get the dev kit. The configure script dies at host type. What is host type? darwin? ppc? rhapsody? How can I get a list of acceptable host types?
Bordering on a dumb question I know, just can't find answer for this.
This past weekend, I took advantage of OS X's UNIX core to automate the database backup for this site. Until recently, I backed up the data by connecting to the ISP, launching the mySQL database program, exporting the data, then using one of a number of transfer programs (Fetch, RBrowser, etc) to bring the file back to my home machine.
Although this worked, it was quite tedious, and I would often forget to do the backup. Then another geeklog-powered site had a major disaster, and lost all of their articles (macosxapps.com, if you'd like to stop by and help them rebuild, it'd be greatly appreciated!). This was the kick I needed to find a better way to do my backups.
Read the rest of this article if you'd like a little insight into how I used some basic UNIX programs to handle this repetitive mundane task. This is fairly basic stuff for UNIX wizards, and I'm sure I could be doing this in a more advanced way, but it does demonstrate how the UNIX core of OS X can be put to good use.
I installed Samba a while back to play with it, but I've since moved my OS X box to a non-Windows environment. I want to uninstall Samba just for general "system purity," but I can't find any uninstall directions. Any clues?
A while ago someone asked about how to configure osx for printing from the command line.
If you have a postscript printer in your network, this is actually pretty simple. Create a printcap file (named "myprintcap" for example) with jEdit, or vi or emacs or any other text editor:
lp:\ :lp=:rm=<printer ip or name>:rp=lp:\ :sd=/var/spool/lpd/lp:ty=PostScript:
Save this file somehere in your directory. Note: there should be backslashes terminating the first two lines. They were consumed by the scripts processing this hint, I guess. [Editor's note: Backslashes get stripped out, unless you enter in HTML mode, and use the character code '\' for a backslash ... I've added them to the above lines.
Next you load this printcap into netinfo (line 1 below) and create the spool directory (line 2). Open a terminal and connect as root ("su"), then type: