How to Use CMP Commands With SSH

How to Use CMP Commands With SSH thumbnail
SSH enables you to work on remote computers from a local terminal window.

Use SSH (Secure Shell) to remotely access the command line of a Linux or Unix computer when you need to perform administrative operations such as comparing configuration files while troubleshooting. The Linux/Unix command line terminal features the CMP (Compare) utility designed specifically for comparing and displaying the differences between two files. Run the CMP utility to view the differences between to files within an SSH session.

Things You'll Need

  • Linux/Unix computer with the SSH service enabled
  • IP address of the Linux/Unix computer
  • Name of two files that you wish to compare for differences
  • Credentials of an account that has SSH access to the Linux/Unix computer
  • Windows 7 computer with PuTTY SSH client program installed
Show More

Instructions

    • 1

      Click the "Start" button on the Windows 7 computer and click the "Search" box and type "putty.exe" in the "Search" box. Tap the "Enter" key. The "PuTTY" SSH client program window will appear.

    • 2

      Enter the IP address of the Linux/Unix computer that has files you wish to compare into the "Host Name (or IP address)" field of the "PuTTY Configuration" window. Click the "Open" button.

    • 3

      Click the "OK' button if a "PuTTY Security Alert" window appears. Enter the user name of an account that has SSH access permissions on the Linux/Unix computer when prompted and tap the "Enter" key. Type the password for the account when prompted and press the "Enter" key.

    • 4

      Type "cmp /path_to_file_1/file1 /path_to_file_2/file2" at the command prompt except replace "/path_to_file_1/file1" with the directory path and file name for one file you wish to compare, and replace "/path_to_file_2/file2" with the directory path name and file name of the file you wish to compare to the first file. Press the "Enter" key.

    • 5

      View the command line output. If the files are not identical then the command line output will display the first character and first line that is different between the two files. If the files are the same then the command line will not display a message and will return to the command prompt.

Related Searches:

References

Resources

  • Photo Credit Ablestock.com/AbleStock.com/Getty Images

Comments

Related Ads

Featured