logrotate command in Linux with examples

logrotate command in Linux with examples

In Linux, many applications and system services will store log files. These log files give a Linux administrator insight into how their system is performing, and are invaluable when troubleshooting issues. However, log files can get unwieldy very quickly. For example, if your web server software logs every visit to your website, and you get thousands of viewers per day, there will be way too much information to feasibly squeeze into one text file.

Read more

How to use watch Linux command

Watch command in Linux with Examples

Have you ever had to sit at a Linux terminal and repeatedly type the same command while waiting for a different result? A common example from personal experience would be typing the ls command when waiting for a certain file to appear in a directory, such as when a running Bash script is expected to generate a file. For a situation like that is exactly why we have the watch command in Linux.

Read more

whois script to check many domains and TLDs at once

Check domain name availability with bash and whois

If you’ve ever tried to come up with a catchy domain name, you know how annoying it can be to keep checking to see if a certain name is available. Fortunately, on Linux we can make the task a little easier on us by using the whois command. When a domain is available, the output from whois will let us know that it’s not able to find any information for that domain.

It’s easy enough then to put this functionality into a Bash script, which helps to automate checking lots of different TLDs (Top Level Domains, like .com, .net, .org, etc).

In this guide, we’ll show how to check domain name availability from the command line on Linux. Then, we’ll give you a simple Bash script that you can copy onto your own system and check for lots of domains at once. Read on to learn how.

In this tutorial you will learn:

  • How to install whois on major Linux distros
  • How to check for domain name availability with whois command
  • Bash script for checking domain name availability

Read more

Replacing all tab characters with spaces on Linux

Replace all TAB characters with spaces

If you have a lot of tab characters inside a text document or program file, they can be annoying because of how they’re represented differently in various text editors. For example, when you send your code to someone else, is it going to display the same way on their screen as it did on yours? Tabs are a bit unpredictable in this respect, and spaces are a much safer bet.

In this guide, we’ll show how to replace all the tab characters inside a file with spaces on Linux. We can use various Linux commands to do the job for us, which we’ll go over below. Depending on your situation and the file in question, some commands may be more suitable than others.

In this tutorial you will learn:

  • How to replace tab characters with spaces

Read more

Configuring Gmail as a Sendmail relay on Linux

Configuring Gmail as a Sendmail email relay

Sendmail is email routing software that can allow Linux systems to send an email from the command line. This allows you to send email from your bash scripts, hosted website, or from command line using the mail command. Another example where you can utilize this setting is for notification purposes such as failed backups, etc.

In this guide, we’ll go over the step by step instructions to configure Gmail as a relay for the sendmail client on Linux. Note that Sendmail is just one of many utilities which can be configured to rely on a Gmail account. Others that are capable of this include postfix, exim, ssmpt, etc. The instructions here should work for any mainstream Linux distribution.

In this tutorial you will learn:

  • Gmail configuration prerequisites
  • How to install Sendmail and mail utilities on Linux
  • How to configure Gmail as a relay for Sendmail
  • How to test the config by sending an email from command line

Read more

ansible-logo

Ansible tutorial for beginners on Linux

A system administrator, in the vast majority of cases, has to take care of more than one server, so he often has to perform repetitive tasks on all of them. In these cases automation is a must. Ansible is an open source software owned by Red Hat; it is written in the Python programming lanaguage, and it is a provisioning and configuration management software which help us in the aforementioned cases. In this tutorial we will see how to install it and the basic concepts behind its usage.

In this tutorial you will learn:

  • How to install Ansible on the most used Linux distributions
  • How to configure Ansible
  • What is the Ansible inventory
  • What are the Ansible modules
  • How to run a module from the command line
  • How to create and run a playbook
ansible-logo

Read more