PmWiki stores wiki pages as Group.Name. Simply split the directory listing and count frequency of group occurances. Show Sample Output
This is like `cd -` but doesn't echo the new directory name, which is preferable (to me) for an alias, e.g.
alias cdo="cd $OLDPWD"
SImply type "cd" and press enter Show Sample Output
this command is used to locate all pom.xml files, access the dir and do a mvn clean, but I do recommend you to disable network interfaces to not download dependencies packages to be faster. Show Sample Output
Number of days back: change/append arbitrary amount of '\|'$[$(date +%Y%j)-x] expressions or specify any n-th day before today for a single day (you have to replace x with 3, 4, 5, whatever ... above I replaced it with 1 and 2 to get listing for yesterday and day before yesterday and 0 for today was not necessary, so left out).
Q: How to narrow to *.pdf , *.png, *.jpg, *.txt, *.doc, *.sh or any type of files only?
A: Pipe to grep at the end of command.
Even shorter:
cd && day=3;for a in $(seq $day -1 0);do tree -aicfnF --timefmt %Y%j-%d-%b-%y|grep $[$(date +%Y%j)-$a];done
Here it's only needed to change amount of variable day to list period of days back - here is set to three days back (the seq command is adjusted for listing the oldest stuff first).
Show Sample Output
During this operation : # mv Joomla_1.5.10-Stable-Full_Package.zip /var/www/joomla/ I invoke /var/www/joomla/ as last command argument. To change in this directory I can use # cd !$ So I go to hob:/var/www/joomla#
unzips all zip files in any subdirectory under the current directory. The zip files are unzipped in their respective subdirs
Very simple and useful, you need to change the word "directory" for your directory
combines mkdir and cd added quotes around $_, thanx to flatcap! Show Sample Output
This is how I've done it in the past
Usage: jd dir
Requires globstar. To set globstar use:
shopt -s globstar
Creates a git repository in a predefined location. Show Sample Output
I added this code to my .bashrc file
Perfect time for the rarely used sub shell.
Please see sample output. Show Sample Output
Simple but useful little command to unzip all files in a directory.
Credit goes to "eightmillion" Show Sample Output
_ff(){ cd /mnt; echo /mnt/*/* |sed ' s/ \/mnt\//\&/g; '|sed '/'"$1"'/!d'; cd -; } ff(){ case $# in 0) echo "usage: ff glob [sed-cmds] [--|var-name]" ;; 1) _ff $1 |sed = ;; [2-9]) case $2 in --) _ff $1 |less -SN ;; *) _ff $1 |sed -n ''"$2"''|tr '\n' '\040' |sed 's/.*/export '"$3"'=\"&/;s/=\" /=\"/;s/ $/\"/' > $HOME/.ff; case $# in 3) . $HOME/.ff ;; esac; sed ' s/export .*=\"/\$'"$3"' = \"/;' $HOME/.ff;\ ;; esac ;; esac; } v(){ local a=$HOME; sed ' s/export /less -n \$/; s/=.*//; ' $a/.ff > $a/.v ; . $a/.v ; } Another approach using ls(1) lsl(){ _lsl () { ls -l $3 /mnt/*/$1* 2>/dev/null; }; case $# in 0) echo "usage: lsl pat [ls-options|result-no]"; echo "usage: lsle pat [sed-cmds]" ;; 1) _lsl $1 |sed = ;; 2) case $2 in -*) _lsl $1 $@;; *) _lsl $1 |sed 's/.* //; '"$2"'!d; '"$2"'q' > $HOME/.lsl ; export v=$(sed 1q $HOME/.lsl); echo \$v = $v ;; esac ;; esac; } exp(){ echo "%s/\$/ /"; echo "%j"; echo "s/^/export v=\""; echo "s/\$/\""; echo "s/ \"\$/\""; echo "."; echo "wq"; } lsle(){ lsl $1 -1 |sed $2 > .lsl&& exp |ed -s .lsl >&-&& . .lsl&& echo \$v = $v; }
commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.
Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):
Subscribe to the feed for: