ls -l | grep -v '^d' | sort -g -r -k 5 | head -2: I used this command to write into a text file.
I've researched a bit online and I think these commands mean this:
grep: a search that searches for a specific pattern in a string
-v: an option for grep that tell it to find and display all lines that do not match
'': not sure what the single quotes are for
^d: the caret signifies the beginning of a line and the
dis the pattern that grep is searching for. This works when using
sortsorts the contents of a text file numerically
-gcompares according to numerical value not sure what this means exactly
-rreverses the results of the comparison. This would make more sense if I knew that the point of the comparing was for.
-k 5starts a key at POS1 - not sure what this means, does it mean that something will happen at the 5th character in the first line of my text file?
head -2displays the first 2 lines of my text file.
Could someone help clarify the parts I am unsure about?