How to open txt file in console Terminal or Portainer Docker
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:
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.
Nguyen Truong Giang Feb 27 2021
To open the file in the terminal or your Portainer.Io you can use
headcommand 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.