Create a random character text file using Linux shell

Here is a nice trick on how to create a dummy character text file consisting of any chosen or random characters. In the first example we will create and simple file consisting of a single character X with a size of 1000 bytes:

$  < /dev/urandom tr -dc "X" | head -c1000 > file.txt
SAMPLE:
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

or we can create a file consisting of an alphabetic and numeric character:

$ < /dev/urandom tr -dc "[:alnum:]" | head -c1000 > file.txt
SAMPLE:
CCjeuAhJNc4yxBfeMbbYX1U1TnSCVS5oiV53MtGoA6s45FAw9H9PyfZJHrA421

Read more

Installation of missing php-mbstring on RHEL 7 Linux

The php-mbstring is part of Redhat’s server optional packages. If you have a current subscirption all you need to do is to enable this repository using:

[root@rhel7 ~]# subscription-manager repos --enable=rhel-7-server-optional-rpms

and use yum to install php-mbstring. In case that you do not have a current Redhat subscription you can install php-mbstring directly from IUS project repository:

[root@rhel7 ~]# wget http://dl.iuscommunity.org/pub/ius/stable/Redhat/7/x86_64/ius-release-1.0-13.ius.el7.noarch.rpm
[root@rhel7 ~]# wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-2.noarch.rpm
[root@rhel7 ~]# rpm -Uvh *release*.rpm

Read more

Check status, enable and start the SSH Server on Fedora Linux

How to install, start and connect to SSH Server on Fedora Linux

The tutorial will explain the basics behind SSH server and SSH client connections on Fedora Linux Workstation. By default the SSH server on Fedora Workstation may be installed but not enabled. This will cause a following error message when connecting via SSH client:

ssh: connect to host fedora-workstation port 22: Connection refused

In this tutorial you will learn:

  • How to Install SSH server
  • How to enable SSH server
  • How to Start SSH server
  • How to Connect to SSH server

Read more

Crontab entry format and syntax example

Linux Crontab Reference Guide

Introduction

Every user, as well as administrator of the Linux system, very often need to execute some programs automatically on regular basis.

For example, an administrator may need to monitor a disk usage of a system. In this case, a cron scheduler is a very handy tool to achieve this goal.

Let’s say that the system administrator needs to execute /usr/local/sbin/backup.sh script every Sunday at 2:36AM. In this case the administrator would edit his crontab file as shown on the figure below:

$ sudo crontab -e 

The format of Crontab entry is simple as it is divided into 7 fields separated by spaces or tabs. The 6th field, in this case, the username, can be omitted as it is only used by the system-wide crontab scheduler.

The following figure illustrates a single Crontab entry to allow automatic script execution every Sunday at 2:36AM:

Read more

Linux commands tutorial

Linux Commands

Are you a beginner GNU/Linux user and wish to look beyond the usual window dragging and mouse clicking? This guide is intended for the absolute beginner users wishing to learn the basics of GNU/Linux command line. This tutorial intends to walk through basic Linux commands related to navigation, file and directory administration, software installation and basic system troubleshooting.

Read more

linux-bash-prompt

How to Change Bash Prompt

Default bash command line prompt on many Linux systems is quite minimal. As we will see in this article, it can be easily changed by modifying bash PS{n} variables, so to include information such as display time, load, number of users using the system, uptime and more.

In this tutorial you will learn:

  • What are PS1 and PS2 shell variables
  • How to create custom shell prompts
  • What are the characters we can use to customize a shell prompt

Read more

Debian package

Easy way to create a Debian package and local package repository

This article describes a simple way to create a home made debian package and include it into a local package repository. Although we could use an existing Debian/Ubuntu package, we will start from scratch by creating and packaging our own trivial application. Once our package is ready, we will include it into our local package repository. This article illustrates a very simplistic approach, however it may serve as a template in many different scenarios.

In this tutorial you will learn:

  • How to create a trivial debian package
  • How to create a local debian repository
  • How to add the repository to the list of software sources

Read more