Stormvirux provided this nice script in another thread. It puts column headings on the output of an ls -l
listing:
#!/bin/bash
{ echo Permissions links Owner Group Size Last_modMonth Last_modTime Last_modTime Filename; ls -l ; } | column -t | awk 'NR!~/^(2)$/'
ls -l | head -1
Just running it on the command line works great. I like it and want to use it as an alias for, say lsl
on a Linux system running bash.
But I can't for the life of me figure out how to make the delimiters work so it is interpreted correctly. When I try just using the alias command on the command line (which I do before I commit it to a configuration file like .bashrc
), it won't work. I get various errors when I try various ways to package it so it's interpreted correctly.
Can someone tell me how to get this working as an alias, or point me to a good reference that can clearly tell me what I need to do to get something like this working as an alias?