[Contents] [Prev] [Next] [Index] [Report an Error]

Viewing Files and Directories on a Device Running JUNOS Software

The JUNOS software stores information in files on the device, including configuration files, log files, and router software files. This topic shows some examples of operational commands that you can use to view files and directories on a device running JUNOS software.

Sections include:

Directories on the Router

Table 9 lists some standard directories on a device running JUNOS software.

Table 9: Directories on the Router

DIrectory

Description

/config

This directory is located on the router’s internal flash drive. It contains the active configuration (juniper.conf) and rollback files 1, 2, and 3.

/var/db/config

This directory is located on the router’s hard drive and contains rollback files 4 through 49.

/var/tmp

This directory is located on the router’s hard drive. It holds core files from the various processes on the Routing Engines. Core files are generated when a particular process crashes and are used by Juniper Networks engineers to diagnose the reason for failure.

/var/log

This directory is located on the router’s hard drive. It contains files generated by both the router’s logging function as well as the traceoptions command.

/var/home

This directory is located on the router’s hard drive. It contains a subdirectory for each configured user on the router. These individual user directories are the default file location for many JUNOS software commands.

/altroot

This directory is located on the router’s hard drive and contains a copy of the root file structure from the internal flash drive. This directory is used in certain disaster recovery modes where the internal flash drive is not operational.

/altconfig

This directory is located on the router’s hard drive and contains a copy of the /config file structure from the internal flash drive. This directory is also used in certain disaster recovery modes when the internal flash drive is not operational.

Listing Files and Directories

You can view the device’s directory structure as well as individual files by issuing the file command in operational mode.

  1. To get help about the file command, type the following:
    user@host> file ?
    Possible completions:
      <[Enter]>            Execute this command
      archive              Archives files from the system
      checksum             Calculate file checksum
      compare              Compare files
      copy                 Copy files (local or remote)
      delete               Delete files from the system
      list                 List file information
      rename               Rename files
      show                 Show file contents
      source-address       Local address to use in originating the connection
      |                    Pipe through a command
    user@host> file    

    Help shows that the file command includes several options for manipulating files.

  2. Use the list option to see the directory structure of the router. For example, to show the files located in your home directory on the router:
    user@host> file list
    .ssh/
    common

    The default directory for the file list command is the home directory of the user logged in to the router. In fact, the user’s home directory is the default directory for most of the JUNOS software commands requiring a filename.

  3. To view the contents of other file directories, specify the directory location. For example:
    user@host> file list /config
    juniper.conf
    juniper.conf.1.gz
    juniper.conf.2.gz
    juniper.conf.3.gz
  4. You can also use the router’s context-sensitive help system to locate a directory. For example:
    user@host> file list /?
    Possible completions:
      <[Enter]>            Execute this command
      <path>               Path to list
      /COPYRIGHT           Size: 6355, Last changed: Feb 13 2005
      /altconfig/          Last changed: Aug 07 2007
      /altroot/            Last changed: Aug 07 2007
      /bin/                Last changed: Apr 09 22:31:35
      /boot/               Last changed: Apr 09 23:28:39
      /config/             Last changed: Apr 16 22:35:35
      /data/               Last changed: Aug 07 2007
      /dev/                Last changed: Apr 09 22:36:21
      /etc/                Last changed: Apr 11 03:14:22
      /kernel              Size: 27823246, Last changed: Aug 07 2007
      /mfs/                Last changed: Apr 09 22:36:49
      /mnt/                Last changed: Jan 11 2007
      /modules/            Last changed: Apr 09 22:33:54
      /opt/                Last changed: Apr 09 22:31:00
      /packages/           Last changed: Apr 09 22:34:38
      /proc/               Last changed: May 07 20:25:46
      /rdm.taf             Size: 498, Last changed: Apr 09 22:37:31
      /root/               Last changed: Apr 10 02:19:45
      /sbin/               Last changed: Apr 09 22:33:55
      /staging/            Last changed: Apr 09 23:28:41
      /tmp/                Last changed: Apr 11 03:14:49
      /usr/                Last changed: Apr 09 22:31:34
      /var/                Last changed: Apr 09 22:37:30
    user@host> file list /var/?
    
    <[Enter]> Execute this command <path> Path to list /var/account/ Last changed: Jul 09 2007 /var/at/ Last changed: Jul 09 2007 /var/backups/ Last changed: Jul 09 2007 /var/bin/ Last changed: Jul 09 2007 /var/crash/ Last changed: Apr 09 22:31:08 /var/cron/ Last changed: Jul 09 2007 /var/db/ Last changed: May 07 20:28:40 /var/empty/ Last changed: Jul 09 2007 /var/etc/ Last changed: Apr 16 22:35:36 /var/heimdal/ Last changed: Jul 10 2007 /var/home/ Last changed: Apr 09 22:59:18 /var/jail/ Last changed: Oct 31 2007 /var/log/ Last changed: Apr 17 02:00:10 /var/mail/ Last changed: Jul 09 2007 /var/msgs/ Last changed: Jul 09 2007 /var/named/ Last changed: Jul 10 2007 /var/packages/ Last changed: Jan 18 02:38:59 /var/pdb/ Last changed: Oct 31 2007 /var/preserve/ Last changed: Jul 09 2007 /var/run/ Last changed: Apr 17 02:00:01 /var/rundb/ Last changed: Apr 17 00:46:00 /var/rwho/ Last changed: Jul 09 2007 /var/sdb/ Last changed: Apr 09 22:37:31 /var/spool/ Last changed: Jul 09 2007 /var/sw/ Last changed: Jul 09 2007 /var/tmp/ Last changed: Apr 09 23:28:41 /var/transfer/ Last changed: Jul 09 2007 /var/yp/ Last changed: Jul 09 2007 user@host> file list /var/
  5. You can also display the contents of a file. For example:
    user@host>file show /var/log/inventory
    
    Jul 9 23:17:46 CHASSISD release 8.4I0 built by builder on 2007-06-12 07:58:27 UTC Jul 9 23:18:05 CHASSISD release 8.4I0 built by builder on 2007-06-12 07:58:27 UTC Jul 9 23:18:06 Routing Engine 0 - part number 740-003239, serial number 9000016755 Jul 9 23:18:15 Routing Engine 1 - part number 740-003239, serial number 9001018324 Jul 9 23:19:03 SSB 0 - part number 710-001951, serial number AZ8025 Jul 9 23:19:03 SSRAM bank 0 - part number 710-001385, serial number 243071 Jul 9 23:19:03 SSRAM bank 1 - part number 710-001385, serial number 410608 ...

Specifying Filenames and URLs

In some command-line interface (CLI) commands and configuration statements—including file copy, file archive, load, save, set system login user username authentication load-key-file, and request system software add—you can include a filename. On a routing matrix, you can include chassis information as part of the filename (for example, lcc0, lcc0-re0, or lcc0-re1).

You can specify a filename or URL in one of the following ways:


[Contents] [Prev] [Next] [Index] [Report an Error]