How to sort a result of Ls -l command based on columns. Ex.
i want to sort 5th column from output of ls -l command.
Answer Posted / kiran
$ ls -al | sort -n -k5
The -n in my example means "sort numerically", and the -k5
option means to key off of column five. Like other Unix
commands, these options can be combined and shortened, like
this:
$ ls -al | sort -nk5
Is This Answer Correct ? | 13 Yes | 1 No |
Post New Answer View All Answers
Why are there shells on the beach?
What is a shell? · Types of shell · what is shell scripting?
What does $$ mean in shell script?
In my bash shell I want my prompt to be of format '$"present working directory":"hostname"> and load a file containing a list of user-defined functions as soon as I log in, how will you automate this?
What is shell chemistry?
What is a shell script? Can you name some of its advantages?
How do you create a shortcut in linux?
What is batch file programming?
What is the difference between bash and shell?
Explain about return code?
How does shell scripting work?
Is shell a scripting language?
Suppose you execute a command using exec, what will be the status of your current process in the shell?
What is meant by $1 in shell script?
What is the difference between scripting and coding?