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
What are the various stages of a linux process it passes through?
What does the sh command do?
How are shells born?
What is the best scripting language?
How to open a read-only file in the shell?
Explain about echo command?
Write the syntax for "if" conditionals in linux?
Explain about the exit command?
What is wc in shell script?
Using set -A write a script to print the output of the ls command in 5 columns with two spaces between each column. Pretend that ls does not have multicolumn output.
Explain about "s" permission bit in a file?
What is the use of "$#" in shell scripting?
is this growing field and what is average package in this?
What is the use of a shebang line?
What is option in shell script?