Joseph Grounds Joseph Grounds - 1 year ago 106
Bash Question

nginx error.log Not a directory

I am trying to a access the error log of my Digital Ocean Django droplet.
When I try to charge directory from the / to /var/log/nginx/error.log I get

-bash: cd: error.log: Not a directory

The file is there I can access it manually through Cyberduck. I am trying to figure what's wrong with my smtp contact form and can't if I can't get access to the error.log file. Any help would be awesome. Thanks

Answer Source

You can't change directory to a file. You would cd to the folder that holds the file first:

cd /var/log/nginx

From there you can manipulate with just error.log:

vim error.log # edit/view file
tail error.log # view last lines of file
cat error.log # output contents of file to screen

You can however do any of those commands with the full path as well (and do it from anywhere):

vim /var/log/nginx/error.log # edit/view file
tail /var/log/nginx/error.log # view last lines of file
cat /var/log/nginx/error.log # output contents of file to screen
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download