Command Line Utilities: Difference between revisions

From Elvanör's Technical Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 7: Line 7:
* --no-p: this will disable permissions synchronization.
* --no-p: this will disable permissions synchronization.
* --no-o: this will disable owner synchronization.
* --no-o: this will disable owner synchronization.
== tar ==
* Use the -C option to switch to a directory before compressing. Very useful.
* Use the -h option to follow symbolic links.


== cpio ==
== cpio ==

Revision as of 11:55, 9 April 2008

This is a collection of random useful command line tools.

  • To obtain the space available on a HD: df -h

rsync

  • --no-p: this will disable permissions synchronization.
  • --no-o: this will disable owner synchronization.

tar

  • Use the -C option to switch to a directory before compressing. Very useful.
  • Use the -h option to follow symbolic links.

cpio

  • This seems to be something similar to tar.
  • Allows you to do nice stuff like
find . -name '*.txt' print0 | cpio -o -0 | ssh elvanor@otherbox 'cd dirB && cpio -iduv -0'

This would copy the *.txt files to another box, preserving the directory hierarchy.

Tricks and tips

  • Redirecting all outputs to a file:
foo &> bar

To redirect only stderr:

foo 2> bar