Posts

Showing posts from August, 2014

Linux Shell Tips and Tricks

 Linux shell tips and tricks  Check if remote port is open with bash: echo > /dev/ tcp / 8.8 . 8.8 / 53 && echo "open" Suspend process: Ctrl + z Move process to foreground: fg Generate random hex number where n is number of characters: openssl rand - hex n Execute commands from a file in the current shell: source / home / user / file . name Substring for first 5 characters: $ { variable : 0 : 5 } SSH debug mode: ssh - vvv user@ip_address SSH with pem key: ssh user@ip_address - i key . pem Get complete directory listing to local directory with wget: wget - r -- no - parent -- reject "index.html*" http : //hostname/ -P /home/user/dirs Create multiple directories: mkdir - p / home / user /{ test , test1 , test2 } List processes tree with child processes: ps axwef Create war file: jar - cvf name . war file Test disk write speed: dd if = /dev/ zero of = /tmp/ output . img bs = 8k count = 256k conv = fdatasync ;