2017年2月19日 星期日

Linux handbook

Q: Kill all process related to an application
A: use 'killall' command.

Q: Where is the core dumps ?
A: [Ubuntu12.04] /var/crash/

Q: How to pause (suspend) / resume current process ?
A: To pause (suspend) current process, press CTRL+Z
     To resume it, use 'fg' command.

Q: How to show time (including year) of a file ?
A: ls --full-time

Q: How to show a file's creation time ?
A: stat

Q: How to update hardware time ?
A: "ntpdate pool.ntp.org" or "date --set "5 Aug 2012 12:54 IST"
      and "hwclock --systohc --localtime"

Q: Find line number of a specific text.
A: grep -nr 04:07: top_log

grep -n -E 'WNC|null pointer' tsu_all_20210202 > tsu_all_20210202.refine1
grep -v -E 'convertWNCsignalStrengthToRIL|SIGNAL_STRENGTH' tsu_all_20210202.refine1 > tsu_all_20210202.refine2
grep -n -E 'null pointer|Data Connection ESTABLISHED' tsu_all_20210202 > tsu_all_20210202.refine3
grep -n -E 'null pointer|SIGNAL_STRENGTH' tsu_all_20210202 > tsu_all_20210202.refine4


# Truncate the file in-place starting a certain line.
   sed -i '50001,$ d' filename
  • -i means in place.
  • d means delete.
  • 50001,$ means the lines from 50001 to the end.

沒有留言: