Unix/Linux Quickies …

A few helpful *nix commands (aka brain dump … it’s too full) …

  • Archive only a specific type of files within a dir and all subdirs, preserving file paths in the archive:
    tar -czvf config-files-20071116.tgz `find . -name "*.cfg"`
  • Kill a running process, the easy way:
    pkill processString
    (processString can be any portion of the command running to be killed - e.g. pkill firefox)
  • Get the PID of a running process, the easy way:
    pgrep processString
    (processString can be any portion of the command running - e.g. pgrep firefox could return 1123)
  • Disable email notification to the owner of the cron, from a running cron entry:
    Add “ > /dev/null 2>&1 ” to the end of the cron job line (means send any standard output to /dev/null and redirect standard error (2) to standard output (1)).

h u g h


About this entry