Category Archives: Tips & Tricks

Find and replace in Nano

Q: How to find and replace a string in Nano?

A: The answer is straightforward, while you are in Nano,

  1. Press Ctrl+\. Notice that a box appears in the bottom of the window
  2. Then type the string you are trying to find and press Enter
  3. Then type the string you want to replace and press Enter
  4. At this point Nano jumps to the first instance of what you are looking for and shows you a set of shortcuts to go and find one by one, by pressing y for accepting and n for skipping, or replace all by pressing a

Continue reading Find and replace in Nano

Save file/folder structure including permissions

It has always been a great concern to keep track of folder permissions since most of the lame errors in Linux are due to a permission denial by the system, and sysadmins should change some permissions from time to time to fix things. At this point having a good record of what has been changed is vital since in terminal there is no undo or Ctrl+z and you should keep track of what you are doing to reverse the change and correct the mistakes.

In this post I briefly want to present some lines of code that can help you keep track.

Continue reading Save file/folder structure including permissions

Have spotlight search in KDE

The first few sentences are just my personal experience, so you can skip it and move on to the next part (Starting the configurations).

Some small complains about Ubuntu 14.04 LTS !

I Started using KDE for my Ubuntu system (since Unity was causing lot’s of system crash and reboots). Everything about KDE is OK and smooth, with 32GB RAM and Intel core i7 vPro 3.4GHz 8MB, and I’m having lots of fun working around and it increases my productivity, but I also missed the spotlight search of my MacBook. also KDE does not have good shortcuts for their plasma system and for example you can not use a windows key on your keyboard to open the application launcher! so I tried to find an easy way not to use mouse for opening my application. So here is a way to have spotlight search in KDE:

Start the configuration

Before everything I should say that I’m not going to install any application or write some weird shell, I’m going to sue the KDE settings in few clicks.
So let’s get to business:

Continue reading Have spotlight search in KDE

Generate & Compare MD5, SHA1 for Files and Strings in Terminal

Most of the times when you download a file from internet, you will see a checksum or MD5 hash tag beside the download link so you can compare the checksum of the downloaded file with the original file. There are several security reasons for that, but the most common one is to eliminate the possibility of a special type of hacking called “Man in the middle”. In this type of hacking, the hacker usually sniffs and listens to the requests goes from your computer and tries to compromise the packets, but the best thing you can do to help the hacker is to request a very popular application that he has already prepared an infected version, so when you want to download the file, he will send his own infected version toward your computer and you will install that application, thinking that it is the original malware-free application !! so after installing the application, the hacker can do variety of dangerous things to your computer such as creating a backdoor, key-logging, screen capturing, infecting the entire trusted network and etc.

The only way you can avoid this type of hack is by checking the checksums. there are few awesome, useful and easy commands that can do this checking for you and I’m going to describe them in this article:

Continue reading Generate & Compare MD5, SHA1 for Files and Strings in Terminal

Find and replace a string in entire mysql database

Most of the time when you want to copy a website for another use or even when you are changing your URL, you face this problem that you should search for the old URL among all records of database and then replace it with new one.

There are many ways and many scripts designed for this issue and each has a disadvantage.

I faced this problem and tested few of these ways but they are mostly causing more problem, specially when you have too many tables and too many columns. So I found the following way and it worked like charm:

Continue reading Find and replace a string in entire mysql database