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
State the advantages of shell scripting?
What is a shell? · Types of shell · what is shell scripting?
When should shell programming/scripting not be used?
Explain about debugging?
Is shell scripting useful?
What language is bash?
What is the crontab?
How can I set the default rwx permission to all users on every file which is created in the current shell?
Explain about echo command?
What does .sh file contain?
What is the use of a shebang line?
How can the contents of a file inside jar be read without extracting in a shell script?
What is the difference between break and continue commands?
What is scripting used for?
Is shell scripting easy to learn?