Up and Running With SSH
Now that our primary website is fully launched, let's create our magical symlinks to mirror the site to each subfolder that we want to be able to access the site:
cd ..
ln -s friendsforever friends4ever
ln -s friendsforever friends
ln -s friendsforever foreverfriends
The "cd .." basically moves us up one folder, so we are in our public_html folder to create our symlinks with the "ln" command. The ln command has the "s" flag attached, which basically tells it to create symlinks instead of hard links. Hard links are most often unnecessary, and can be confusing after you forget about them, so we opt for symlinks. To be sure that this has worked, let's do a directory listing:
ls -l | grep friends
Stop! Wait! Grep? You didn't say anything about grep! What is this madness? Sometimes, you just want to see what you are looking for, and nothing else. The "grep" command makes this incredibly easy to do! By piping our directory listing output to grep with the "friends" search string, we can list only lines or files that contain "friends" as part of their name. The output should look something like this (ignoring the lefthand part which is not important in this case):
foreverfriends -> friendsforever
friends -> friendsforever
friends4ever -> friendsforever
friendsforever/
What is great about symlinks is they are very easy to spot in a directory listing, and they easily show you what they are doing. You can see that foreverfriends symlinks to friendsforever straight from the directory listing. Now, let's try it in our browser. Navigate to http://yourdomain.com/friends/ and see if you find the index.html that you placed in your friendsforever folder. In most cases, your URL should also update to match, perfect!
That was great, but there's way, way more!
Yes, there are FAR more ways to utilitize SSH to your advantage when managing your website. We have barely scratched the tip of the tip of the tip of the iceberg here, and I encourage you to play around and research new commands for use with your everydate site maintenance & management. For example the "mv" command can move files around, while the "rm" command can remove files (BE VERY CAREFUL!), both more quickly and easily than via FTP, in comparison to most FTP clients. You can also perform mass-security functions across your files, search for and remove injected code should your site be compromised, and so much more.
Hey, what about SSH keys?
Want to further secure your SSH access? Check out our knowledgebase article on SSH Keys.