Linux

Delete All base on filename extension in folder and subfolders

Using Terminal and Find command. find . -iname ‘*.jpg’ -type f -exec…

Using Terminal and Find command.

find . -iname '*.jpg' -type f -exec rm -f {} \;

This command starts in the current directory, recursing through the entire subtree, looking for files only that end with ‘.jpg’. It will delete any such files.

find – the find program
. – search the subtree starting in the current directory
-iname ‘*.jpg’ – find all elements that match the shell pattern ‘*.jpg’. This should be done case-INsensitively
-type f – only match files
-exec rm -f {} \; – execute the command “rm -f {}” for each matched file, where ‘{}’ is replaced with the name of the matched file.

Also adding an -delete it should do the same.

find /yourdirectory -iname '*.jpg' -delete

Linux Malware Detect

Installing Linux Malware Detect on CentOS 6

I’m going to show you in few step how to install the…

I’m going to show you in few step how to install the LMD on your linux server.

What is Malware? well, Malware is short for malicious software, such as a virus, which is specifically designed to disrupt or damage your computer system.

What is LMD? Linux Malware Detect (LMD) is an open-source malware scanner that runs under various flavours of Linux, distributed under the GPL2 license.

Downloading LMD:

You can either use your user home directory or tmp folder for installation files.

cd ~

wget http://www.rfxn.com/downloads/maldetect-current.tar.gz

Installing LMD

tar xfz maldetect-current.tar.gz

cd maldetect-*

./install.sh

The first command unpacks the archive.  The second changes the folder to the unpacked archive and the third command runs the install script. You may come across a “permission denied” message when running the install script. If this happens do the following

Postfix Mail

How to send mails in POSTFIX through external SMTP

This short guide shows how you can set up Postfix to relay…

Postfix Mail
Postfix Mail

This short guide shows how you can set up Postfix to relay emails through another mailserver. This can be useful if you run a Postfix mailserver in your local network and have a dynamic IP address because most dynamic IP addresses are blacklisted today. By relaying your emails through another mailserver that is hosted on a static IP address in a data center (e.g. your ISP’s mailserver) you can prevent your emails from being categorized as spam.

First step, you will need to make changes in your configuration file (in standard postfix configuration it would be /etc/postfix/main.cf). You need to add at the end of configuration file following lines:

I’m going to use Nano editor to edit my configuration file.

nano /etc/postfix/main.cf

Configuration

Server

Backup & Restoring Tips for Large Files in Plesk 11.0.9

When it comes to Plesk Backup Manger there are few things that…

When it comes to Plesk Backup Manger there are few things that you might need to configure in order to backup large files successfully.

For backing up, Plesk stores backups in “/usr/local/psa/PMM/tmp” and in most dedicated servers, you have limited amount of space in this directory so we are going to create a symbolic link from “/var/lib/psa/tmp” to “/usr/local/psa/PMM/tmp”.

1. Stop psa by using the following command.

/etc/init.d/psa stop

2. Make tmp directory

mkdir /var/lib/psa/tmp

3. Set permissions
chown psaadm:psaadm /var/lib/psa/tmp
chmod 755 /var/lib/psa/tmp

4. Remove tmp from PMM directory

rm -R /usr/local/psa/PMM/tmp

Server

How to Use the vi Editor

This help note explains the basics of vi: opening and closing a…

This help note explains the basics of vi:

  • opening and closing a file
  • moving around in a file
  • elementary editing

vi has many other commands and options not described here. The following resources can help you get started using the vi editor, and are available at the UW University Book Store:

  • “vi Tutorial.” Specialized Systems Consultants (SSC).
  • “vi Reference.” Specialized Systems Consultants (SSC).
  • “Learning the vi Editor.” Linda Lamb, 1990.

Starting vi

You may use vi to open an already existing file by typing

      vi filename

where “filename” is the name of the existing file. If the file is not in your current directory, you must use the full pathname.

Or you may create a new file by typing

      vi newname

where “newname” is the name you wish to give the new file.

Server

FIX: Plesk and Sendmail Problem PHP

From the command line, enter this below. /usr/local/psa/bin/domain -u yourdomain.com -mail_service false…

From the command line, enter this below.

/usr/local/psa/bin/domain -u yourdomain.com -mail_service false

You do not need to restart the server. This tells Plesk to not use the mail server to send mail for that domain. It will then go through the correct MX entry for the domain and send it to an external domain. Specially for those who use Google Apps on Plesk.

You will need to do this for every domain hosted on the server.

Server

Configure RPMforge Repository on CentOS

Open the RPMforge configuration file /etc/yum.repos.d/rpmforge.repo Add the following text to the…

  1. Open the RPMforge configuration file
    /etc/yum.repos.d/rpmforge.repo
  2. Add the following text to the end of the RPMForge repository entry
    priority=3
  3. Check that you got the priorities set correctly
    yum check-update
    You should output similar to the following:
    Loaded plugins: fastestmirror, priorities

    469 packages excluded due to repository priority protections
Linux

Installing rar/unrar On CentOS 6

Open up ssh client and connect to the server as root user.…

Open up ssh client and connect to the server as root user.

For 32bit:
wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i386.rpm

For 64bit:
wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm

Install DAG’s GPG key:
rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt

If you get an error message like the following the key has already been imported:
[error]error: http://apt.sw.be/RPM-GPG-KEY.dag.txt: key 1 import failed.[/error]