Subscribe

Subscribe

Vladstudio

10 Useful VI commands

Here are a few VI commands that I use allot and find very useful.
Once in command mode (by pressing ESC) enter:

:wq
To Save or Write and document and quit VI

:w
To save the document

:q!
To quite the document WITHOUT saving.

J
Capital J will join next line down on to the end of your current line.

G
Capital Go will take you [...]

Remove the recycle bin from the XP desktop

If you like a really clean desktop you can easily remove all the icons from the desktop, except the Recycle Bin. It is a bit trickier to remove. Assuming you have full admin rights to you XP machine, here is how.

Click Start then Run
Type GPEDIT.MSC and press enter
Expand the Administrative Templates branch under User [...]

Changing the behaviour of the power button is Vista

By default in Windows Vista the “Power Button” on the start menu is set to hibernate.
If you want to change it to power off instead, you need to do this:

Click Start then Control Panel
Click Additional Options
Click on System and Maintenance on the left
Click on Power Options
Click on Change plan settings for the currently select power [...]

Using case and foreach in CSH

Here is a simple example of how to use a case and foreach statement in the C shell.

#!/usr/bin/csh

foreach SERVER (`cat hosts.list`)
switch ($SERVER)
case “server1″:
case “server2″:
echo “NOT shutting down ” $SERVER
breaksw
default:
echo Shutting down $SERVER…
/usr/bin/ssh $SERVER init 5
endsw
end

This script will shutdown all servers listed in the file hosts.list, except [...]

Configuring the BASH shell

You first need to edit/create a .bash_profile file in your home directory. Note the . at the start of the filename.
Put the following code into the file.

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
BASH_ENV=$HOME/.bashrc

You also need to create a .bashrc file. Again in your home folder and again, note the . [...]