Linux tutorials and more...
Generate random numbers with $RANDOM
Question:
Hi, How can I generate random number, preferably integer to be used within my bash script. Is there also a way to test whether random numbers are generated properly?
Answer:
The easiest way on how to generate random number in bash is to use bash's $RANDOM function. $RANDOM is an internal Bash function that returns an integer in the range 0 - 32767.
For example the following line will generate 10 random integers in range from 1 to 10:
How do I autostart application after login to KDE4
Question:
How do I autostart application after login to KDE4?
Answer:
The easiest way to autostart application after user login is to create a simple script with all commands to start any desired application and place this script into:
~/.kde/Autostart
For example let's say that we want to start Google's chrome browser automatically after login. To achieve this we ca do:
$ echo google-chrome > ~/.kde/Autostart/autostart.sh $ chmod +x ~/.kde/Autostart/autostart.shAdd a comment
Read more: How do I autostart application after login to KDE4
Installation of VMware-server-2.0.2 on Debian Squeeze i686
This guide provides a step-by-step installation of VMware-server-2.0.2 on Debian Squeeze Linux. Here we assume that user has already obtained VMware-server-2.0.2-<minor version>.i386.tar.gz installation pack along with a serial number provided upon the user registration.
System specs:
- Linux debian 2.6.32-5-686 #1 SMP Tue Mar 8 21:36:00 UTC 2011 i686 GNU/Linux
- installation package ~/VMware-server-2.0.2-203138.i386.tar.gz
Read more: Installation of VMware-server-2.0.2 on Debian Squeeze i686
Add ISO image to apt sources.list
Here is a way how to include Debian/Ubuntu ISO image into your /etc/apt/sources.list file. This kind of hack can prove handy in terms of reducing package download during the installation or if you do not have CD/DVD drive available ( or is broken ) on your system.
Let's assume that we have a Debian ISO image downloaded at the location: /mnt/storage/iSO/debian-i386-DVD-1.iso. As a first step we need to create a mount point to where this ISO image will be mounted to:
How to create file in linux
Question:
What is the best way to create a file in Linux. The file should be empty and it should be regular text file. I tried "create file" command but it did not work !
Answer:
The general way to create file is to use touch command. To create a file called create-file using touch command we can do:
$ touch create-file
This file will be empty and its name will be create-file . However, this is not the only way how you can create a file in Linux . Here are some other ways on how to create a file in linux: Create file using echo command:
Add a commentHow to install Drupal 7 on Ubuntu Linux
This guide describes all steps on how to install Drupal 7 on Ubuntu Linux using Apache web server and MySQL database. This guide assumes default installation of Apache web server and MySQL database.
These instructions can be also used by users using Debian or any other Debian based Linux systems.
All commands in below are executed with root privileges. If you are sudo user prefix all commands below with sudo.
Add a commentLinux ipconfig equivalent
Question:
Hi, what is the Linux ipconfig equivalent? I use command line ipconfig command in windows, however I cannot find linux ipconfig command on my Linux system.
Answer:
The equivalent of ipconfig command in Linux is ifconfig although you may need to use multiple commands to retrieve and configure network configuration in Linux. Here are some basic equivalent uses of ipconfig in linux:
Add a commentInstallation of Concrete5 CMS on Fedora Linux
Concrete5 is a CMS ( content management system ) which allows users to edit any page via editing toolbar and change its content or design without reading complicated manuals or navigating complex administration back-end.This article is a step-by-step installation guide of concrete5 CMS on Fedora linux using Apache webserver and mysql. There are no prerequisites required except a running RedHat/CentOS/Fedora Linux system and Internet connection.
Step 1: Install all prerequisites
# yum install httpd mysql-server php \ php-mysql php-gd
Step 2: Setup Apache
At this point you should have a Apache default /var/www/html directory ready. Otherwise follow these instructions on how to create a new VirtualHost, so you are able to run more websites on the same server. In this guide we will use/var/www/html directory as a root directory for Concrete5 installation.
Add a commentHow to Disable SElinux
Question:
Hi Lubos, is there a way to disable SElinux on my linux system?
Answer:
SElinux ( Security Enhanced Linux )may cause some problems during various software installations. Here are some quick tips on how to disable SElinux temporarily or permanently. I do not recommend to disable SElinux completely! However, disabling SElinux just temporarily may help in troubleshooting to narrow down all possible problems and to see whether the problems your are experiencing are related to SElinux.
Add a commentBackup permissions in linux
Here is a tip on how to backup file permissions in Linux using getfacl. This is very useful technique if you want to prevent someone or you to change file permissions of certain set of files or directories. By using a getfacl command we can take a snapshot of file permissions :
getfacl -R /var/www/myweb > permissions.acl
This will backup permissions of all files and directories within /var/www/myweb and myweb directory itself. -R ensures that the /var/www/myweb will be traversed recursively to include all files and directories.
Add a commentaria2 - all in one command line download tool
Many of as are using wget as a quick command line download tool to fetch data from the web using HTTP, HTTPS, and FTP. We usually pick download mirror closest to our location in hope for better download speed, start wget and hoping for the best. Aria2 download tool offers an alternative solution to wget with increased potential for greater download speed by downloading from more than one source in the single session.
Along the usual protocols supported by wget aria2 also offers download resume and additional download options using torrents, magnet URIs and metalinks. This article explores some aria2 download techniques which potentially could ease wget's work load.
Add a commentHow To install Drupal 7 on Fedora Linux
This installation guide provides step-by-step instructions on how to install Drupal 7 on a Fedora Linux system. The guide consists of 6 easy to follow steps to conclude whole installation. If you are just little bit curious about the new Drupal 7 release it is time to see what it is about. Be aware that installation of web applications on Linux systems using SELinux such as Fedora or RedHat is now little bit more complicated since changing permissions with chmod command may not always solve the problem. This guide could also be used by RedHat and CentOS Linux users.
Ubuntu users visit: Drupal 7 Installation guide for Ubuntu
Add a commentConfigure Apache VirtualHost on Fedora
If you decided to run more than one website on your Apache web server you would need to configure a VirtualHost based on the name or IP address. Here is some notes on how to achieve it. Here we assume that you have httpd package already installed on your system.
Add a commentMobile Broadband Internet connection and Sakis3G
This article is just a continuation of my first article about my experience with mobile broadband Internet on a Linux system. To cut the long story short a current network managers are trying to do a pretty good job by establishing a Mobile Broadband connection in a Plug & Play manner, however, they are not always successful to do so and user ends up with frustration and full hands of debugging and guessing what might went wrong instead of spending time with intended work.
Add a commentBash reverse counting with while loop
Question:
Hi,
I have a question for my bash scripting.
Can you help me by this script?
Thanks Chris
(Modify countdown such that it prompts user for a starting value, and counts down from there.
Write a script called countdown2 that accepts the initial value as a command-line argument. For example, the command and its output might look like the following.
Bash printf syntax basics
When writing a bash scripts most of us by default use echo command as means to print to standard output stream. echo is easy to use and mostly it fits our needs without any problem. However, with simplicity very often comes limitation. This is also the case with echo command. Formatting an echo command output can be a nightmare and very often impossible task to do.
The solution to this can be a good old friend of all C/C++ the “printf” tool. printf can be just as easily implemented into a bash script is it is used with C/C++ programs. This article describes some basics of printf along with practical examples:
Add a commentPage 3 of 9













