This finds the 10 largest files in the /var directory. Modify as needed
# du -a /var | sort -n -r | head -n 10
# ssh vmbulkmsgtst1 -- tar cz /admin/software/ | ssh bulkmsg1 -- tar vxzC /
Command for getting the list of files with perms, owners, groups info. Useful to find the checksum of 2 machines/images.
# find / | sort | xargs ls -ld | awk '{print $1,$3,$4,$9,$10,$11}'
If there's too many files in a dir to tar up normally
# find . -type f -exec tar -uf /disk3/mqueue.tar {} \;
Move files one by one; handy if there's too many files to do anything else with.
# for FILE in `ls /var/spool/mqueue/`; do mv /var/spool/mqueue/$FILE /var/spool/mqueue.TODAY ; done &
# for FILE in `ls /disk3/mqueue/`; do mv /disk3/mqueue/$FILE /disk3/mqueue.TODAY ; done &
Relocate a file or directory, but keep it accessible on the old location through a simlink.
# mv $1 $2 && ln -s $2/$(basename $1) $(dirname $1)
Diff files on two remote hosts.
# diff <(ssh mymeteor01 cat /etc/hosts) <(ssh mymeteor02 cat /etc/hosts)
:set ff=unix
And in case you want to migrate back to, err.. MS-DOS: “:set ff=dos” does the opposite.
# tr -d "\015" < myscript.sh > myscriptNEW.sh
# mv myscriptNEW.sh myscript.sh
# man dos2unix