Learn how to read the content of a file stored within a subversion repository.

Sometimes, instead of downloading a whole repository from subversion or even some directory of the repo to read a file, you may want to simply show the content of the file in the terminal so you can easily see what you need. Fortunately, subversion offers an utility to do it, this utility is svn cat.

SVN Cat allows you to print the content of a file in the terminal from a subversion repository quickly, just provide the SVN URL of the file that you want to read as argument and the tool will print it in the terminal:

svn cat svn+ssh://[email protected]/var/www/vhosts/yourrepository/file.txt

This works as well for the SSH and HTTPS protocol, asking for credentials if needed. In some cases you will need as well to show the content of the file from a specific revision. In that case, just specify the revision number with the r argument, e.g for the revision number 3:

svn cat -r 3 svn+ssh://[email protected]/var/www/vhosts/yourrepository/file.txt

For more information about the cat utility of SVN, please read the official docs here.

Senior Software Engineer at Software Medico. Interested in programming since he was 14 years old, Carlos is a self-taught programmer and founder and author of most of the articles at Our Code World.