Monday, June 16, 2008

EMACS and More!

Acronym of the Moment:
EMACS: Editor MACroS

Navigation in the JUNOS CLI is accomplished by EMACS style keystrokes. A few of the more useful ones shall be illustrated here. (Only in vt100 mode)

  • ctrl-b: Move the cursor back one character
  • ctrl-a: Move the cursor to the beginning of a line
  • ctrl-e: Move to the end of a line
  • ctrl-k: Delete all words from the current cursor position to the end of the line
  • ctrl-x: Clear the entire line
  • ctrl-l: Redraw the current line
  • ctrl-p or UP arrow: Scroll backward through previously typed commands
  • ctrl-n or DOWN arrow: scroll forward through previously typed commands
  • ctrl-r: search through the command history

"The Almighty Pipe"

You can use the pipe command to control and take the output of one command such as show route and use it as the input for another command. Lets look at some examples:

  • count Count the number of lines in the output Eg: show interfaces terse count
  • display Show additional data such as XML tags or set commands. Eg: show configuration display set
  • except Omit lines from the output Eg: show interfaces terseexcept fe
  • find Begin the output at the string you specify Eg: show interfaces fe-0/0/2 extensive find traffic
  • hold Hold output in the buffer until you clear it Eg: show route hold
  • match Display only lined that match a pattern you specify Eg: show log messages match "jun 4"
  • no-more Do not show output a page at a time Eg: show system statistics arp no-more
  • save Save output to a file in a user's /home directory Eg: show interfacessave interface_routername


No comments: