alias myip='/sbin/ifconfig | sed -n "/wlan0/{n;s/.*inet addr://;s/ .*\$//p}"'
Friday, July 17, 2015
Current IP Address One-liner
Thursday, July 9, 2015
find'ing Directories in cwd w/out a partial name fragment recursively below
The following alias will find all directories in the current working directory that do not have the passed in argument in any portion of the path.
Note: lsdv - ls (listing) d (directory) v (like grep -v). This also filters the current directory.
alias lsdv='_() { find . -type d | grep -v -F -f <(find . -type d | grep -i "${1}"
| awk -F"/" "{print \$2}" | uniq) | grep -Ev "^\.{1,2}\$"; }; _'
Tuesday, July 7, 2015
Bash / PHP Fusion
Bash w/PHP opens a whole new realm of possibilities of systems integration!
>$ var=$(cat << 'EOF'
<?php
$output = shell_exec('ls -lart');
echo "<pre>$output</pre>";
?>
EOF
)
>$ echo "$var" | php
<pre>total 0
-rw-rw-r-- 1 cronkilla cronkilla 0 Jul 7 11:24 d
-rw-rw-r-- 1 cronkilla cronkilla 0 Jul 7 11:24 c
-rw-rw-r-- 1 cronkilla cronkilla 0 Jul 7 11:24 b
-rw-rw-r-- 1 cronkilla cronkilla 0 Jul 7 11:24 a
drwxrwxr-x 2 cronkilla cronkilla 40 Jul 7 13:38 f
drwxrwxr-x 3 cronkilla cronkilla 140 Jul 7 13:38 .
drwxrwxrwt 12 root root 1540 Jul 7 17:40 ..
</pre>
Subscribe to:
Posts (Atom)