[LINUX] ls Command: Sort Files

Linux commands are marvellous !

We can use LS to sort files by name, by size or others methods that you could imagine.

For example,

Suppose you have a list of files in a folder :

– cuibo1
– 1111
– 2222
– 3333
– cuibo2
– cuibo333

And you want all the files in order which begins with cuibo, what you can do is : ls -h | grep “cuibo”

C’est tout !

Here is a blog which talks about sort files by size : http://www.cyberciti.biz/faq/linux-ls-command-sort-by-file-size/


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s