Archive for the ‘Mac OSX’ Category

Unix-ish Commands I use Often

April 1st, 2009 | No Comments »
Posted by Aaron Reimann under Editing, Linux/Unix, Mac OSX, Web Development

Are you a web designer that sometimes need to SSH into a web site and make some changes but don’t know a Unix text editor?  Here are some basic commands that you might need.

Navigating in and out of directores:

To change directories:

pwd (shows you what directory you are in)

ls (lists all files)

cd www (gets you into the directory called www)

cd .. (gets you down one directory)

Editing files.  I like editing files in Vi.  It is confusing if you don’t know it.  I am by no means a Vi expert like some of my friends, but I can do a lot.  Here are the basics:

use the arrow keys to navigate (you can use letters to move around, but if you don’t want to learn Vi, don’t waste your time)

vi filename.php (opens a file called filename.php)

i (gets you in the insert mode)

the escape key gets you out of the insert mode

x (deletes the character your cursor is on)

dd (deletes the whole line you are on)

:w (writes the file)

:q (quits Vi)

:wq (writes the file and exists)

:%s:bob:john:g (replaces bob with john in the whole file, i recently used that to replace text on a 42 meg text file, it came in handy.  it took seconds to do)

Enjoy!

 

Mac OSX user lost desktop permissions

March 23rd, 2009 | No Comments »
Posted by Aaron Reimann under Mac OSX, Operating Systems

What do you do when all of your icons no longer appear on your desktop?  Chances are, you have lost all permissions to view (read) and edit (write) them.  This happened to one of my friends, he of course was a little confused.  We had no idea why it happened, but it did.  Let’s call this Joe Bob His Mac username is “Joe Bob” and the real user name (Unix name) is “joebob.”

The user, joebob, could access Application, his music (/Users/joebob/Music), his documents (/Users/joebob/Documents), etc. But was unable to access /Users/joebob/Desktop. He got a permission denied thing. I find that somewhat funny because there wasn’t any other user on the computer (well, besides, root, apacheh, mysql, etc). So, what was the fix?

Go to terminal (use Spotlight to find it if you want) and type in: sudo passwd

Typing that in “activates” the root account.  Make sure you remember the root password, you will not be happy if you forget it.

How do get your “short name”, type in:

cd /Users

ls

What are short names?  Even though when I login to my Mac my user name “Aaron Reimann” is displayed, I can still login as “aaronr”.  OSX (and a lot, maybe all Unix-like OS’s) creates a short name for every user that it creates.  It makes more sense that your user directory is “/home/aaronr”, not “/home/Aaron Reimann”.  I don’t know if it is a POSIX thing or not, it is a fact though.

now type in: sudo chown -R joebob:joebob /Users/joebob/Desktop

That will make sure that joebob owns the Desktop directory

type in: sudo chmod -R 744 /Users/joebob/Desktop

That will make the files on the desktop read and writable

Log off, log back in, and you will see your icons/files.

With all that said, you probably could go into Disk Utilities and do it the “easy” (really the time consuming and GUI way), but this is quick.

 
 
Theme by A. Reimann