- Repeat previous command
!!
- Copy a directory with scp
scp -r user@server:/path/directory .
- Display memory use under the current directory
du -h -d 2
- Open a file directly from a SVN server
svn cat svn://svn_server/project/branches/path/file|less
- Open a previous version of a file without doing ‘svn update’ or ‘svn checkout’
svn cat -r r49441 working_dir/path/file
- Svn log get revisions by date : below we retrieve revision of 15th Feb 13
svn log --revision {2013-02-15}:{2013-02-16}|less
- Use grep –exclude. For example, exclude svn hidden directory.
grep earchedterm . -nR --exclude="*\.svn*" 2>/dev/null
grep pattern -Rn --exclude=*\.{svn,html,log} . 2>/dev/null
- Open a file returned by grep. We use the option ‘-l’ to “clean” the path.
grep checkStep1 . -lR 2>/dev/null|xargs vim -o
- Remove redondant information from apache logs (referer, error, etc.)
tail -f /var/log/apache2/mahara-test.error.log | perl -pe 's/, referer:.*//'
tail -f /var/log/apache2/mahara-test.error.log | perl -pe 's/\[error\]\s+\[client.*?\]\s+//; s/, referer:.*//'
More details : http://nigel.mcnie.name/blog/removing-the-referer-part-of-php-error-messagse-from-apache-logs
- Display files containing a pattern (in php files):
find . -type f -name "*.php" -exec grep -il 'HistoryController' {} \;
grep -iRHs 'HistoryController' . ;