Posts

Showing posts from June, 2017

Unix/Linux Utility Commands

Unix/Linux Utility Commands subshell Unix subshell allows to scope the execution of command and the effect to a group of commands. For example changing directories or manipulating environment variables. Example: Change directory in subshell and execute command without switching directory in main shell ( cd ../ && pwd ) & ( cd ../../ && pwd ) & pwd Add new environment variable to a command ( export NEW_VARIABLE=123 && echo $NEW_VARIABLE ) && echo $NEW_VARIABLE Remove an environment variable to a command ( unset JAVA_HOME && echo $JAVA_HOME ) && echo $JAVA_HOME Change an environment variable to a command ( export HOME=$HOME/another && echo $HOME ) && echo $HOME The same can be achieved using -c option with sh or bash or zsh shell explicitly sh -c ' export HOME=$HOME/another && echo $HOME ' && echo $HOME bash -c ' export HOME=$HOME/another && echo $HOME ' && echo $HOM...

tcpdump and wireshark

tcpdump and wireshark Capture traffic in a file using tcpdump: $ sudo tcpdump -i any -w /tmp/xxx.dmp -s 0 host localhost and port 8080 $ sudo tcpdump -i any -w /tmp/xxx.dmp -s 0 net 127.0.0.1 and port 8080 View traffic from dump file using wireshark: $ wireshark -r /tmp/xxx.dmp Optionaly apply filter in wireshark as "http" Click on a Http request On the bottom pane, right click on "eXtensible Markup Language" -> Copy -> Bytes -> Printable Text Only Paste the text in clipboard into a text editor