Skip to content

Instantly share code, notes, and snippets.

@rcanepa
Created August 6, 2016 05:12
Show Gist options
  • Save rcanepa/0bce2a83acbbfd3da45b1430df75e7e3 to your computer and use it in GitHub Desktop.
Save rcanepa/0bce2a83acbbfd3da45b1430df75e7e3 to your computer and use it in GitHub Desktop.
UNIX diff
- diff processes outputs
$ diff -u <(ps aux) <(ps aux)
--- /dev/fd/63 2016-08-06 01:02:53.000000000 -0400
+++ /dev/fd/62 2016-08-06 01:02:53.000000000 -0400
@@ -312,12 +312,12 @@
root 44 0.0 0.0 2518564 1944 ?? Ss Wed07PM 0:45.29 /usr/sbin/syslogd
root 43 0.0 0.1 2551932 10704 ?? Ss Wed07PM 0:23.84 /usr/libexec/UserEventAgent (System)
root 1 0.0 0.1 2538696 11456 ?? Ss Wed07PM 5:36.04 /sbin/launchd
-root 20967 0.0 0.0 2435076 1016 s001 R 1:02AM 0:00.00 ps aux
+root 20967 0.0 0.0 2435232 1032 s001 R 1:02AM 0:00.00 ps aux
root 15048 0.0 0.0 0 0 ?? Z 9:19PM 0:00.00 (pia_openvpn_clie)
-root 20966 0.0 0.0 2437540 1088 s001 R 1:02AM 0:00.00 ps aux
+root 20966 0.0 0.0 2437540 1088 s001 S 1:02AM 0:00.00 (ps)
rcanepa 20965 0.0 0.0 2434920 828 s001 S+ 1:02AM 0:00.00 diff -u /dev/fd/63 /dev/fd/62
rcanepa 20964 0.0 0.0 2466156 756 s001 S 1:02AM 0:00.00 -bash
-rcanepa 20963 0.0 0.0 2466156 752 s001 S 1:02AM 0:00.00 -bash
+rcanepa 20963 0.0 0.0 2466156 752 s001 S 1:02AM 0:00.00 (bash)
rcanepa 20922 0.0 0.0 2619084 3320 ?? Ss 1:02AM 0:00.00 postgres: simpleclerk2 simpleclerk2 127.0.0.1(54237) idle
rcanepa 20921 0.0 0.0 2619084 3284 ?? Ss 1:02AM 0:00.00 postgres: simpleclerk2 simpleclerk2 127.0.0.1(54236) idle
rcanepa 20920 0.0 0.0 2619084 3276 ?? Ss 1:02AM 0:00.00 postgres: simpleclerk2 simpleclerk2 127.0.0.1(54235) idle
- echo file descriptors ps aux commands
$ echo <(ps aux) <(ps aux)
/dev/fd/63 /dev/fd/62
- diff google.cl with google.com
$ diff -u <(curl www.google.cl | tidy) <(curl www.google.com | tidy) | view -
- this same procedure can be used to compare a web application between environments (prod vs dev)
$ diff -u <(curl www.my-prod-webapp.com | tidy) <(curl localhost:3000 | tidy) | view -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment