Useful Linux Commands

Delete all files with given extension recursively:

find . -name "*.dll" -print0 | xargs -0 rm -rf

Find the number of .jpg file in the current folder and all sub-folder recursively:

find . -name "*.jpg" -print | wc -l

Move all .m2ts files to /mnt/backup/m2ts folder:

find . -iname "*.m2ts" -type f | xargs -I '{}' mv {} /mnt/backup/m2ts

Install GUI on Ubuntu Server

sudo apt-get upgrade
sudo apt-get install ubuntu-desktop

Find out the disk usage

df -h

You can free up some space in /boot by removing old kernel with:

sudo apt-get purge $(dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve "$(uname -r | sed -r 's/-[a-z]+//')")

according this post

Search for a string in all text files:

find folder_name -name '*.txt' -exec grep -i 'text-to-search-for' {} \; -print

Search for all .jpg files modified (taken) in the last year and move them to another folder:

find . -iname "*.jpg" -mtime -365 -print -type f | xargs -I '{}' mv {} /mnt/backup/jpg_last_year

Delete .jpg files older than 1 year:

find . -iname "*.jpg" -mtime +365 -print -type f | xargs -I '{}' rm {}

Delete .jpg images smaller than 500KB

find /mnt/backup/_wd3 -iname "*.jpg" -size -500k -delete

Move all .jpg files modified in 2013 to a separate folder:

find . -iname "*.jpg" -newermt "2013-01-01" ! -newermt "2013-12-31" | xargs -I '{}' mv {} /mnt/tank/common/multimedia/pictures/jpg_3/2013

You don’t currently have permission to access this folder

Recently I had to rescue a data from NTFS partition for somebody. It was a totally messed up laptop that could not boot the OS. It comes with a hidden partition from which you can restore the system and in theory to preserve the existing user data.

I did not want to take any risks though. Instead I removed the disk and put it in a USB 3.0 enclosure and connected it to my laptop in hope I can copy the data. Although I was able to see the folder structure and open some folders there were many I could not access. I was getting pop-up saying “You don’t currently have permission to access this folder.”

Luckily I was able to find a solution on Clint Boessen’s Blog.

There are 3 settings in the Local Security Policy related to the problem:

User Account Control: Admin Approval Mode for the Built-in Administrator account - Disabled
User Account Control: Behaviour of the elevation prompt for administrators in Admin Approval Mode - Elevate without prompting
User Account Control: Run all administrators in Admin Approval Mode - Disabled

The correct settings are in bold.

In my case the first two had the correct settings already but I had to change the last one which solved the problem – I was able to copy the data to a backup location.

HTTP Error 503. The service is unavailable

I recently had a problem with IIS on Windows 7 where trying to access http://localhost on the default port 80 was giving me an error:

“HTTP Error 503. The service is unavailable”

I spent several hours trying to find the cause and trying different things without any success.
Finally I came across this post that helped me resolve the problem.

The root cause was an URL Reservation http://+:80/

To remove the reservation type the following in a command prompt (but first read the post to know what your are doing):


netsh http delete urlacl http://+:80/

Samsung ATIV Book 6 – Windows 8.1 Drivers

I finally got a new laptop with US-only keyboard. It is a big deal for many people living in Canada because 95% of the laptops sold in the retailer shops have bilingual keyboards.

I bought a nice Samsung ATIV Book 6 from http://www.adorama.com/ via Amazon. Adorama ship to Canada (thank god!).

The computer comes pre-installed with Windows 8. Since Windows 8.1 is available I decided to give it a try. I wanted to do a fresh install vs. upgrade. Since the laptop does not have an optical drive you need to burn the Windows 8.1 ISO file to USB drive and boot the installation from there. I also used the opportunity to upgrade the standard hard drive to SSD following this video (although it is for a different model).

Everything went smooth and I got a freshly installed Windows 8.1. The next step was to make sure I have all the latest drivers. I went to the Samsung’s web site, provided my laptop’s model just to find that there were no drivers available for download:

samsung

It took me some time to figure it out. If you click the “Use Our Interactive Tool To Fix Common Problems.” and try to “fix” a specific problem eventually you will see a link that allows you to download “SW Update”:

samsung2

Here is a link to SW Update as of the moment.

Install it, type in your laptop’s model, choose the version of the Windows and it will show you the list of available drivers. You can choose to download them or you can install them – individually or all at once:

samsung3

I am hoping this might help someone and save them time.

————————————————————————-
EDIT: Just found this: Update to the new Windows. If you click “Firmware and Drivers” it will download the SW Update. It is newer version (2.1.21.0) vs. the link above (2.1.6.45)

Google Chrome looks blurry in Windows 8.1

Recently I bought a new laptop with screen resolution of 1920 x 1080. It has Windows 8.1 on it. At some point I noticed that Google Chrome looked a bit blurry – both the browser UI and the web page displayed. I thought the problem was with the display driver but even after installing the latest version the problem was not fixed.

It turns out the browser was doing “display scaling” because o the high display resolution. It is a setting that you can change. Right-click the Google Chrome icon and select Options:

Google Chrome Properties 1

Google Chrome Properties 2

By default the “Disable display scaling on high DPI settings” is not checked. If you check it the blurriness will go away.

Here is a screen-shot of a blurry screen:

before

This is a screen-shot with the check-box checked:

after

Both images have the same resolution 1016 x 368 pixels. Because the first screen-shot uses scaling things look bigger and blurrier. Less information is displayed. The second picture shows much more content but it looks smaller and sharper. If the font is hard to read you can always use the browser zoom in functionality (Ctrl +) to make the text bigger.

Photo Stitching

How many times have you wished you could share the beautiful scenery of a waterfall or a picturesque mountain range in the fall with your friends? Yes, you can take a picture and share it on Facebook but even with the best digital camera you can capture just a fraction of what you see. The camera does not have the angle of view a human eyes have.

One solution is to take a panoramic picture. Many cameras have this function built-in. Alternatively you can take several pictures manually and stitch it later using a software on you computer. I have used several different programs in the past but recently came across one from Microsoft which is really easy to use and it is free.

The program is called Image Composite Editor. You can download the version for Windows XP, Windows Vista and Windows 7 or the one for Windows 8.

You can also share your panorama pictures with friends and viewed in 3D by uploading it to the Photosynth