InMotion Hosting Support Center

In our previous article, we showed you how to login to your server via SSH. If you're following along our tutorial, the next item to learn is how to navigate around the file system. This is the same whether you are using a shared, VPS, or Dedicated account.

In the tutorial below, we are using the following account:
cPanel username: user5

What directory am I working in?

When you first log in via SSH, you will be placed in your home folder. For our user, it is /home/user5. Further on in this page, you'll change directories. If you ever need to determine which directory you are currently in, use the pwd command. The pwd command will print the working directory: [~]# pwd

What is in this directory?

Now that you know which directory you are in, you may want to know what files and folders and in this directory. You can use the ls command to list the directory contents: [~]# ls
./  ../  .bash_logout  .bash_profile  .bashrc  .contactemail  .dns  .gemrc  .htpasswds/  etc/  mail/  perl5/  public_ftp/  public_html/  tmp/  www@

The results above are simply a listing of files and folders in your current account. Many times you'll need more information than this. For example, you may need to see file sizes or permissions. You can add the -alh flags to:

  • a - do not ignore entries starting with . (hidden files, such as .htaccess)
  • l - use a long listing format (shows additional information such as filesizes and permissions)
  • h - when using -l (described immediately above), prints file sizes in human readable format (e.g., 1K 234M 2G) [~]# ls -alh
total 60K
drwx--x--x   9 user5 user5  4.0K Dec  5 11:23 ./
drwx--x--x  36 root  root   4.0K Dec  5 11:15 ../
-rw-r--r--   1 user5 user5    24 Dec  5 11:15 .bash_logout
-rw-r--r--   1 user5 user5   191 Dec  5 11:15 .bash_profile
-rw-r--r--   1 user5 user5   124 Dec  5 11:15 .bashrc
-rw-------   1 user5 user5    18 Dec  5 11:15 .contactemail
-rw-r--r--   1 user5 user5    20 Dec  5 12:27 .dns
-rw-r--r--   1 user5 user5   147 Dec  5 11:15 .gemrc
drwxr-x---   2 user5 nobody 4.0K Dec  5 11:15 .htpasswds/
drwxr-x---   2 user5 mail   4.0K Dec  5 11:15 etc/
drwxr-x---   8 user5 user5  4.0K Dec  5 11:15 mail/
drwxr-xr-x   2 user5 user5  4.0K Dec  5 11:23 perl5/
drwxr-xr-x   3 user5 user5  4.0K Dec  5 11:15 public_ftp/
drwxr-x---   3 user5 nobody 4.0K Dec  5 11:15 public_html/
drwxr-xr-x   2 user5 user5  4.0K Dec  5 11:15 tmp/
lrwxrwxrwx   1 user5 user5    11 Dec  5 11:15 www -> public_html/

How can I navigate to another directory?

Using the cd command, you can change directories. For example, if we want to navigate to the public_html folder, you can issue this command: [~]# cd public_html/

To confirm you are in this directory, you can use pwd to print the directory you are currently in: [~/public_html]# pwd

How can I go back one directory?

We were previously at /home/user5 and we changed to our /home/user5/public_html folder. If we want to go up one level, i.e back to our /home/user5 folder, you can use cd .. [~/public_html]# cd ..

We can confirm where we're at by printing the directory we're currently in: [~]# pwd

Learn more about SSH Hosting

Support Center Login

Social Media Login

Social Login Joomla

Related Questions

Here are a few questions related to this article that our customers have asked:
Ooops! It looks like there are no questions about this page.
Would you like to ask a question about this page? If so, click the button below!
Ask a Question

Post a Comment

Email Address:
Phone Number:

Please note: Your name and comment will be displayed, but we will not show your email address.

0 Questions & Comments

Post a comment

Back to first comment | top

Need more Help?


Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail:
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!