Tuesday, January 3, 2012

Frequently Used Cygwin Commands

Simple log of personal usage

cygstart :
open a program, it can be anything, such like google chrome,
eclipse notpad++, media or text files, for example:

cygstart "C:/Program Files/Notepad++/notepad++.exe"

alias :
useful for shrink the command length, for example:

alias notepad='cygstart "C:/Program Files/Notepad++/notepad++.exe"'

then type "notepad" and press enter, the notepad++ will be launched

combine these in bash:

alias chrome='cygstart "C:/Program Files/Google/Chrome/Application/chrome.exe"'
alias eclipse='cygstart C:/Java/eclipse/eclipse.exe'
alias notepad='cygstart "C:/Program Files/Notepad++/notepad++.exe"'
alias startwork='chrome;notepad;eclipse;'

then type "startwork" and press enter, chrome, eclipse and notepad++ are opened.

cp -r [from_file_path] [to_file_path] :
copy folder recursively

sed 's/oldString/newString/g' file_path
replace all oldString with newString and apply change to the file,
The option -i tells sed to edit the file“in-place”,
will save the modified result back to the file.
The result will be output to the console  if it is omitted.

apt-cyg install unzip :
This will install the "unzip" program,
apt-cyg is a command-line software installer for Cygwin,
please refer to http://code.google.com/p/apt-cyg/

jar -cvfM [jar_name] [file_to_include_one] [file_to_include_two] ...
Package a jar,
This is not a cygwin command but I always use it with cygwin
-c  create new archive
-v  generate verbose output on standard output
-f  specify archive file name
-M  do not create a manifest file for the entries

No comments:

Post a Comment