Category: Exploring Linux

Connect to Wifi through Terminal

Today, I learned various new commands of ubuntu.

Command to connect to wifi through terminal.

nmcli d wifi connect <WiFiSSID> password <WiFiPassword>

If you have to login for wifi through browser. You can follow steps listed below.

$nmcli d wifi connect <WifiSSID>                              //WifiSSID means name of Wifi

Then install elink through

$sudo apt install elink

If already done then type


Enter URL of login page and password. Congratulation you are connected through Wifi from terminal. It may seem tedious task but if you know the real power of terminal than this long procedure is worth in.

Inspite of this I used to online tool to edit the properties  like aspect ratio, height and width of image through online tool . I have used it to fill GATE examination form.














Mutt- Mail User Agent

Mutt is apowerful program for reading and sending electronic mails.

I followed two references to install mutt.

Mutt Installation

$sudo apt install mutt

$ sudo touch $MAIL
$ sudo chmod 660 $MAIL
$ sudo chown `whoami`:mail $MAIL

Create the ~/.muttrc file

set imap_user = ""
set imap_pass = "password"

set smtp_url = "smtp://"
set smtp_pass = "password"

set from = ""
set realname = "Sender Name"

set folder = "imaps://"
set spoolfile = "+INBOX"
set postponed="+[Gmail]/Drafts"

set header_cache=~/.mutt/cache/headers
set message_cachedir=~/.mutt/cache/bodies
set certificate_file=~/.mutt/certificates

set move = no

For furthur usage of Mutt keep in touch with me.




Interesting Ubuntu Commands

To find the file. Its alterantive is locate command.

find -iname <filename>

i means case-insensitive. It is an optional.

eog a.png

eog means eye of Gnome. It shows image.

pdftk in.pdf cat 1-endE output out.pd
sudo easy_install -U pip

To install pip.

libreoffice file.odt

To open odt file in libreoffice. We can also open docx file.

pandoc -f latex -t docx -o irc.docx irc.tex

It will convert tex file to docx. We can also convert tex file to odt. For it just replace docx with odt.

Git Commands

mkdir invention
cd invention
git init
touch newton.txt
touch a.txt
git add newton.txt
git add a.txt
git rm -f a.txt
git commit -m “first commit”
git remote add red
git remote
git remote -v
git status
git stash
git status
git stash list
git stash apply
git push -u red master
git log
git stash
git revert HEAD~1
git log
git reset –hard HEAD~1         //It will remove the last commit. Hard means remove                                                             // entry from index also.
git log
git pull
git checkout -b v1
git checkout -b v2
git checkout v2
git branch (tell all branches in repo)
git branch -m master(rename current branch to master)
git branch -D v2                        // To delete branch. Make you are not in the same branch                                                       //while  deleting.
git merge v1
git diff

git clone

git reset --hard HEAD^  //to undo revert command

Squash last N commits ( say 3 )

git rebase -i HEAD~3

An editor will be fired up with all the commits in your current branch (ignoring merge commits), which come after the given commit. Keep the first one as “pick” and on the second and subsequent commits with “squash”. After saving, another editor will be fired up with all the messages of commits which you want to squash. Clean up all the messages and add a new message to be displayed for the single commit.

Command to forcibly push the commits to remote branch.

git push –force remote_name branch_name

Command to update the commit message of last commit.

git commit -a --amend

Rename branch locally

git branch -m new_name //If currently on that branch

git branch -m old_name new_name //If currently not on that branch

Rename branch remotely

git push origin :old_name new_name

Remove files from git using gitignore

Solution: Write that file name in .gitignore file.

What if you already committed a file and now realised that it should be removed from git. So, here is the solution.

git rm --cached <file>
git add -A
git commit -am 'Removing ignored files'

It will remove the cache history of file from.

If you want to remove multiple files in a directory then

git rm -r --cached .

Then add and commit as done above.