Thursday, February 27, 2014

Linux : Replace string in multiple files recursively

Hi,

If you want to search and replace specific string from multiple file recursively then below command is useful  for it :

Linux Command:
# grep -rl "string1" * -R | xargs sed -i 's/string1/string2/g'


Here above command is combination of  'grep' and 'sed', 
grep : Command will search for "string1" and returns file-name where string1 found

sed : will replace the "string1" to "string2"

string1 : old string
string2 : New string

You can watch the above process on youtube also...

http://youtu.be/GcopukZz3io

Friday, February 21, 2014

Hide User Names on the Login Screen in Ubuntu

Hi,

This is for to clean the login screen i.e. multiple users listing should not show on login screen.

It can be accomplish with some changes in LightDM desktop manager configuration.

It brings the new layer of security that any intruder should use right user account to login into your machine.

Steps to make changes it in LightDM desktop manager.

Step 1: Open lightdm.conf file i.e.
# vi /etc/lightdm/lightdm.conf

Step 2: Add below 2 lines in the lightdm.conf file

greeter-hide-users=true
allow-guest=false

Step 3: Above line will hide the user listing on login screen.

I hope above steps will helpful to enable the clear Login screen.


 


Ubuntu 12.04 Grub to boot into single user mode

Hi,

Steps to boot in single user mode in Ubuntu 12.04:

Step 1: When you start your system, press "shift" key continuously to get the grub loader screen.

Step 2: In Grub 2 menu, select the menu with Linux 3.2.0.23-generic-pae highlighted.

Step3: Press 'e' to edit the grub2 menu.

Step 4:  Move the cursor to the line that starts with "linux /boot/vmlinuz-3.2.0-23-generice-pae".

Step 5: Change the content "ro quiet spalsh $vt_handoff" To "rw init=/bin/bash".

Step 6: Press "Ctrl+x" to continue boot to in single user mode.

Step 7: Now you will get prompt of the root user.

Step 8: Change root user password,
# passwd root

Step 9: Now sync and reboot the system i.e.
# sync
# reboot -f

I hope, above steps are helpful to change the root user password in single user mode.