====== Useful Commands ====== ===== File Search ===== ''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 - quit vi, writing out modified file named in original :wq - quit vi, writing out modified file named in original :q - quit/ exit vi :q! - quit vi even though latest changes have not been saved **Window Motions** d Scroll down (half a screen) u Scroll up (half a screen) f Page forward b Page backward /string Search forward ?string Search backward l Redraw screen 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 Reposition window: cursor at top z. Reposition window: cursor in middle z- Reposition window: cursor at bottom