Linux Tips: Difference between revisions
No edit summary |
|||
Line 1: | Line 1: | ||
== Script to colorize source code using vim == | == Script to colorize source code using vim == | ||
http://theeggeadventure.com/2006/colorize.sh.html | * colorize.sh [[http://www.theeggeadventure.com/2006/colorize.sh.html view]] [[http://www.theeggeadventure.com/2006/colorize.sh download]] | ||
== Create a .tar.gz archive == | == Create a .tar.gz archive == |
Revision as of 02:24, 11 October 2006
Script to colorize source code using vim
Create a .tar.gz archive
tar -pczf name_of_your_archive.tar.gz /path/to/directory
Unzip and extract an archive
gzip -drv ruby-1.8.3.tar.gz tar -xf ruby-1.8.3.tar
Copy files from work to this website
rsync -avz -e ssh --rsync-path=/usr/bin/rsync /u/eggebr/tmp/ttf-bitstream-vera-1.10/ egge@theeggeadventure.com:/home/egge/fonts rsync -avz -e ssh --rsync-path=/usr/bin/rsync /u/eggebr/.vimrc egge@theeggeadventure.com:/home/egge/
Backup ccnorthjersey.org
$ rsync -avz -e ssh ccnorthj@ccnorthjersey.org:/home/ccnorthj /cygdrive/c/Backup/ccnorthjersey.org
Backup theeggeadventure.com
$ rsync -avz -e ssh egge@theeggeadventure.com:/home/egge /cygdrive/c/Backup/theeggeadventure.com
Get a stack trace from a running Python process
This will print the stack, and then the process will exit. I'm not sure how to get the stack without killing the process.
kill -SIGINT 28350
My bash prompt
Note - it's important to that the non-printing characters are enclosed in "\[" and "\[" so bash can do line wraps properly.
export PS1="\[\e[32m\]\h\[\e[0m\]@\[\e[34m\]\W$\[\e[0m\] "
Use sed to remove ANSI colors
echo -e '\e[31mfoo\e[0m' | sed 's/^[\[[0-9]\+m//g'
Note, I couldn't figure out how to make sed accept a \e or \033 for an escape character, so I typed 'Ctrl-V Ctrl-[' in my shell to create an escape character inline.
Redirecting sudo output
Long answer: http://www.dagnall.net/blog/?p=41
Short answer:
sudo -u someuser /bin/bash -c \"command > out.txt\"
Touch all open files in a directory
lsof +D $PWD | awk '{print $9}' | uniq | grep -v NAME | touch
Missing font problem
- Problem: I get this warning when running xemacs on a Linux WS3 host:
Warning: Missing charsets in String to FontSet conversion Warning: Unable to load any usable fontset
I don't have this issue on RH 8.0 hosts or SunOS.
- Fix: The problem is the LANG environment variable.
It's probably set to en_US.UTF-8. Change it to en_US.iso88591, and the warning should go away. Or else find some fonts that are UTF-8 encoded, I suppose.
so you can set your .envrc or just do a
setenv LANG en_US.iso88591
Search & Replace text in a batch of files
for f in `ffind "*.java" | xargs grep -l "foo"`; do sed -e "s/foo/bar/" ${f} > tmp; mv -f tmp ${f} ; done
Verify all the jar's in the classpath exist
# Warn if any jar's are missing echo $CLASSPATH | tr ":" "\n" | xargs cksum > /dev/null