Check These Out
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"
I love this function because it tells me everything I want to know about files, more than stat, more than ls. It's very useful and infinitely expandable.
$ find $PWD -maxdepth 1 -printf '%.5m %10M %#9u:%-9g %#5U:%-5G [%AD | %TD | %CD] [%Y] %p\n' | sort -rgbS 50%
00761 drwxrw---x askapache:askapache 777:666 [06/10/10 | 06/10/10 | 06/10/10] [d] /web/cg/tmp
The key is:
# -printf '%.5m %10M %#9u:%-9g %#5U:%-5G [%AD | %TD | %CD] [%Y] %p\n'
which believe it or not took me hundreds of tweaking before I was happy with the output.
You can easily use this within a function to do whatever you want.. This simple function works recursively if you call it with -r as an argument, and sorts by file permissions.
$ lsl(){ O="-maxdepth 1";sed -n '/-r/!Q1'
1. find file greater than 10 MB
2. direct it to xargs
3. xargs pass them as argument to ls
If are a Bash user and you are in a directory and need to go else where for a while but don't want to lose where you were, use pushd instead of cd.
cd /home/complicated/path/.I/dont/want/to/forget
pushd /tmp
cd thing/in/tmp
popd (returns you to /home/complicated/path/.I/dont/want/to/forget)
Trace python statement execution and syscalls invoked during that simultaneously
This will make your bash scripts better!!
process-getopt is a wrapper around getopt(1) for bash that lets you define command line options (eg -h, --help) and descriptions through a single function call. These definitions are then used in runtime processing of command line options as well as in generating help and man pages. It also saves a little time in coding and in producing nicely formatted documentation. It is quite similar to GNU's argp in glibc for compiled languages and OptionParse for python.
See: Linux Gazette article 162: http://tldp.org/LDP/LGNET/162/hepple.html,
http://sourceforge.net/projects/process-getopt, http://bhepple.freeshell.org/oddmuse/wiki.cgi/process-getopt
Let me suggest using wget for obtaining the HTTP header only as the last resort because it generates considerable textual overhead. The first ellipsis of the sample output stands for
Spider mode enabled. Check if remote file exists.
--2009-03-31 20:42:46-- http://www.example.com/
Resolving www.example.com... 208.77.188.166
Connecting to www.example.com|208.77.188.166|:80... connected.
HTTP request sent, awaiting response...
and the second one looks for
Length: 438 [text/html]
Remote file exists and could contain further links,
but recursion is disabled -- not retrieving.
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"