obey-robots.txt
Web Master Trouble
Users Online
Guests Online: 1

Members Online: 0

Total Members: 3
Newest Member: Proxyhotdeals
Login
Username

Password



Not a member yet?
Click here to register.

Forgotten your password?
Request a new one here.
Last Seen Users
Your ad here below
View Thread
Web Master Trouble » Linux Apache MySQL PHP optimalisation tips tricks » Linux tutorials, Tips & Tricks
Linux tutorials, Tips & Tricks Getting started with SSH An introduction to NGINX, PHP-FPM and MariaDB on CentOS An introduction to NGINX, PHP-FPM and MariaDB on Ubuntu Getting started with OpenVZ! Handle DNS properly with cPanel Munin amass, all your server charts in one place Monitoring server performance with Munin! Getting started with OpenVPN (client) Getting started with OpenVPN (server) Your own mail server with Virtualmin IPtables: IPv6 and more rules
 Print Thread

Finding your way on your first ever VPS ? Part III

NuclearFusion

Part III of the 'Finding your way on your first ever VPS' series is right in front of you right now! This time I'm going to focus on some powerful tools which can make your day-to-day life a lot easier.

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.

Let's get to work!

cat

With 'cat', you can print the contents of a file to the standard output, which is usually your terminal. This allows you to quickly see the contents of files without having to leave your terminal for another application. It works best with small files, for example, your resolv.conf or your hosts file. But, if you combine it with another piece of software I'll cover later on, this will be quite useful for large files as well.

Let's say you want to quickly see the contents of your resolv.conf, you type:

cat /etc/resolv.conf

You could get an output like this:

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND r12; YOUR CHANGES WILL BE OVERWRITTEN
nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver 2001:4860:4860::8888
search example.net

cat was primarily designed to concatenate files, though, rather than printing to your terminal. You could, for example, cat two files and then convert those into a single file. That's for another time, though.

pipe (|)

A pipe | is not an application, but a tool. It allows you to send the output from one application to another. This is a very powerful tool which allows you to combine the power of multiple applications together.

A good example for the use of a pipe is piping the output from a certain command to 'less' so you can calmly look at it or even search through it. The command 'lsof' (which lists all the open files on a system) usually has a long output and it may be a pain to work with. If you pipe this to 'less', you can browse through it and search through it like it's a regular text file.

To do this, type:

lsof | less

Which should open 'less' with the output of 'lsof' in it. Once you exit less, the contents are lost, so this is no way to save content.

grep

grep allows you to search a file or multiple files for a pattern. grep prints every line the pattern is found in to your terminal. A pattern can be something as simple as a word or an IP address, or something as complicated as a long regular expression. In my experience it is extremely useful to quickly search several log files at once.

Say you want to find a certain domain name or IP address in a log file, you would type something like this:

grep 8.8.8.8 /var/log/syslog

The above command searches the file /var/log/syslog for the IP 8.8.8.8 and prints any lines from the file that IP address is on. But, it could also be that you want to search multiple files, or even all files in a directory. In the last case, you would type:

grep 8.8.8.8 *

Where * tells grep to use all files in the current directory (not subdirectories).

grep can also be used in combination with the pipe, so you want search through data coming from another application.

top

top is an application that shows you all the running processes on a system in a single list. Not only does it show the running applications, but also how much CPU and memory an application uses, which user it runs under, how long it has been running, and quite some other things. If you want to know the current status of your system, top is there to help you.

You can open top by typing 'top' and quit it by pressing q.

Inside top you have a lot of options, for example to sort or filter the list. There are too many option to highlight right here, so your best option is to type ? or h when in top to see the in-application help, or to use 'man top' to view it's manual.

htop

Or you can install htop, top's better alternative. To install it, type:

sudo apt install htop

Once done, you can open it by typing:

htop

You will now get to see a more colorful application with some bars at the top. htop has a more graphical display of the system's used and free resources. Better than that, it can work with your mouse and it works nicely with the F-keys as well as your arrow keys. You can easily sort the columns and you know where to go in this application. Have a look around and enjoy.

My recommendation is to always install htop on any server and it's simply a lot better than top. It may not be available on any system, however, so in those cases top is what you'll have to work with.

Final notes

For now, this is the last in the series 'Finding your way on your first ever VPS'. After having read these three tutorials and having practiced a bit, you should have sufficient information to investigate other parts of your VPS on your own.

Enjoy!


Warning about ParkingCrew.com! Case: ParkingCrew.com acquires NameDrive.com but earnings are not transferred despite assurances and promises. Inquiries about this are ignored! It's just a con compagny. Don't do business with them!
 
Jump to Forum:
New Thread Post Reply
Use this BBcode or HTML to refer to; 'Finding your way on your first ever VPS ? Part III'
BBcode:
HTML:
Vergelijkbare onderwerpen
Thread Forum Replies Last Post
Server monitoring with Icinga 2 ? Part 1: the server (Ubuntu host) Linux tutorials, Tips & Tricks 1 17-10-2016 09:21
Server monitoring with Icinga 2 ? Part 2: the node (Ubuntu host) Linux tutorials, Tips & Tricks 1 03-09-2015 07:15
Tutorial ? The LowEndCluster ? Part 4 Linux tutorials, Tips & Tricks 1 26-05-2015 07:15
Tutorial ? The LowEndCluster ? Part 3 Linux tutorials, Tips & Tricks 1 24-05-2015 13:17
Tutorial ? The LowEndCluster ? Part 2 Linux tutorials, Tips & Tricks 1 24-05-2015 13:17