Recent Notes

Displaying keyword search results 1 - 10
Created by voodoo on March 24, 2013 13:44:47    Last update: March 29, 2013 13:08:31
Use getpwnam group of functions. Example code: #include <sys/types.h> #include <pwd.h> #inc... For gid, use getgrnam
Created by voodoo on January 03, 2012 08:41:21    Last update: February 16, 2012 15:50:06
This is the command to print all regular files in the src folder but excluding all files within the .svn folders: $ find src -name .svn -prune -o -type f -print where -o is the or operator. Define a shortcut: ff () { find $1 -name .svn -prune -o -...
Created by zhidao on January 18, 2012 12:03:32    Last update: January 18, 2012 12:03:32
I think this is simpler: grep -l limit .*
Created by Dr. Xi on January 06, 2012 13:44:55    Last update: January 06, 2012 13:44:55
To exclude CVS directories: grep -R -l --exclude-dir=CVS 'string_to_find‘ src ... To exclude .svn directories: grep -R -l --exclude-dir=.svn 'string_to_find‘ src...
Created by voodoo on November 22, 2011 12:27:12    Last update: November 22, 2011 12:31:50
Unix hidden files are named starting with a dot ".". To find hidden files in the current directory: $ find . -type f -name '.*' or $ find . -type f | grep \\/\\. To find hidden files in the marketing directory: $ find marketing -type f -name '.*' or $ find marketing -type f | grep \\/\\.
Created by Dr. Xi on September 30, 2011 15:34:47    Last update: September 30, 2011 15:34:47
A naive try would be something like this: $ nc -l 8082 | nc remote_host 80 Yes, it does forward the request from local port 8082 to remote_host:80 , but the response is dumped to stdout , not routed back to the client as expected. Using a named pipe makes it work: $ mkfifo backpipe $ nc -l 8082 0<backpipe | nc ... Use tee to get a glimpse of the response through the pipe (I wasn't able to find a way to dump the request): $ nc -k -l 8082 0<backpipe | nc localhost 80 | tee... The GNU netcat has a different syntax than the stock nc . It also supports different switches. To listen to port 1234: $ netcat -l -p 1234...
Created by woolf on April 12, 2011 09:20:08    Last update: April 12, 2011 09:20:08
First try (this lists files by directory, including directories themselves): ls -R -lrt Second try: find . -type f | xargs ls -lrt
Created by Dr. Xi on March 28, 2011 11:11:33    Last update: March 28, 2011 11:13:21
grep is a versatile command with many variations (grep, egrep, fgrep, then various implementations). It uses a regula expression (regex) pattern to filter input. But then there are basic and extended flavors of regex - leading to even more confusion. And, beware that there are lots of bad examples of regex in the wild... There are two critical questions to ask when you use grep: which grep implementation are you using? what is the flavor of the regex? Here are some examples for gnu grep v2.7: # Find all numbers (no decimal point), basic regex... Use the -o flag to show only the matching part instead of the whole matching line: grep -o -E '\b[0-9]{2}\b' The good thing about the gnu grep is that it...
Created by magnum on March 09, 2011 15:49:58    Last update: March 09, 2011 15:49:58
GNU cpio copies files into or out of a cpio or tar archive. There are 3 modes: -o : copy-out mode, copies files into an archive -i : copy-in mode, copies files out of an archive -p : copy-pass mode, combines the copy-out and copy-in steps without actually using an archive Examples: # create a cpio archive with all files in the ...
Created by Dr. Xi on February 17, 2011 13:23:16    Last update: February 17, 2011 13:23:16
To find the PID of the tomcat instance that is currently running: ps -ef | grep java | grep tomcat | awk '{print $2}...
Previous  1 2 3 Next