2020年5月21日 星期四

[Linux & cli] Useful Linux command

Details
The following are some useful commands which usually made use and always being forgotten when needed, here is a note down.
  • Edit /etc/fstab to mount new drives (files system, mount point, type, options, dump, pass)
    • /dev/sdb1   /home/jacky/Documents/2tb-hdd   ext4   defaults  0   0
    • mount -av (run from root, show the mount point)
  • Run command and pipe all output to file
    • do_something 2>&1 | tee -a some_file (2>&1 is to direct all stderr to stdout)
  • Clear all text in a text file
    • > someTxtFile.txt
  • Kill process occupied by a known port (e.g. 32769)
    • sudo kill -9 $(sudo lsof -t -i:32769)
References

沒有留言:

張貼留言