Wednesday 31 March 2021

Daily helper in Linux or Mac

1)Search recursively some content inside directory.
   grep  'content_to_find'  -R  /home/anoop

2)Grep some content from a source.  -A will show number of lines which we want to show after word is found.
    cat nginx.conf | grep -A 10 word_to_search

3)Check whether port is in listen state or not.
    netstat -an | grep 443

4) Find command is used to find file or directory  inside any directory.  
      Syntax::  find  location  -iname dir_name or file_name  
      find  / -iname "search.log" 

5)Add opt folder in finder in mac. Click on Command +shift+G and add the requred folder on favourite folder by dragging it.

Mac has default Package management system that can be used to check  and change different service status.

1) brew services
2) brew services info mongodb-community
3)brew services stop mongodb-community
4)brew services start mongodb-community