|
vi replace all:
g/FROM_STRING/s//TO_STRING/g
g/sprinttvads/s//whysprint/g
|
count all files:
ls -l * | grep "^-" | wc -l
|
count all files below currently dir:
find . -name "*" -type f | wc -l
|
find without perm errors (bash):
find / -name "foo" 2>/dev/null
|
Windoze; Expand alt-tab size:
search registry for CoolSwitchColumns & CoolSwitchRows
|
unmunge terminal after binary chars
reset
|
host not found:
check for dns in nsswitch.conf hosts entry:
hosts: files dns
(NB Titan removes this!)
|
ssh autologin doesn't work:
check that user has password set
check that home dir is not group writable.
|
grub won't boot after tar replicate (stops after GRUB on screen)
boot with floppy and type as root:
grub-install /dev/hda
|
pipe tar through gzip on solaris:
tar cf - /path | gzip > archive.tar.gz
gunzip -c archive.tar.gz | tar xf
|
add disk in solaris
/usr/sbin/devfsadm
/usr/sbin/drvconfig
/usr/sbin/devlinks
/usr/sbin/disks
/usr/ucb/ucblinks
|
gunzip file too large:
gzcat Mas.gz > Mas
|
find recursively in files:
find /path/to -type f -exec grep -il "some string" {} \;
|
remove ^M from files:
vi
:1,$s/^V^M//g
NOTE! ^V is typed ctrl-v_v, ^M is typed ctrl-v_m
- or -
remove ^M from file
read foo; cp $foo $foo.bak; sed 's/^M//g' $foo > /tmp/bar; mv /tmp/bar $foo
|
weblogic
"weblogic.management.NoAccessRuntimeException:" delete security credential
blank pages: check root doesn't own .wlnotdelete
|
sed search/replace
sed 's/from/to/' file > tmp.file; mv tmp.file file
|
date: get date N days ago:
TZ=PST((N*24)+8)GMT date
eg, TZ=PST176GMT date = 7 days ago
(usefull to touch a file with a specific date)
|
Qmail svc fix:
check you're not using the wrong svc!
ls -l /usr/bin/svc
which svc
mv /usr/bin/svc /usr/bin/svc~
ln -s /usr/local/bin/svc /usr/bin/svc
qmail restart
|
How to Mount an ISO Image in Linux
mount a cd-rom image onto a local mount point in Linux
mount -t iso9660 name.iso /mnt/tmp/ -o loop
|
mysql: create users
grant all privileges on <db> to <user>@localhost identified by '<pass>';
|
copy *.html to *.jsp:
for i in *; do echo $i | eval "cp $i `awk '{ gsub(/\.html/, ".jsp"); print }'`" ; done
|
tar to remote server (useful if there's no space locally)
tar -cf - ./dir/ | gzip | ssh user@hostname "cat > dir.tar"
tar -cf - ./dir/ | gzip | ssh user@hostname "tar zxf - -C /target/dir/"
|
replace in multiple files:
mkdir tmp; for i in * ; do sed 's/from/to/' $i > tmp/$i ; done
|