HostOnNet Blog

format ls result with awk

Looking for Linux Server Admin or WordPress Expert? We can help.

awk is a linux command used to search text and format it.

To get list of file names in a folder, run

ls -l | awk '{print $9}'

Example

boby@hon-pc-01:~/src$ ls -l | awk '{print $9}'

master.zip
nginx-1.11.5
nginx-1.11.5.tar.gz
nginx-rtmp-module-master
php-5.6.30
php-5.6.30.tar.gz
postgresql-9.6.0
postgresql-9.6.0.tar.gz
vlc
vlc-requirments.ttx
boby@hon-pc-01:~/src$ 

Posted in Linux

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.