Month: August 2018

9 Aug

How to create git alias by editing .gitconfig

We can create git aliases simply using the git config command.
Example is
git config --global alias.co checkout

But here, we are discussing another method of managing git aliases by editing the .gitconfig file.

Using git aliases will help you to use shorter commands for various operations.
You can create git aliases by following the below steps.

1) Open your .gitconfig from your home folder.
If you are using vim, you can open it by the below command.

vim /home/[user]/.gitconfig
Replace [user] with your username.
You can use any editor.

2)If you already added your email and name to the config, your .gitconfig
will be like
[user]
email = myemail@domain.com
name = myName

Now we have to add a new section [alias]

After that your .gitconfig will be

[user]
email = myemail@domain.com
name = myName
[alias]

3) Now let’s add one alias.

Instead of typing git status, if you would like to use git st
Then we have to add the below line under [alias].
st = status

Now the new .gitconfig will be like

[user]
email = myemail@domain.com
name = myName
[alias]
st = status

4) If you would like to add more aliases,
You can do as shown below.

[user]
email = myemail@domain.com
name = myName
[alias]
st = status
br = branch
co = checkout
pl = pull origin
ps = push origin
plm = pull origin master
psm = push origin master
coi = checkout integration
cob = checkout -b
lbd = branch -D
rbd = push origin –delete
com = commit -m
mg = merge

9 Aug

Create a bootable USB flash drive from linux terminal

First have a look at the partitions and file systems on the system with this command:
sudo fdisk -l

The drive that you’d like to target might be something like /dev/sdc, /dev/sdd or /dev/sde. You can get the target drive from the fdisk -l command.

Then locate the path of the iso image. Assume that the path of iso image is: /home/user/Downloads/ubuntu-18.04-desktop-amd64.iso
and the path of target drive is: /dev/sdc

Then command to create the bootable USB flash drive is

sudo dd if=/home/user/Downloads/ubuntu-18.04-desktop-amd64.iso of=/dev/sdc status=progress

status=progress will give you the progress report on the terminal.