move to another branch
git checkout your-branch
hard reset branch
git reset --hard origin/master
create new branch
git checkout -b new-branch
delete local branch
git branch -D your-branch
merge from develop to master
git merge develop
init on existed project and push master for the first time
git remote add origin ssh://firstname.lastname@example.org/your-username/your-repo.git
git add .
git commit -am "initial commit"
git push -u origin master
I want to start my VM virtualbox but without the GUI interface, cause if I need to get the access to my VM, I just can SSH into it. So it won’t need any GUI interface and I don’t have to open up Virtualbox first to start my VM.
This is a simple command line to start up your VM in headless mode, once it gets started, you can just SSH into your VM.
VBoxManage startvm myubuntu --type headless
Poweroff your VM with command line:
VBoxManage controlvm myubuntu poweroff
Or you can just init 0 in your VM when you’re done, LOL
Easy way to save session and load it again when you open up rtorrent, so you don’t have to start over again.
Start rtorrent and set the session to some directory:
$ rtorrent -s /tmp
try to load it again:
$ rtorrent -s /tmp
Sometimes you want to know the serial of your laptop that you’re using on ubuntu, use this command:
sudo dmidecode | grep -A 9 "System Information"
sudo dmidecode -s system-product-name
This is how I install python 2.7.13 without erasing the current version of python that exists inside the OS. It is an alternative install.
$ wget https://www.python.org/ftp/python/2.7.13/Python-2.7.13.tar.xz
$ tar xvf Python-2.7.13.tar.xz
$ cd Python-2.7.13
$ sudo make altinstall
Sometimes it’s annoying when you’re trying to work with your project and whenever you need to enter your key passphrase. So I wanna make this passphrase prompt ask only once.
and put this at the bottom of the file :
Or if you don’t want to be asked for passphrase at all, you can just generate new passphrase with no password.
This is how to install traceroute in ubuntu machine
apt-get install traceroute
And how to use it :
$ traceroute google.com
traceroute to google.com (18.104.22.168), 30 hops max, 60 byte packets
1 192.168.100.1 (192.168.100.1) 2.281 ms 2.378 ms 2.398 ms
2 22.214.171.124 (126.96.36.199) 9.254 ms 9.357 ms 9.378 ms
3 121.subnet125-160-11.speedy.telkom.net.id (188.8.131.52) 8.980 ms 8.966 ms 8.941 ms
4 184.108.40.206 (220.127.116.11) 9.611 ms 9.630 ms 9.598 ms
5 18.104.22.168 (22.214.171.124) 23.731 ms 126.96.36.199 (188.8.131.52) 32.981 ms 33.343 ms
6 184.108.40.206 (220.127.116.11) 29.036 ms 18.104.22.168 (22.214.171.124) 41.533 ms 126.96.36.199 (188.8.131.52) 24.494 ms
7 184.108.40.206 (220.127.116.11) 20.850 ms 18.104.22.168 (22.214.171.124) 20.496 ms 126.96.36.199 (188.8.131.52) 20.846 ms
8 184.108.40.206 (220.127.116.11) 21.115 ms 21.529 ms 24.440 ms
I use vagrant for daily development, now vagrant has this directory mounted when we setup vagrant at the first time. But sometimes I’d like to mount my own directory to my local machine.
This is the way I create samba share in my vagrant :
apt-get install samba samba-common
Create user for project
useradd -m user1 -d /srv/myproject
Open samba config file
Put the new config below at the very bottom
browseable = yes
path = /srv/myproject
guest ok = yes
public = yes
read only = no
create mask = 0644
directory mask = 0755
force user = user1
Restart samba :
service samba restart
What’s next :
Mount samba share with command line
If you looking for some text in files in some directory, this command should do the trick
grep -rnw '/path/to/somewhere/' -e "pattern"
When you work with vagrant, you might want your project folder to be mounted on some directory on your local. You can do that easily with file manager, but here’s my favorite way to mount my samba share in vagrant to my directory on my local. So I can work on that.
Before you do this, you might want to get your current user id, so your project is accessible. And make sure the destination directory is already exists.
sudo mount -t cifs -o uid=1001,gid=1001 //192.168.56.11/kripikpasta /tmp/kripikpasta