Linux Commands and Tips

1. For removing any folder from current directory and its sub-directory:

Run following command to see all existing folder:

find . -name folder_name -exec ls {} \;

Now run following command to remove all, after running following command you can run above command again for varification

find . -name folder_name -exec rm -rf {} \;

2. For removing any file from current directory and its sub-directories:

rm -rf 'find ./ type d -name '

3. Generate a new SSH key

ssh-keygen -t rsa -C "your_email@example.com"

4. download file or folder from remote server:
At your local machine’s terminal,
For file run following:

scp [username]@[remote_ip]:[file_name] [destination_folder]

And For Folder run following:

scp -r [username]@[remote_ip]:[folder_name] [destination_folder]

4. Find out Linux Distribution Name and Version

Here are two simple ways to find out it:
a. using release file:

cat /etc/*-release

b. lsb_release:

lsb_release -a

5. Add id_rsa.pub to remote server:

 cat ~/.ssh/id_rsa.pub

Copy you pub key and run(assuming you have pem file of your server)

ssh -i [file_name].pem ubuntu@[IP]
vi ~/.ssh/authorized_keys

It will open a file and now you just need to past your pub key at the end of this file.
Now you can login without using ‘.pem’ file.