Hide Recycle Bin icon from Desktop in Windows XP

Even though there is options to hide and display My Computer, My Documents from Destkop, for some reason, Microsoft don’t provide any option to hide Recycle Bin icon from Desktop in Windows XP.

What if that little innocence Recycle Bin icon irritate you much? Do you want to get rid of it? Well, it’s easy! Just follow these steps:

If you are using the classic Windows XP Start Menu :

  • 1. Go to Start Menu –> Run
  • 2. Type regedit.exe
  • 3. Navigate to the following path from the left column: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu
  • 4. In the right column, right click –> New –> DWORD

reg_hide_recycle_bin_1

  • 5. Then enter the following string without quotes “{645FF040-5081-101B-9F08-00AA002F954E}”

reg_hide_recycle_bin_2

  • 6. After that double-click on that Name and set the Value to 1.

reg_hide_recycle_bin_3

  • 7. You should see something similar to the following screenshot.

reg_hide_recycle_bin_4

If you are using the standard Windows XP Start Menu, repeat the steps 1-7 except in step 3, navigate to

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel

Once you’ve done the above, you can go to Desktop, right-click and refresh. Recycle Bin icon will be gone. What if you want it back? Well, just set the above two Reg values to 0.

 

Source : Microsoft KB

How to check which programs from your PC are connecting to which servers on the internet

Have you ever wonder which program on your PC are currently connected to the internet? Well, you don’t even need to install any new program to figure that out.

Windows XP and above have already got the built-in command line program called netstat, which can give you a lot of useful network related information. Just follow these steps:

  • Start Menu –> Run –> cmd
  • Type : netstat –b, for me I got the output like :

TCP LT-SV505:4661 65.55.57.252:http ESTABLISHED 4760
[chrome.exe]

TCP LT-SV505:3091 ip-167-34-219-155.ip.secureserver.net:23396 ESTABLISHED 4388
[Skype.exe]

From the output, I can know that currently Skype and Chrome are connecting to the internet from my PC. But remember, netstat command will give you a lot of other system processes that are connected to the internet as well. Make sure you Google each process name before ringing any alarm bell.

Source : Microsoft Product Documentation

Simple ls command to list only files

I’ve been looking for ls option to hide directory. Most people has suggested me quite complicated commands. Finally, after scrolling through manual page for ls and a few trials and errors, I’ve found the really very simple command for this simple task.

Here it is. You just need to ignore “/” from ls output.

ls | grep -v "/"

I hope this would help you with your task too.

How to add users into sudoers

First of all, you need to have sudo package installed. You can check if your system have by typing visudo command.

root@SUNNYVALE-133:~# visudo
-su: /usr/sbin/visudo: No such file or directory

If you receive the above error, that means you don’t have sudo module. You can install by typing the following command:

root@SUNNYVALE-133:~# apt-get install sudo

Once you’ve got sudo package installed, you can add users to sudoers file. The following is my sample config.

  • First type visudo command
  • The add the following line under root ALL=(ALL) ALL line
    mysampleuser ALL = (ALL) ALL, NOPASSWD: ALL

That’s it! From now on, you can simple type sudo su – whenever you want to become root from your own username.

Source : Debian Wiki

How to disable Automatic Updates restart prompt

If you are using Windows XP with Automatic Updates on, you’ll be quite familiar with the dialog box below.

automatic_updates_restart_prompt

It becomes very annoying when you are really busy and the dialog box keeps on coming back. Well, finally I’ve got the easiest solution to get rid of it.

Just go to Start menu –> Run, type services.msc.

You’ll see the following window and right-click on Automatic Updates, choose stop as follow:

services_stop

Right after you clicked “Stop”, the annoying “Do you want to restart your computer now?” dialog box will go away altogether with the system tray icon. Now you can focus on your work undisturbed.

Please note that you can only do this if you’ve administrative rights on your computer. This is not recommended for your company’s computer. Disabling automatic updates may cause security risks for your computer. Hence, proceed only at your own risk.

Source : Microsoft Answers

How to renew dhcp lease in Linux

I’ve tried this command on Debian/Ubuntu, but since dhcpclient is the universal across all distros, I expect this to work on all *.nix variants.

First thing to take note is if you are ssh to the server, you should be careful before executing the commands.

sudo dhclient –r

The above command will cause all network adapters to release DHCP lease. So if you are ssh through one of the DHCP interface, you’ll get disconnected and unless you’ve physical or console access, there is no way to bring it back.

So I’ve come up with nice commands that you can use even if you don’t have console or physical access to the server. But you should be able to ssh to the host by using hostname in case DHCP server lease a new different IP addresses. If DHCP server responded with the same IP address, you won’t even get disconnect from ssh session.

sudo dhclient -r; sudo killall -9 dhclient

That’s the command I’ve used frequently and very convenient for me.

Source : Ubuntu Manpages

Change hostname in Ubuntu or Debian

If you’ve changed your mind about your Linux hostname or you’ve set to wrong hostname, here is how to fix it.

Firstly, I’ve tried the following command:

$sudo hostname mybrandnewname

But this will revert back to prior hostname whenever the machine reboots. So how can you change it permanently? First you’ll need to edit /etc/hostname file

$sudo vi /etc/hostname Then delete the old name and type whatevername you desire

It is also advisable to change new hostname in /etc/hosts file

Source : UbuntuManual

How to add new user and grant permission?

Once you’ve got your new favourite Linux distro installed, you’ll need to add users and grant permission as per your organization requirement.

The steps are very simple and straightforward.

sudo adduser

If you want to grant a user to all permissions as root, you should add that user to admin group. For example :

sudo adduser jason admin

Make sure the line “%admin ALL=(ALL) ALL” is present in the /etc/sudoers. The below is the screenshot of sample config file.

sudoers_screenshot

After that you might want to set specific password for the new user. You can do this by using the following command:

sudo passwd

Source : AskUbuntu

How to config ubuntu/debian to boot in text mode

I like Linux boxes to boot directly to terminal mode. If you’ve just moved to Ubuntu distro from Red Hat/ Fedora, you’ll think about changing the inittab. Well, bad news is in Debain or any of its derivatives, runlevels 2 to 5 are the same multi-user with display GUI. So if you type, sudo init 3, nothing will happen.

So here is how I make Ubuntu to boot into text mode by default. The requirement for this is you have to use grub as boot loader.

Just edit the /etc/default/grub using any of your favourite text editor, look for the line

GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash”

Then changed it to

GRUB_CMDLINE_LINUX_DEFAULT=”text”

The following is the screenshot for what my grub file looks like after the changes.

grub_ubuntu_screenshot

After that save the file and run sudo update-grub. That’s it. Starting from next reboot, your ubuntu/debian variants will start in text mode.

Source : UbuntuForums

How to reverse a string using sed

I had got issue with having to reverse a string of number manually. Of course, that gave me a big headache. Thanks to Peter from Catonmat, I’ve got the following sed script.

'/\n/!G;s/\(.\)\(.*\n\)/&\2\1/;//D;s/.//'

As you can imagine, this is quite complicated, but luckily he’s given nice explanation as well.


sed ‘

/n/ !G

s/(.)(.*n)/&21/

//D

s/.// ‘

The first line “/n/ !G” appends a newline to the end of the pattern space if there was none.

The second line “s/(.)(.*n)/&21/” is a simple s/// expression which groups the first character as 1 and all the others as 2. Then it replaces the whole matched string with “&21″, where “&” is the whole matched text (“12″). For example, if the input string is “1234″ then after the s/// expression, it becomes “1234n234n1″.

The third line is “//D”. This statement is the key in this one-liner. An empty pattern // matches the last existing regex, so it’s exactly the same as: /(.)(.*n)/D. The “D” command deletes from the start of the input till the first newline and then resumes editing with first command in script. It creates a loop. As long as /(.)(.*n)/ is satisfied, sed will resume all previous operations. After several loops, the text in the pattern space becomes “n4321″. Then /(.)(.*n)/ fails and sed goes to the next command.

The fourth line “s/.//” removes the first character in the pattern space which is the newline char. The contents in pattern space becomes “4321″ — reverse of “1234″.

But what I want is the output to be separated by “.” aka dot character. So here’s what I come up with.

$ echo 123456789 | sed '/\n/!G;s/\(.\)\(.*\n\)/&\2.\1/;//D;s/.//'

.9.8.7.6.5.4.3.2.1

Still there’s one small issue, I don’t want dot at the start of the string. So after reading his explanation, I realize that I need to put one more “.” to be replaced at the fourth line. This is final script.

$ echo 123456789 | sed '/\n/!G;s/\(.\)\(.*\n\)/&\2.\1/;//D;s/..//' 

9.8.7.6.5.4.3.2.1

So obviously, if you want “,” aka comma instead of dot, you can just substitute it. If you are curious about getting to know sed, why don’t you head over to catonmat.net. That site got so many cool sed one liners.

Source : Catonmat