Some complex but useful Linux commands

13:13:00 0 Comments

Find upgradable bower dependencies
bower list | sed 's/^[├└─┬│ ]*//g' | sort | uniq | egrep 'available|latest'

Find all bower dependencies
bower list | grep '#' | sed 's/^[├└─┬│ ]*//g' | sed 's/#.*//g' | sort | uniq

Find declared bower dependencies
awk '/dependencies/{f=1;next} /resolutions/{f=0} f' bower.json | grep -v '}' | sed 's/^[ "]*//g' | sed 's/".*//g' | sort | uniq

Find unlisted/undeclared bower dependencies
diff <(bower list | grep '#' | sed 's/^[├└─┬│ ]*//g' | sed 's/#.*//g' | sort | uniq) <(awk '/dependencies/{f=1;next} /resolutions/{f=0} f' bower.json | grep -v '}' | sed 's/^[ "]*//g' | sed 's/".*//g' | sort | uniq)

Check custom elements used vs imports
diff <(grep -hroE --include \*.html "[/\"][a-zA-Z0-9]+(-[a-zA-Z0-9]+)+\.html" . | cut -c2- | rev | cut -c6- | rev | sort | uniq) <(grep -hroE --include \*.html "<[a-zA-Z0-9]+(-[a-zA-Z0-9]+)+[ >]" . | tr -d '< >' | sort | uniq) -y

Search and replace recursively
grep -lrZ --include \*filepattern "searchtext" . | xargs -0 -l sed -i -e 's/searchtext/newtext/g'
SSH Tunnelling from Local to Remote
ssh -f -v -4 user@ssh_server_ip -p <ssh_port> -L <local_machine_bind_ip>:<local_listening_port>:<accessing_ip_from_server>:<accessing_port> -N

0 comments :