User Tools

Site Tools


databaseandnetworkmanagement:useful_commands

Useful Commands

locate SnmpManagerConfig.groovy

Will search for the file and display its directory.


Tailing Logs

  • It is possible to tail the logs in real time using the following command: tail -f NameOfLogFile.log
  • It is also possible to tail and grep for a keyword using the following command: tail -f NameOfLogFile.log | grep 'myKeyword'

Cat & Grep

The following command is used to search all SnmpManager.log files in the current directory for the term 'myNetworkElement'. The results are then inputted into the text file 'myOutput.txt'.

cat SnmpManager.log* | grep 'myNetworkElement' > myOutput.txt


VI

Vi has 2 modes:

1. Command Mode - commands which cause action to be taken on the file
2. Insert Mode - where text is inserted into the file

ESC key turns off insert mode

Exiting Vi

   :x <Return> - quit vi, writing out modified file named in original
   :wq <Return> - quit vi, writing out modified file named in original
   :q <Return> - quit/ exit vi
   :q! <Return> - quit vi even though latest changes have not been saved

Window Motions

<ctrl>d Scroll down  (half a screen)
<ctrl>u Scroll up  (half a screen)
<ctrl>f Page forward
<ctrl>b Page backward
/string Search forward
?string Search backward
<ctrl>l Redraw screen
<ctrl>g Display current line number file information
n Repeat search
N Repeat search reverse
G Go to last line
nG Go to line n
:n Go to line n
z<CR> Reposition window: cursor at top
z. Reposition window: cursor in middle
z- Reposition window: cursor at bottom
databaseandnetworkmanagement/useful_commands.txt · Last modified: 2021/06/25 10:09 by 127.0.0.1