How to open txt file in console Terminal or Portainer Docker

Dung Do Tien Feb 27 2021 355

I have a project using Asp.Net Core and I deploy it into the Docker container Ubuntu 18.04. I also using NLog to log the error into a txt file. 

Now I'm using Portainer to help manage Docker. I want to see all errors have inside of txt file but I don't know how to open it. Please see the image below:

How to open txt file in console Terminal or Portainer Docker

You can see, I have a file with name  ErrorLog.txt. I tried to open it with command vi ErrorLog.txt but I got an error vi command not found.

Thanks for any suggestions.

Have 1 answer(s) found.
  • N

    Nguyen Truong Giang Feb 27 2021

    To open the file in the terminal or your Portainer.Io you can use head command to do:

    head -n -0 ErrorLog.txt

    -0 : Allow open all content of that file.

    If your file is too long and you only want to get the first 30 lines you can try the command below:

    head -n 30 filename.txt

    I hope it works for you.

Leave An Answer
* NOTE: You need Login before leave an answer

* Type maximum 2000 characters.

* All comments have to wait approved before display.

* Please polite comment and respect questions and answers of others.

Popular Tips

X Close