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

OS X Mountain Lion

Show hidden files Mac OS X 10.8 Mountain Lion

NOTE: If the following command didn’t work, just simply change TRUE/FALSE to…

NOTE: If the following command didn’t work, just simply change TRUE/FALSE to YES/NO.

To enable hidden files/folders in finder windows:

  1. Open Finder
  2. Open the Utilities folder
  3. Open a terminal window
  4. Copy and paste the following line in:
    defaults write com.apple.finder AppleShowAllFiles TRUE
  5. Press return
  6. Now hold ‘alt’ on the keyboard and right click on the Finder icon
  7. Click on Relaunch
You should find you will now be able to see any hidden files or folders. One you are done, perform the steps above however, replace the terminal command in step 4 with:
defaults write com.apple.finder AppleShowAllFiles FALSE
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.