ParityCheck

February 29, 2008

How to add directories and subdirectories to a CVS repository

Filed under: Linux, Unix — paritycheck @ 2:29 pm

Here is a quick way to add directories and subdirectories to an existing CVS repository 

cvs add top_level_directory
find top_level_directory -type d -print | xargs cvs add
find top_level_directory -name CVS -prune -o -type f -print | xargs cvs add

The instruction below adds the top-level called top_level_directory directory to the CVS repository 

cvs add top_level_directory

The instruction below finds all subdirectories under top_level_directory and issues a cvs add command to subdirectories that are found

find <folder_name> -type d -print | xargs cvs add

The instruction below finds all files not including CVS files and issues a cvs add command

find <folder_name> -name CVS -prune -o -type f -print | xargs cvs add
 

February 28, 2008

How to compare directories using diff

Filed under: Linux, Unix — paritycheck @ 2:11 pm

The easiest way to compare directories in Linux or Unix is by using a utility called diff in the following way..

 diff –recursive <directoryA> <directoryB>

Note: there are two dashes (“-”) before the word recursive.

July 21, 2007

How to uncompress/unarchive Unix files

Filed under: Linux, Unix — paritycheck @ 1:02 pm

When using Unix or Linux, it is easy to forget the magic incantations needed to do something. In the spirit of sharing information and making it widely available, this article documents how to uncompress Unix files that end in particular suffixes. This list will be updated on a regular basis when I encounter different compressed formats.

For files that end in…

  • name.tar.gz
    • invoke tar xvfz name.tar.gz
  • name.tgz
    • invoke tar -zxvf name.tgz
  • name.tar.bz2
    • invoke bunzip2 name.tar.bz2 | tar x -f
  • name.zip
    • invoke unzip name.zip
    • Note: gunzip won’t work on files that have a .zip suffix.
  • name.gz
    • invoke gzip -d name.gz

If there are other tar-like or other compress/uncompress commands that you know about, please let me know.

June 14, 2007

Unix find command to find text in a file buried deep in subdirectories

Filed under: Linux, Unix — paritycheck @ 3:10 am

Something I learned long time ago and continually find it useful.  This is a way to use the Unix find command to search through files for a particular word, even files buried deep in subdirectories.  Great when trying to dig through Verilog RTL searching for the source of a signal.

Simply type the command below in the following format.

find [dir] -name [files] | xargs grep [text to search for]

For example,

find . -name “*.v” | xargs grep parity_check

or

find . -name “*.*” | xargs grep parity_check

If there are other UNIX how-tos you’d like to see, please feel free to let me know.  I’ll do my best to help out..

Blog at WordPress.com.