Unix-ish Commands I use Often
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!