Help a newbe use Terminal

rmartink

Registered
I know this is so basic but i don't know anything about unix. How do I find, open and edit a file on my computer using Terminal.
I need to access a file located: /users/bob/.ssh/known_hosts.
Please help
thanks
 
You can use a UNIX text editor like vi, vim, emacs or nano.

You would type:

Code:
nano /users/bob/.ssh/known_hosts
If the file needs to be edited as superuser (root), then you would prepend the above command with "sudo" and enter your administrator password when prompted.

Explaining exactly how to use those text editors is beyond the scope of this forum. A simple google search will get you going using any of these, though.
 
Here's an easy way to do what you need to do.

Download TextWrangler from http://barebones.com , it's a free download.

Once you have it and start it up let it install the command line tools or go to its prefs and tell it to install them.

Now to edit a file in some low level directory you can't normally get to from Finder you negotiate your way in Terminal to the directory you want to work in and simply type in edit somefilename

So to edit /users/bob/.ssh/known_hosts you can just type in:

edit /users/bob/.ssh/known_hosts

or edit ~/.ssh/known_hosts which is a shortcut to your user directory.

The file will open in TextWrangler and you can edit it just like any other file.
 
Back
Top