Loading
Showing posts with label windows. Show all posts
Showing posts with label windows. Show all posts

Wednesday, August 20, 2008

Tips & Tricks : How to list contents ? on Linux/Unix or On Windows

It always happens that we would like to see what is inside that folder or inside that archive. No matter what type of contents are there, it is necessary to get it through listing those directories and archives.

So here are some handy tips, I use for my daily work:

  • Directory listing on Linux and Windows

  • Ever wonder how to see all the subfolders under main parent folder. Here is the trick to list all files and folders recursively.

    • This is on Linux/Unix


    • ls -R -1

    • This is on Windows


    • dir /s /b

  • Listing contents of archive files


  • On Linux/Unix and Windows, lots of time, in day's work it happens that we come across JAR, TAR, GZ,BZIP, RAR etc archive formats and before opening those FTPed or SCPed or magically appeared archives we do like to see if those are right archives.

    So here are some tips on that:

    • Listing tar file contents


    • tar -tvf tararchive.tar

    • Listing tar.gz file contents


    • tar -ztvf gzippedtararchive.tar.gz

    • Listing the contents of a tar.bz2 archive


    • tar -jtvf file.tar.bz2

    • Listing the contents of a Java archive (JAR,WAR,EAR etc)


    • jar tvf jararchive.jar

    • Listing contents of ZIP Archive. Assuming unzip is been installed on the linux box.


    • unzip -l zippedarchive.zip

    • Listing contents of RAR archive. Assuming unrar is been installed on the linux box.


    • unrar l rararchive.rar

    • Listing contents of GZIP or GUNZIP or GZCAT or ZCAT archive. Assuming either of these commands are installed on Linux box.

      gzip -l gziparchive.gz

      gunzip -l gunziparchive.gz

      zcat -l zcatarchive.Z




Please let me know if you have any such tricks to share with our readers. Feel free to put it in comments.

Thanks...

Friday, February 29, 2008

How to run Unix commands in windows ?

There are multiple ways to use and to run Unix commands in Windows.

And why would you like to do that ..because you are Unix-lover, you are used to flexibility, convenience of unix commands e.g. grep, awk, etc.etc., because you like to be cool to use Unix commands on Windows, and list goes on. But on another hand, most owners will be ok to use native Windows utilities and may occasionally use GnuWin32/unixutils to fill in the gaps.

There are solutions - - apart from using virtualization (VMWare, Microsoft Virtual PC, XEN etc) with virtual host ( like unix/linux OS etc) installed on top of windows.

Cygwin - an emulator running on top of windows
http://www.cygwin.com/
Cygwin is a Linux-like environment for Windows. It consists of two parts:
  • A DLL (cygwin1.dll) which acts as a Linux API emulation layer providing substantial Linux API functionality.

  • A collection of tools which provide Linux look and feel.

  • GNUwin32 - a sourceforge project
    http://gnuwin32.sourceforge.net/
  • Ports of tools with a GNU or similar open source license, to MS-Windows (Microsoft Windows 95 / 98 / ME / NT / 2000 / XP / 2003 / Vista / 2008).

  • Windows versions of many Linux command-line utilities are available. They can be installed individually

  • UnixUtils - another sourceforge project
    http://unxutils.sourceforge.net
  • ports unix utilities as native way that the executables do only depend on the Microsoft C-runtime (msvcrt.dll) and not an emulation layer.

  • unxutils is a much lighter weight solution to Cygwin

  • UWIN package - an AT&T research project under open source Common Public License 1.0 at AT&T AST/UWIN open source downloads.Allows UNIX applications to be built and run on Windows XP/2000/NT/ME/98/95 with few, if any, changes necessary.
    http://www.research.att.com/sw/tools/uwin/
  • Most of the UNIX API is implemented by the POSIX.DLL dynamically loaded (shared) library. Programs linked with POSIX.DLL run under the WIN32 subsystem instead of the POSIX subsystem, so programs can freely intermix UNIX and WIN32 library calls.

  • Libraries that emulate a UNIX environment by implementing the UNIX Application Programming Interface (API)

  • Include files and development tools such as cc, yacc, lex, and make.

  • ksh(1) (the Korn Shell) and over 250 utilities such as ls, sed, cp, stty, etc.


  • Windows Services for UNIX - "free download" Windows Services for UNIX version provides a full range of cross-platform services for integrating Windows into existing UNIX-based environments.
    http://technet.microsoft.com/en-us/interopmigration/bb380242.aspx
  • These are quite powerful but yet kind of unknown utilities for windows-unit Interoperability.