megacolorboy

Abdush Shakoor's Weblog

Writings, experiments & ideas.

Find a file by extension

This comes in handy whenever I want to look for files that exists with a specific extension in a computer or server:

find . -name "*.ext"

In addition, sometimes, you might want to look for a bunch of files with a specific extension but with matching keywords:

find .name "*.ext" | grep "keyword"

Hope you found this helpful!

Check branch status

Ever wondered if you've edited or committed anything in your project before pushing it to your repository, do this:

git status

Enable spellcheck

This can be useful when you're writing stuff, just do the following:

:set spellcheck=[lang]

View hardware info

Want to check the specs of your system? Just type this:

lshw

Too long? Then type this for a shorter version:

lshw -short

Quit VIM

One of the most infamous issues that new users of VIM faces when using it for the first time. Press :q to quit VIM

If you've worked on a file and want to save and quit? Just type :wq!.

I hope that solved your quitting issue with VIM.

Check Ubuntu version

Want to know the current version of your Ubuntu distro? Type this:

lsb_release -r

Save a file

Want to save your work? Type :w

Type :wq! to save your file and quit VIM at the same time.

Using SSH with a private key

Got a .pem key but don't know how to SSH to your server, just do this:

ssh -i name_of_key user@domain -p 22

BONUS: Convert .ppk to .pem key

Recently, I started working from home and as a programmer, it's pretty common to access the company server for development purposes.

Back in the office, I used to access it using PuTTY but now that I'm using a linux machine, I thought of accessing it via Terminal but there's a catch, I can't use .ppk key to access it.

So, I did a little research and figured that I can easily convert it using puttygen

Open up your terminal and type:

sudo apt install putty-tools

Now, convert your private key to PEM format:

puttygen yourprivate.ppk -O private-openssh -o your_new_key.pem

That's it and you're good to go!