LowEndBox - Cheap VPS, Hosting and Dedicated Server Deals

Finding your way on your first ever VPS – Part I

Tags: Date/Time: August 20, 2014 @ 1:00 pm, by Maarten Kossen

In the past, I have shown you how to connect to your VPS over SSH on both Windows and Linux. But if you are a first-timer and you have never used a VPS before, you may be quite lost once you’re on your server. In this tutorial, I want to show you some basic commands for moving around your first ever (Linux-based) VPS.

I am going to assume a Debian-based distribution in my examples. I’m using Ubuntu 14.04 more specifically. Most commands should work on any Linux distribution; the only distribution-specific commands are those for the package manager.

Ready? Set? Let’s go!

ls

The first command I want you to know about is ‘ls’. ‘ls’ is used to list directory contents, so it lists the files and directories contained in the the directory you currently are in. When you log in via SSH, you end up in your username’s home directory. In case of root, this is /root. In case of a regular user, it is usually /home/{username}. To use ‘ls’ just type:

ls

In the terminal and you should get a list of files and directories contained in the current directory.

‘ls’ has three options/arguments that are most commonly used: ‘-l’, ‘-a’, and a path name. I’ll briefly go over all three of them:

  • If you pass ‘-a’ to ‘ls’ you get the following command: ‘ls -a’. This ensures that hidden files and directories (whose name starts with a dot . ) are also shown.
  • If you pass ‘-l’ to ‘ls’ you get the following command: ‘ls -l’. This shows the results as a list with more details, rather than a columned view.
  • If you pass a path (like /var/www) to ‘ls’, you get to see the contents of that directory. For example, ‘ls /var/www’ shows you the contents of the directory /var/www. This also works individual files.

You can combine options starting with a minus ‘-‘ by stacking the characters. So ‘ls -a’ and ‘ls -l’ combined would become ‘ls -al’ and it will both show hidden files and directories and show them as a list.

 cd

The ‘cd’ command helps you move around. By typing ‘cd’ followed by a path, you change the current directory to that path. For example, if you want to go to /var/www, you would type:

cd /var/www

Typing ‘cd’ without any arguments returns you to your username’s home directory.

Tab completion

When typing commands, arguments, or path names, you can often tap the tab key to get the command or path completed. When there is more than one option, your shell shows a list of options available. The only way to really get the hang of this is by trying it out.

nano

Nano is a tool for viewing and editing text files; it does not work with binary files like images or zip files. When you want to open a file, say /etc/apt.sources.list, you type the following command:

nano /etc/apt.sources.list

This opens the nano editor where you can freely move around using the arrow keys and type wherever you want.

Nano offers various options on the bottom of the screen. All options start with a ^, which means you should use the CTRL key combined with the letter that follows. For example:

  • To save a file, press CTRL+O and press enter after having filled out the correct file name. When editing a file, the file name is often filled out for you and you only need to press enter.
  • To exit, press CTRL+X.

Most options also have explanations written besides them and there’s even a help option.

Getting help

If you need to know the arguments available for a certain command, you can type the command followed by ‘–help’. For example, to get the available options for ‘cd’, you type:

cd –help

Notice the space in between.

apt

This is the one command that’s specific to Debian-based distributions. ‘apt’ is a package management tool and it a stripped down version of ‘aptitude’, which is the full tool.

To install a package with apt, you have to know the package name. Most packages names are straight-forward, like ‘apache2’ for Apache 2 and ‘nginx’ for NGINX. If you do not know the package name, use ‘apt search {package name}’ to search available packages and their descriptions.

Once you know a package name, use ‘apt install’ to install a package. For example, to install Apache2:

apt install apache2

Depending on whether you are logged in as root or a sudo user, you may have to prefix the command with ‘sudo’ (‘sudo apt install apache2’). Read more about sudo here.

Final notes

That’s it for this part of the tutorial. You now know some basic commands to find you way around a linux server. There’s plenty of more commands to learn, including some essential which you would use quite often. Those are, however, for next week!

Key in learning to work with Linux is working with it a lot. Safest thing to do it getting a test server which you can reinstall in case something goes wrong. Such a server can be used as a perfect testing area and you can safely try out any command you like.

Good luck!

Maarten Kossen was the administrator of LowEndBox from 2013 to 2015, and brought many ideas and improvements to the website during his leadership. Today he is member of our community and LowEndTalk.

18 Comments

  1. LowEndCriticus:

    I’m missing man -k here

    August 20, 2014 @ 4:47 pm | Reply
    • Maarten Kossen:

      That’s Part II ;-)

      August 20, 2014 @ 7:26 pm | Reply
  2. Spencer:

    Now I know how to change directory, thank you!

    August 20, 2014 @ 6:26 pm | Reply
    • Maarten Kossen:

      Easy, isn’t it? Now you finally know, after all those weeks of trying to figure it out ;-)

      August 21, 2014 @ 6:26 am | Reply
  3. Good post Maarten. A nice little start for those using a VPS for the first time.

    August 20, 2014 @ 6:49 pm | Reply
  4. Bert:

    Maarten, how do you decide what RAM size you need and whether to go 64-bit or 32-bit?

    August 20, 2014 @ 7:38 pm | Reply
    • Maarten Kossen:

      Anything up to 2GB should work well with 32-bit. You could even say that it could theoretically save you memory to use a 32-bit OS there, but I’ve yet to see a significant difference there in real life.

      I have to say though, 64-bit has sort of become a default these days so I would always pick that myself. My personal rule is to pick 64-bit for anything with 128MB of RAM and up.

      August 21, 2014 @ 6:26 am | Reply
  5. You should include a description of yum alongside apt, but nice intro.

    August 21, 2014 @ 8:00 am | Reply
  6. You should update the APT part, it’s apt-get, not apt ;)

    August 21, 2014 @ 4:55 pm | Reply
    • perennate:

      Both work. apt is a high-level script built on top of apt-get / aptitude, so is suitable for new users.

      August 21, 2014 @ 5:56 pm | Reply
  7. Zarf:

    Nice post Maarten, only comment is that to run nano on Ubuntu under many VPSs you first have to:

    apt-get update ; apt-get install nano

    as it doesn’t come pre-loaded with the distro. Cheers!

    September 3, 2014 @ 7:08 pm | Reply
  8. RDuke:

    I am having problems just getting SSH to work from the IP I was given. I can only get it work from Serial Console I initiated thru control panel.

    October 2, 2014 @ 2:58 pm | Reply
  9. Sean:

    Hoping there is a provider who can help me out / point me in the right direction.

    Basically I am looking for 1 of 2 things which are:

    A) A VPS provider that allows port scanning. This will solely be used for finding proxies and SEO purposes.

    B) Is it possible to setup your own server and host your own private proxies? I’ve been investigating into the possibility of installing Squid Proxy on a VPS, where it can then act as a proxy server and generate proxies – Is this correct?

    December 9, 2014 @ 9:28 am | Reply
  10. Sami:

    In nano part there is example command “nano /etc/apt.sources.list” which will open new file.

    Type “nano /etc/apt/sources.list” if you want to edit sources.list

    January 9, 2015 @ 11:05 pm | Reply
  11. Great tutorial. I have just started out with a VPS plan that I grabbed through an offer on this site, and then fortunately I found this tutorial. Too much helpful. Thanks :)

    February 20, 2015 @ 10:00 am | Reply
  12. Isn’t it so easy ???

    July 13, 2015 @ 9:53 am | Reply
  13. o not use LowEndBox for sup

    July 13, 2015 @ 12:37 pm | Reply
  14. Kingroot:

    Awesome blog post buddy, keep sharing

    June 5, 2018 @ 6:59 am | Reply

Leave a Reply

Some notes on commenting on LowEndBox:

  • Do not use LowEndBox for support issues. Go to your hosting provider and issue a ticket there. Coming here saying "my VPS is down, what do I do?!" will only have your comments removed.
  • Akismet is used for spam detection. Some comments may be held temporarily for manual approval.
  • Use <pre>...</pre> to quote the output from your terminal/console, or consider using a pastebin service.

Your email address will not be published. Required fields are marked *