HostOnNet Blog

format ls result with awk

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