Blog Posts
CLI workaround for Windows XP : Using LIST (LESS-Like)
Shell Tips
October 21, 2006 | COMMENTS

In our list of "CLI workaround for Windows XP", a missing command is LESS. Now, you can have a LESS-Like command with the DOS command LIST. Get the [Windows Server 2003 Resource Kit tools][1] on While not 100% functionally-equivalent to most versions of the UNIX LESS command, list does support text searching and bi-directional scrolling. This command is useful when examining log files (such as web server logs), configuration files, and software "read me" files when you don’t want to open a Notepad window.


REQUIRED - The filename you wish to view

Performs a case insensitive search and highlights the first line matching your search text

The list display will jump to the specified line number, displaying it at the bottom of the screen. Note that list starts its line numbering from line 0.

While running the list command, here are a few of the functions you may perform:

Cursor keys
Use the cursor keys to scroll through the file. If the file is too wide to view onscreen at once, the left and right cursor keys will be active.

Page Up, Page Down Keys Scrolls through the text file up or down one page at a time

Home, End Keys Jumps to the beginning or end of the file

Toggles text word-wrap

Q or the ESC key Quit the list display

/ Perform a case-sensitive search of the string you specify

\ Perform a case-insensitive search of the string you specify

n or F3
Searches for the next match to the search string

N Searches for the previous match to the search string

G Jump to the specified line number

F Open a new file without going back to the DOS prompt

? Displays a full list of commands

Note that by entering more than one filename after the list command you can view more than one file. Although only one file is displayed at a time, the following commands switch between files specified on the command line:

CTRL PAGE-DOWN Displays the next file specified on the command line, or wraps to the first file.

CTRL PAGE-UP Displays the previous file specified on the command line, or wraps to the last file.

System Requirements

Supported Operating Systems: Windows Server 2003; Windows XP

  • 30 MB of free disk space
  • Windows XP
  • Windows XP SP1
  • Windows Server 2003 family
CLI workaround for Windows XP : Using TAIL
Shell Tips
October 21, 2006 | COMMENTS

If you are an addict of the command line interface whateve the OS you use, you probably already had difficulties to administrate some Windows XP box remotely. Tips ! Get the [Windows Server 2003 Resource Kit tools][1] on you could install lot of usefull tools and especially tail !

# display help

tail /?

# display last ten lines of a file


# display last thirty lines of a file

tail -30 FILENAME

# keep accessing file, displaying new lines as necessary.

tail -f FILENAME

System Requirements

Supported Operating Systems: Windows Server 2003; Windows XP

  • 30 MB of free disk space
  • Windows XP
  • Windows XP SP1
  • Windows Server 2003 family
Removing ^M in imported Windows files
Shell Tips
October 9, 2006 | COMMENTS

When you import file from Windows OS (or even from old Macintosh OS) you most likely have the ^M at the end of each line. Systems based on ASCII or a compatible character set use either LF (Line Feed, 0x0A, n) or CR (Carriage Return, 0x0D, r) individually, or CR followed by LF (CR+LF, 0x0D 0x0A, rn). Below is a quick list of OS using which convention :

  • LF : UNIX and UNIX-Like systems, Linux, AIX, Xenix, Mac OS X, BeOS, Amiga, RISC OS...
  • CR+LF : CP/M, MP/M, DOS, OS/2, Microsoft Windows (all versions)
  • CR : Commodore machines, Apple II family and Mac OS through version 9

The different newline conventions often cause text files that have been transferred between systems of different types to be displayed incorrectly. For example, files originating on Unix or Apple Macintosh systems may appear as a single long line on a Windows system. Conversely, when viewing a file from a Windows computer on a Unix system, the extra CR may be displayed as ^M at the end of each line or as a second line break.
You can convert with editors relatively small files. For larger files on Windows NT/2000/XP you can use the following command:

TYPE unix_file | FIND "" /V > dos_file

On Unix, a DOS/Windows text file can be converted to Unix format by simply using the tool dos2unix or by removing all ASCII CR characters with the command "tr".

tr -d &#8216;\r&#8217; < inputfile > outputfile

You can add an alias to your shell startup script to create easy to remember variations of the tr command for each purpose.

Using bash as an example, edit .bashrc and add these lines.

alias cvtCR="tr '\r' '\n'"
alias cvtCRLF="tr -d '\r'";

You now have two new commands that you can type from the command line.
To try the commands out right away, without opening a new terminal, you
need to tell bash to re-read it’s startup file by typing

source .bashrc

Now you are ready to try out the new commands.

To convert an old MAC file you would type
cvtCR < MACFILE > UNIXFILE This will read a file named MACFILE and create a file named UNIXFILE that has all of the r’s converted to n’s For DOS files, you just want to remove the darn r’s so in cvtCRLF the -d tells tr to delete them. If you wan to update a sample file you can use you favorite editor : VI !


Becarefull, you get the cariage return symbols by the keystroke CTRL+V+ENTER.

How to manage an idle ssh connection ?
Shell Tips
October 5, 2006 | COMMENTS

You probably already have an idle ssh connection that you can’t leave because of a tcp timeout somewhere on the network or a bad command that you executed. What to do with this idle session ? Easy, just use the exit sequence ~.(tilde and a period) then you could open a new session properly.

Raid 5 Monitoring on Dell Power Edge 2650 with afacli
Case Study Shell
October 2, 2006 | COMMENTS

I had to monitor the Raid 5 status of two PE 2650 with a PERC3/Di and running under a GNU Debian. You can get the CLI tool afacli from dell website. Originally it was only available for windows or red-hat and it was necessary to tweak this stuff using Alien software for converting rpm to deb packages.

nicolas@grimm:~$ wget
nicolas@grimm:~$ sudo tar -Pvzxf afaapps-2.6-0.tar.gz
# Normally you should have a device afa0 created. If not, check that devicename = "aac" in the file /dev/MAKEDEV.afa then do the following step :
cd /dev
./MAKEDEV.afa afa0

More information is available on the Dell website.

Now that we have a running AFACLI we can do a little script for checking hourly our raid status. Main thing to know with afacli - as lot of other CLI tool - is the HELP command. First you will have to open your device with the command open afa0 then you could check your container list, disk list etc. Due to network constraint I could only use an SSH connection, so for schedule this script I use a special user named xfertuser on each box for doing an SSH KEY AUTH. When my user is logon the remote box, I execute some command on AFACLI and use a simple diff on last afacli log file and the new afacli log file. Then in last step Icheck the messages log for AACRAID error messages.

Continue Reading
  • ...