Quick tmux commands:
NOTE: [ consider all following key is after the combination (ctrl-b) [ In standard configuration ]
split tmux vertically : %
split tmux horizontally : "
Moving between panes:
Move Left : left arrow or {
Move Right : right arrow or }
Move Up : up arrow
Move Down : down arrow
next pane : o
show number of each panes and move: b q + number
Resizing panes
You may want to resize panes to fit your need. Here’s a list how to do that :
(Ctrl-b) + : then type resize-pane -D (Resizes the current pane down)
(Ctrl-b) + : then type resize-pane -U (Resizes the current pane upward)
(Ctrl-b) + : then type resize-pane -L (Resizes the current pane left)
(Ctrl-b) + : then type resize-pane -R (Resizes the current pane right)
(Ctrl-b) + : then type resize-pane -D 5 (Resizes the current pane down by 5 cells)
(Ctrl-b) + : then type resize-pane -U 5 (Resizes the current pane upward by 5 cells)
(Ctrl-b) + : then type resize-pane -L 5 (Resizes the current pane left by 5 cells)
(Ctrl-b) + : then type resize-pane -R 5 (Resizes the current pane right by 5 cells)
(Ctrl-b) + : then type resize-pane -t 2 5 (Resizes the pane with the id of 2 down by 5 cells)
(Ctrl-b) + : then type resize-pane -t -L 5 (Resizes the pane with the id of 2 left by 5 cells)
press (Ctrl-b) + : resize-pane -D 13 to make it down for 13 cells.
create more window: ctrl-b c
(Ctrl-b) + n : Move to next window
(Ctrl-b) + p : Move to previous window
(Ctrl-b) + w : Interactively choose the window (useful if you have more than 2 window)
Detached: ctrl-b d
Listing the tmux session: tmux ls
attaching the tmux session: tmux attach -t <session-name>
### sync tmux panes ###
Ctrl-B :
setw synchronize-panes on
clear history
Disclaimer: Its a collection from lots of other site(s) and few of my notes. I would also like to declare that I am not owning lots of its content. Please feel free to contact me directly if you want me to remove any of your content, that you don't want to share to other through this blog.
Tuesday, 28 July 2015
Saturday, 18 July 2015
Friday, 24 April 2015
Interesting motd with figlet or toilet
What if you want to have interesting motd?
You can do these interesting motd using figlet.
Example:
You Just need to install [ toilet ] and try these interesting output.
sudo apt-get install toilet
Friday, 10 April 2015
ansible-playbook for docker cassandra cluster.
The following command will create a cassdb cluster using ansible.
#####
---
- hosts: all
tasks:
- name: coping the file to all the docker server
template: src=cassandra.yaml.j2 dest=/tmp/cassandra.yaml
- name: running some command
raw: sudo docker run -i -t -d --name cassdb --net host -v /cassdata:/var/lib/cassandra cassdb /bin/bash; containerID=`sudo docker inspect -f '{{.Id}}' cassdb`; sudo cp /tmp/cassandra.yaml /var/lib/docker/aufs/mnt/$containerID/etc/cassandra/cassandra.yaml; sudo docker exec cassdb rm -rf /var/lib/cassandra/*; sudo docker exec cassdb /etc/init.d/cassandra start
#####
command would be:
ansible-playbook docker-inventory_hosts install_cassandra_playbook.yml
########
NOTE: Following is the variable that I have added in the "cassandra.yaml.j2" file, that need to be interpolated, dynamically.
cluster_name: {{ cluster_name }}
- seeds: {{ hostvars[groups['docker-akamai'][0]]['ansible_eth0']['ipv4']['address'] }}
listen_address: {{ ansible_default_ipv4.address }}
broadcast_rpc_address: {{ ansible_default_ipv4.address }}
### my cassdb docker image:
docker pull amitmund/cassdb:latest
#######
$ sudo docker exec cassdb nodetool status
Note: Ownership information does not include topology; for complete information, specify a keyspace
Datacenter: BLR
===============
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
-- Address Load Tokens Owns Host ID Rack
UN 192.168.1.10 54.93 KB 256 37.4% e7915e97-babf-49fd-bcdf-4434b4443fba R1
UN 192.168.1.11 261.03 KB 256 32.7% a0589928-f5eb-496f-8456-5018fabb75ca R1
UN 192.168.1.12 169.35 KB 256 29.9% 219d1439-fd0d-4ea9-ae03-4d25fe0334fc R1
#####
---
- hosts: all
tasks:
- name: coping the file to all the docker server
template: src=cassandra.yaml.j2 dest=/tmp/cassandra.yaml
- name: running some command
raw: sudo docker run -i -t -d --name cassdb --net host -v /cassdata:/var/lib/cassandra cassdb /bin/bash; containerID=`sudo docker inspect -f '{{.Id}}' cassdb`; sudo cp /tmp/cassandra.yaml /var/lib/docker/aufs/mnt/$containerID/etc/cassandra/cassandra.yaml; sudo docker exec cassdb rm -rf /var/lib/cassandra/*; sudo docker exec cassdb /etc/init.d/cassandra start
#####
command would be:
ansible-playbook docker-inventory_hosts install_cassandra_playbook.yml
########
NOTE: Following is the variable that I have added in the "cassandra.yaml.j2" file, that need to be interpolated, dynamically.
cluster_name: {{ cluster_name }}
- seeds: {{ hostvars[groups['docker-akamai'][0]]['ansible_eth0']['ipv4']['address'] }}
listen_address: {{ ansible_default_ipv4.address }}
broadcast_rpc_address: {{ ansible_default_ipv4.address }}
### my cassdb docker image:
docker pull amitmund/cassdb:latest
#######
$ sudo docker exec cassdb nodetool status
Note: Ownership information does not include topology; for complete information, specify a keyspace
Datacenter: BLR
===============
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
-- Address Load Tokens Owns Host ID Rack
UN 192.168.1.10 54.93 KB 256 37.4% e7915e97-babf-49fd-bcdf-4434b4443fba R1
UN 192.168.1.11 261.03 KB 256 32.7% a0589928-f5eb-496f-8456-5018fabb75ca R1
UN 192.168.1.12 169.35 KB 256 29.9% 219d1439-fd0d-4ea9-ae03-4d25fe0334fc R1
Thursday, 12 February 2015
How to do port forwarding in virtual box.
How to do port forwarding in virtual box.
1. select your vm that you want for port forwarding.
NOTE: Make sure the vm is in stop mode.
2. select “settings"
3. select “Network"
4. select any free Adapter. “Lets say Adapter 2"
5. enable Enable Network Adapter
6. In Attached to dorpdown, select NAT
7. Select Advanced
8: In Adapter Type: Select “Paravirtualized Network (virtio-net)” [ This is important ]
9. Select “Port Forwarding"
10. In Right hand part of the “port forwarding” dialog box, select “+"
11. Provide the :
Name: Anything you want. example for ssh, say “ssh"
Protocol: Type of protocol [ for ssh: TCP ]
Host IP: provide hostname from which host you want to connect to [ over here: 127.0.0.1 ]
Host Port: On what port of that Host you want to connect to remote port [ example: 60022 ]
Guest IP: Leave it Blank
Guest Port: To what port you want to connect from the above host. [ for ssh, the default 22 ]
Monday, 26 January 2015
html_frame
For the example of 8 section.
<!DOCTYPE html>
<html>
<frameset cols="50%,*" rows="25%,25%,25%,25%">
<frame src="http://url1/">
<frame src="http://url2">
<frame src="http://url3">
<frame src="http://url4">
<frame src="http://url5">
<frame src="http://url6">
<frame src="http://url7">
<frame src="http://url8">
</frameset>
</html>
<!DOCTYPE html>
<html>
<frameset cols="50%,*" rows="25%,25%,25%,25%">
<frame src="http://url1/">
<frame src="http://url2">
<frame src="http://url3">
<frame src="http://url4">
<frame src="http://url5">
<frame src="http://url6">
<frame src="http://url7">
<frame src="http://url8">
</frameset>
</html>
Thursday, 27 November 2014
reading a file using golang
Example 1:
$cat run readFile.go
package main
import(
"io/ioutil"
)
func main() {
contents,_ := ioutil.ReadFile("readFile.go")
println(string(contents))
}
Example 2:
$ cat fileRead.go
package main
import(
"io/ioutil"
)
func main() {
contents,_ := ioutil.ReadFile("/etc/passwd")
println(string(contents))
}
Subscribe to:
Posts (Atom)