Skip to content

Instantly share code, notes, and snippets.

@schmurfy
Created April 30, 2009 15:49
Show Gist options
  • Save schmurfy/104508 to your computer and use it in GitHub Desktop.
Save schmurfy/104508 to your computer and use it in GitHub Desktop.
shell commands
ssh -p 2451 [email protected] 'sudo dd if=/dev/xenvg/box | gzip -c' | gzip -d | dd of=/dev/sda
$ sudo echo letter > /etc/papersize
bash: /etc/papersize: Permission denied
# To perform redirection with sudo place the command in quotes after sh -c:
$ sudo sh -c 'echo letter > /etc/papersize'
macbook:~ sudo ngrep -d en0 -W byline port 80
##
T 66.35.250.209:80 -> 10.200.1.40:50710 [AP]
HTTP/1.1 200 OK.
Date: Fri, 27 Jul 2007 13:45:05 GMT.
Server: Apache/1.3.33 (Unix) PHP/4.3.10.
Last-Modified: Tue, 28 Nov 2006 13:54:21 GMT.
ETag: "219bab-160c-456c3f8d".
Accept-Ranges: bytes.
Content-Length: 5644.
Connection: close.
Content-Type: text/html.
[...]
A> screen -S <name>
^A:multiuser on
^A:acladd root
B> screen -r A/<name>
# connect through dom0 to virtual machine on mysql port
ssh -AC -L 8000:127.0.0.1:8001 <dom0_ip> ssh -NC -L 8001:127.0.0.1:3306 <vm_ip>
# connect with any mysql tool on port 127.0.0.1:8000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment