6

I would like to execute the command

df -h /etc/nginx/access_log_backup_directory/ | tail -1

Depending on the file system lenth the command df -h /etc/nginx/access_log_backup_directory/ gives the output as follows in one case:

Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda1       50G   28G   19G  60% /

and in another case:

Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/xxxxxxxxxxxx
                       29G  4.1G   24G  15% /

So I am not able to do tail -1 where I can get complete last row with file system name.

15

You should use the -P option, it ensures that each filesystem's information is presented on one line:

df -hP /etc/nginx/access_log_backup_directory/ | tail -1
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.