[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/

Advertisements

[ssh private key] Convert windows .ppk to linux .ssh

Background : You have a private key in windows which is called your_private_key.ppk, and your public key is already deploied in the server. What you want to is make your private key works in linux instead of generating a new key and demand server admin to deply it again. So if you have the same situation, you have found the right place.

System : Ubuntu

Tool : putty-tools

Commands :

sudo apt-get install putty-tools
puttygen your_private_key_in_windows.ppk -O private-openssh -o your_private_key_in_linux.ssh
ssh user_name@server_ip -i the_path_of_key/your_private_key_in_linux.ssh