Jan 012011
 

From the command line enter the following to install uuencode/uudecode on Fedora Linux: yum -y install sharutils

Email a file named datafile.tar.gz:

Type uuencode command as follows:

$ uuencode datafile.tar.gz datafile.tar.gz | mailx -s “My Data File” user@yourcorp.com

The file name “datafile.tar.gz” appears twice on the uuencode command line. There must be two names. The second one is the name of the file when it is decoded.

Email a photo along with a text message:

Type the command as follows;

$ (cat information.txt; uuencode photo.jpg photo.jpg) | mail -s “Subject” user@domain.com

Email multiple attachments in a single email:

Type the command as follows:

$ uuencode r1.tar.gz r1.tar.gz > /tmp/mailfile.out

$ uuencode r2.tar.gz r2.tar.gz >> /tmp/mailfile.out

$ uuencode r3.tar.gz r3.tar.gz >> /tmp/mailfile.out

$ cat email-body.txt >> /tmp/mailfile.out

$ mail -s “Multiple Files” user@domain.com < /tmp/mailfile.out

Here is a function that I created to uue a file then mail it to a recipient. To use it all you have to do is paste this function in your .profile then reload your profile. At the command prompt type: UUE filename.xxx person@example.com

#uue a file then email it.
UUE() {
if [ $# -eq 0 ]
then
echo Usage: UUE filename.xxx person@example.com
else
uuencode $1 $1 | mailx -s “$1” $2
fi
}

To uudecode a file simply type: uudecode filename

Jun 242010
 

Before we get started with the commands you may not have heard of before, here’s a tried and true Unix command that we’ve all been using for decades, but maybe not this particular way. This grep command represents the simplest way to remove blank lines from a file.

grep . oldfile > newfile

Got that? It matches any lines with anything (i.e., not nothing) in them and tosses them into the second file. Hey, this is even easier than my old “grep -v ^$ oldfile > newfile” command that would specifically omit empty lines from the new file
Another interesting command is called “tac”. Yes, that’s “cat” spelled backwards. And what would you expect such a command to do? It displays a file in reverse order — upside down. So, our a, b, c, x, a, b, c file shows as:

$ tac myfile
c
b
a
x
c
b
a
Apr 152010
 

Q. How do I clear the mysql command line history stored in ~/.mysql_history file?

A. mysql is a simple SQL shell. It supports interactive and non-interactive use.

On Unix and Linux, the mysql client writes a record of executed statements to a history file. By default, the history file is named .mysql_history and is created in your home directory. To specify a different file, set the value of the MYSQL_HISTFILE environment variable.

Task: CLEAR MYSQL COMMAND LINE HISTORY

Remove ~/.mysql_history by typing following command:
$ > ~/.mysql_history

If you do not want to maintain a history file, first remove .mysql_history if it exists, and then use either of the following techniques:

Set the MYSQL_HISTFILE variable to /dev/null. To cause this setting to take effect each time you log in, put the setting in one of your shell’s startup files.

Create ~/.mysql_history as a symbolic link to /dev/null. You need run following command only once:
$ rm $HOME/.mysql_history
$ ln -s /dev/null $HOME/.mysql_history

Mar 042010
 

Turn on AutoComplete at the Command Prompt
 1. Log on as Administrator,
 2. Click Start, and then click Run,
 3. Type Regedit and OK,
 4. Double click HKEY_LOCAL_MACHINE,
 5. Double click SOFTWARE,
 6. Double click Microsoft,
 7. Double click Command Processor,
 8. In the right pane of Regedit, double click the ‘CompletionChar’ DWORD value,
 9. Type 9 click OK,
 10. Close Regedit,
 11. Open the command prompt and test try it out.

Another method is to create a file with the neccessary registry value and enter it into the registry by double-clicking on the file. Open up notepad and paste the following into the window and save it as AutoComplete.reg. When you are finished, double-click on the file to enter it into the registry.

REGEDIT4

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor]
“CompletionChar”=dword:00000009

Feb 122010
 

XP Power Toys

Power Calculator PowerToy

Alt-Tab Replacement Task Switcher PowerToy

Command Here PowerToy

HTML Slide Show PowerToy

Image Resizer PowerToy

Microsoft Remote Desktop Command Line Interface

Power Calculator PowerToy

Slideshow PowerToy

Magnifier PowerToy

TweakUI PowerToy

Virtual Desktop Manager PowerToy

WebCam Timershot PowerToy

Windows 7 Command Here

By holding shift and right-clicking a folder, you’ll see additional commands not listed on the standard menu, such as open in new process, copy as path, and open command window here. Suppose you need a command window with elevated privileges. Then what?

In Windows Vista, it could be done through the start menu by typing cmd into the search box and holding shift+control and hitting enter. This works in Windows 7 as well.

Combine the two, and you’ve got a right-click elevated command window shortcut: shfit+control+right click on a folder and choose open command window. Check your title bar: if it starts with Administrator, you’re set!