比较两个文件的不同

时间:2022-08-08 10:09:51

linux中的diff命令可以比较两个文件的不同,并输出友好的结果,方便查看。其中-y表示输出两列对比,而'--suppress-common-lines'屏蔽了相同的行。

$ diff --suppress-common-lines default.cf osd.4.cf -y
name = client.admin					      |	name = osd.4
debug_lockdep = 0/1					      |	debug_lockdep = 0/0
debug_context = 0/1					      |	debug_context = 0/0
debug_crush = 1/1					      |	debug_crush = 0/0
debug_mds = 1/5						      |	debug_mds = 0/0
debug_mds_balancer = 1/5				      |	debug_mds_balancer = 0/0
debug_mds_locker = 1/5					      |	debug_mds_locker = 0/0
debug_mds_log = 1/5					      |	debug_mds_log = 0/0
debug_mds_log_expire = 1/5				      |	debug_mds_log_expire = 0/0
debug_mds_migrator = 1/5				      |	debug_mds_migrator = 0/0
debug_buffer = 0/1					      |	debug_buffer = 0/0
debug_timer = 0/1					      |	debug_timer = 0/0
debug_filer = 0/1					      |	debug_filer = 0/0
debug_objecter = 0/1					      |	debug_objecter = 0/0
debug_rados = 0/5					      |	debug_rados = 0/0
debug_rbd = 0/5						      |	debug_rbd = 0/0
debug_journaler = 0/5					      |	debug_journaler = 0/0
debug_objectcacher = 0/5				      |	debug_objectcacher = 0/0
debug_client = 0/5					      |	debug_client = 0/0
debug_osd = 0/5						      |	debug_osd = 0/0
debug_optracker = 0/5					      |	debug_optracker = 0/0
debug_objclass = 0/5					      |	debug_objclass = 0/0
debug_filestore = 1/3					      |	debug_filestore = 0/0
debug_journal = 1/3					      |	debug_journal = 0/0
debug_ms = 0/5						      |	debug_ms = 0/0
debug_mon = 1/5						      |	debug_mon = 0/0
debug_monc = 0/10					      |	debug_monc = 0/0
debug_paxos = 1/5					      |	debug_paxos = 0/0
debug_tp = 0/5						      |	debug_tp = 0/0
debug_auth = 1/5					      |	debug_auth = 0/0
debug_finisher = 1/1					      |	debug_finisher = 0/0
debug_heartbeatmap = 1/5				      |	debug_heartbeatmap = 0/0
debug_perfcounter = 1/5					      |	debug_perfcounter = 0/0
debug_rgw = 1/5						      |	debug_rgw = 0/0
debug_asok = 1/5					      |	debug_asok = 0/0
debug_throttle = 1/1					      |	debug_throttle = 0/0