Install Webmin on Ubuntu 14.04

Webmin is an open source, web based system administration tool for Unix/Linux. Using Webmin, you can setup and configure all services such as DNS, DHCP, Apache, NFS, and Samba etc via any modern web browsers. So, you don’t have to remember all commands or edit any configuration files manually.
Install Webmin On Ubuntu 14.04 LTS using official repository

Add the webmin official repository:

Edit file /etc/apt/sources.list

sudo vi /etc/apt/sources.list

Add the following lines:

deb http://download.webmin.com/download/repository sarge contrib
deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib

Add the GPG key:

sudo wget http://www.webmin.com/jcameron-key.asc
sudo apt-key add jcameron-key.asc

Update the sources list:

sudo apt-get update

Install webmin using the following command:

sudo apt-get install webmin

Allow the webmin default port “10000” via firewall, if you want to access the webmin console from a remote system.

sudo ufw allow 10000

Access Webmin console

Open up your browser and navigate to the URL https://ip-address:10000/. The following screen should appear. Enter the user name and password to log in to webmin console.

How to combine all .vcf files to single .vcf file using cmd

In general to export your phone contacts/or to import them from one device to another device we use the “VCARD” feature. By using this feature you can back up our phones contacts to vCards (.vcf files) are very important part of our life because we all are using some kind of mobiles, smart phones, PDA devices, iPhones, Tablets plus our online email accounts. In general after Vcard conversion all contacts are converted into individual (vcf) files. If we want import over 200 contacts from Outlook/Exchange/mobile vcard into Google Contacts, with their photos we can convert multiple .vcf files into a single vcf files by using COMMAND prompt.

Steps to Bulk Import (Merge/combine) vCards into One Contact List (single .vcf file).
Step 1. First Copy all your vcf files into one Folder/directory.
Step 2. Open Windows command prompt (Windows + R), then type “CMD” to open command prompt and navigate to the destination folder where all your contact files are stored (you can type CD YOUR PATH command to reach to your destination).
Ex: You have copied your vcf files in folder named “contacts” then in command prompt type in the path of that folder.
Step 3. Enter the following DOS command: copy *.vcf all-contacts.vcf
all-contacts
Step 4. Now you will get all your .vcf files merged into single .vcf file, just Import the created single .vcf file whenever required. This single vCard file will also work on your Google account.

How to find a particular text string in Linux

You need to use the grep command. The grep command searches the given input FILEs for lines containing a match or a text string.

grep command syntax

The syntax is:

grep "text string to search" directory-path

or

grep [option] "text string to search" directory-path

or

grep -r "text string to search" directory-path

or

grep -r -H "text string to search" directory-path

or

egrep -R "word-1|word-2" directory-path

or

egrep -w -R "word-1|word-2" directory-path

How to measure actual memory usage of an application or process?

How do you measure the memory usage of an application or process in Linux as ps is not an accurate tool to use for this intent.

Why ps is “wrong”?

Depending on how you look at it, ps is not reporting the real memory usage of processes. What it is really doing is showing how much real memory each process would take up if it were the only process running. Of course, a typical Linux machine has several dozen processes running at any given time, which means that the VSZ and RSS numbers reported by ps are almost definitely “wrong”.

With ps or similar tools you will only get the amount of memory pages allocated by that process. This number is correct, but:

  • does not reflect the actual amount of memory used by the application, only the amount of memory reserved for it
  • can be misleading if pages are shared, for example by several threads or by using dynamically linked libraries

If you really want to know what amount of memory your application actually uses, you need to run it within a profiler. For example, valgrind can give you insights about the amount of memory used, and, more importantly, about possible memory leaks in your program.

Setting locale to en_US.UTF-8 failed

While trying to install Owncloud I encountered the following error:
Setting locale to en_US.UTF-8/fr_FR.UTF-8/es_ES.UTF-8/de_DE.UTF-8/ru_RU.UTF-8/pt_BR.UTF-8/it_IT.UTF-8/ja_JP.UTF-8/zh_CN.UTF-8 failed

Please install one of theses locales on your system and restart your webserver.
For Debian Linux the solution is very simple, just run the following command:
dpkg-reconfigure locales
And mark at least one of the locales you need.

How to resolve the ‘/bin/rm: Argument list too long’ error

While you are deleting some files which fill up your disk you may hit -bash: /bin/rm: Argument list too long error message.

So you can use below syntax to can delete those files:
# find . -name "DIR_PATH/*" -type f -exec rm -f {} \;
or:
# find DIR_PATH -name "*" -type f -exec rm -f {} \;

You can also delete files with a specific extension (ex.: .php):
# find DIR_PATH -name "*.php" -type f -exec rm -f {} \;
or:
# find . -name "DIR_PATH/*.php" -type f -exec rm -f {} \;

PS: In our case DIR_PATH=/var/spool/postfix/maildrop (there are like a half million files in that directory).

How to find the number of files on a filesystem?

For some reason df -h command shows that you have plenty of free space. However your apps keep telling you that you don’t have enough free space. The following will help you identify the problem.

The –inodes option to df will tell you how many inodes are reserved for use. For example:
df --inodes /
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/mapper/root
989296 977987 11309 99% /
find / -xdev -print | wc -l
859714

Notice that the number of entries returned from find is lower than IUsed for the root (/) filesystem.

Remember that directories, symlinks, UNIX domain sockets and named pipes are all ‘files’ as it relates to the filesystem. So using find -type f flag is wildly inaccurate, from a statistical viewpoint.