Affiliate’s Guide to SSH – Part 2

Welcome to Part 2

Whoa… no comments so far on part 1 of the series  Apparently you guys are already goddam SSH geniuses!   At the risk of telling you more stuff you already know, I’ll carry on…

Now that we’ve got you logged in and primed for doing some damage, in this post we’re going to learn some new commands and find out where your web documents are stored.

Navigating Directories

There are a few commands that are handy for navigating directories.  We’ve already learned one: ls   The ls command defaults to a short format.   In other words it simply lists sub-directories and files.  However you can modify this by using a “switch”.  This is simply an additional parameter you use after ls like so:

ls -l

the “-l” switch turns on long formatting and when you use it, you’ll see a bunch of other information.  Such as… file/directory permissions, sizes, dates, etc.   Try it and see!

To change directories, use the “cd” command.  Like so:

cd foo

If the directory “foo” exists, you’ll navigate to that directory.

To go “up” a directory level do this:

cd ..

To go to the top-most directory do this:

cd /

As you can see the “..” and “/” characters have special significance when navigating the Linux filesystem.   We’ll learn more about this later.

To make directories, use the “mkdir” command.  Like so:

mkdir foo

Executing that command will create a directory called “foo” inside of whichever directory you’re currently in.

Simple so far, yes?

Finding Your Web Pages

When you upload pages to your server using FTP, you probably already know that you have to put them in the “public_html” directory for them to be accessible in your browser.   So knowing how to find this location is super handy for all sorts of reasons.

If you’ve followed along so far and logged in as the “root” user, you’re what’s known as a “super user”.  That means you can see all the other users on your server.

For our purposes, these other users are typically cpanel accounts.  You may have created these users yourself in WHM or a cpanel user may have been created for you by your hosting company when they provisioned your server.

On most WHM/Cpanel servers, each cpanel user account is usually located in this location:


Where {username} is the name of your cpanel user.  So let’s go there now.

In your SSH client, do this:

cd /home

As you can see we changed directories to /home and then performed a directory listing.  You should see a listing that includes a few entries.  Among them, you’ll see your cpanel user(s) directories.

Typically, the cpanel user is the first 8 characters of the domain it was originally associated with.  For example, if your domain is, you should see the directory superama in your listing — the directory for the cpanel user who “owns” this domain.

So now you can do this:

cd superama/publc_html/

(Change “superama” to whatever your username is).  You should see a directory listing of all the web documents you’ve uploaded via FTP.

Cool huh?  Obviously what you see in the /home directory is going to be different on your server.  But the point is, you should now know how to navigate to where your web documents are stored.


So far we’ve just poked around a bit, but knowing where stuff is located is really important for doing useful stuff.  Next time we’ll start doing things like renaming files, and copying and moving files and directories.  Stay tuned!

Leave a comment



One Comment

  • ryan t

    please continue to post more dude :) Moar tips!


Related posts by category

Related posts by tag