Basic Shell Commands You Need To Know

Alright, so you have your VPS and you have logged into it via SSH with PuTTY. You are presented with a terminal screen and you don’t know what to do now.

Putty Logged In

So lets go over a few basic shell commands you will need to know to get around your server. The following commands will teach you how to move around to different directories, copy files, move files, delete files, and list files in the directory.

Navigation

cd test

Using that command would move you into a directory called “test”. For it to work you have to have a directory named that under you current location. You can also specify a full path to go to directories as well.

cd /home/rohan/public_html/

In that example it would take me to the “public_html” folder which happens to be my web root folder on one of my servers.

cd ~cd

Using either of those will take you to your home directory for the user you are logged in as.

cd ..

Using that will take you up one directory level.

File Management

ls

This command displays all files/directories in the current directory. You can use this command in other ways to get more information as well

ls -l
Putty ls -l


This displays more information about the file such as who owns the file, the size, and the date it was created. If you use that command and there are too many files to see on one page you can change the command to create a page view and press the “space” to view next page.

ls -l |less

Note the vertical bar | is also called an UNIX pipe you type it by using shift+\.

ls -la

Using this will also show all the hidden files in the directory.

cp (filename) (new filename)

In this example we copied a file and created a new file with the same content.

cp home.html backup/oldhome.html

Using the same thinking we can also copy it to a different directory.

mv home.html index.html

This would change the name of the file from home.html to index.html.

mv images/ media

You can use same method to rename a whole directory as well.

rm index.html

Using the “rm” command you can delete files

These are some basic shell commands that you will need to learn to get started with your server. These will help you move around your sever, copy, delete and rename files.

Using Putty To Log Into Your Server

So you went ahead and got yourself a server or a vps. ( If you haven’t yet head on over to Host.Us or Crissic and get one now) Great now what do you do? How do you log in and start setting up your server.

First you need to make sure you have a program called PuTTY. Once you get that and open it up you will see this screen.

Main Putty Window

At this screen enter the IP address of your new server, you will have gotten this from your provider after you ordered, check your email you will have received a few emails from them. One of the emails will have this information for you.

After you input your IP and click “Open”, PuTTY will open a terminal window connected to your server. The following window will pop up, click “Yes” and proceed to log into your server.

Putty Alert

After you click “Yes” a window will pop up asking you for log in details. The username will be “root” and the password will either be one you created during your purchase of the server or one that was generated for you by the hosting company.

Putty Login
Putty Logged In

Congratulations you are now logged into your server as root. Now you can start setting up your server and running tests on your server for performance.

What We Need To Get Started

Great you have decided to go down the path of getting a VPS or Dedicated server for your website/sites. But you have know idea of where to start. First lets go over what we need to get started.

1. You are going to actually need a server to start working on. There are a ton of options out there of where to get a server from.  Now since you are still learning odds are you will want to get something cheap just to start learning the basics.  Two places that I currently use and have had good experiences with are Host.Us* and Crissic*

2. You are going to need a way to log into your server once it is setup. To do this you’ll need a program called PuTTY Once you log into a server your PuTTY window will look like this.

PuTTY

3. Lots of coffee or some other beverage to keep you awake and focused, you are in for a long long haul.

4. (optional but will make it easier) Domain name so you can setup an “A” record to reach the server easier.

These are the basic items you need to get started with you first server. More tutorials well be coming soon covering how to use PuTTY, installing your OS for the first time etc.

*These are affiliate links, if you would prefer not to use it here are the links with no affiliate info.  HostUs.us & Crissic