Search for content in files in linux (recursively and case-independent)

Email this to someoneShare on Google+Share on FacebookTweet about this on TwitterShare on LinkedIn

Problem

You would like to find the files that contain some specific text, and would like to do it recursively (ie in a project folder), using something simpler than the find command.

Solution

You can use the following in your current top folder to search recursively, case-independent and by displaying the file number that the searched text appears, with the following:

Errors were encountered while processing: linux-image-3.13.0-128-generic

Email this to someoneShare on Google+Share on FacebookTweet about this on TwitterShare on LinkedIn

Problem

You are trying to install/remove a package but you always get an error message about linux message as above:

Solution

Try the following:

Bash script using default value for empty parameter

Email this to someoneShare on Google+Share on FacebookTweet about this on TwitterShare on LinkedIn

Problem

You have a bash script that accepts parameter(s) but you want to give a default value for a missing parameter.

Solution

For example you have a script that accepts a parameter with the year and month (ie 201703), but you want to give it a default of two months ago if the parameter is missing.

Docker – Debian – Kernel panick – Automatic restart

Email this to someoneShare on Google+Share on FacebookTweet about this on TwitterShare on LinkedIn

Problem

You have a remote server (Debian) running some Docker containers and you want to make sure that they all restart in the event of a kernel panick.

solution

  • Add an automatic restart after a kernel panick by running:

  • Emulate a kernel panick by running the following (SysRq more info here :

  • Check that the containers have restarted again with docker ps (NOTE: the containers should have been enabled to autorestart)

failed to execute ‘/lib/udev/socket:@/org/freedesktop/hal/udev_event’ ‘socket:@/org/freedesktop/hal/udev_event’

Email this to someoneShare on Google+Share on FacebookTweet about this on TwitterShare on LinkedIn

Problem

Looking at your /var/log/syslog you see entries every few seconds like the following:

Solution

Seems that hal is not used in newer Ubuntu versions, so you can remove it:

Taken from the answer here

Changing default editor for crontab from nano to vim

Email this to someoneShare on Google+Share on FacebookTweet about this on TwitterShare on LinkedIn

Problem

You would like to change the default editor for crontab from nano to vim.

Solution

Add the following to the ~/.selected_editor:

or run the select-editor and choose vim-basic (4)