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.
scripting
usermod command in Linux with examples
The usermod command in Linux is used to modify user accounts. In particular, it’s used for changing various attributes for accounts that are already created, since a separate command is used when creating a brand new account on Linux.
Cat command in Linux with examples
The cat command in Linux is our primary tool for viewing the contents of text files on Linux systems. When using or administrating a Linux system, you are usually confronted with a command line. There are no graphical aids such as mouse or windows to help you navigate through directories or edit files.
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.
Addition and subtraction arithmetics with Linux date command
The date
command on Linux can be used to see the current date and time, but we can also use addition and subtraction arithmetic with the command to extend its functionality. For example, instead of seeing the current date, we can see the date and time from five days ago, five years in the future, etc. The possibilities here are endless.
C++ function to calculate Fibonacci number sequence
In this artcile you will learn how calculate Fibonacci sequence with using C++ function. The Fibonacci sequence starts with 0 and 1 where the the following number is always a sum of the two preceding numbers. For example, 0,1,1,2,3,5,8 and so on.
In this tutorial you will learn:
- How to compile Fibonacci C++ program
- How to run Fibonacci C++ program
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
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
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
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