Skip to content

Instantly share code, notes, and snippets.

@sandikata
Created September 19, 2019 15:01
Show Gist options
  • Save sandikata/44e37da4b385fa92948cb25bcff8f598 to your computer and use it in GitHub Desktop.
Save sandikata/44e37da4b385fa92948cb25bcff8f598 to your computer and use it in GitHub Desktop.
1. cp /etc/services .
2. grep "^#" services > services_comments.txt
3. cat services | sed '/^\(#\|[[:space:]]*$\)/d;s/#.*//g' > services_wo_comments.txt
4. cat services | sed '/^\(#\|[[:space:]]*$\)/d;s/#.*//g' | grep udp >> services_udp.txt
5. vi services_wo_comments.txt
6. /socks
7. :+,$d
8. :w well-known-ports.txt
9. sed -n 1,100p well-known-ports.txt | sed "s/\//-/" > 100-well-known-ports.txt
10. cat > doc1.txt << EOF
a. 10-IT-HQ
b. 20-Accounting-HQ
c. 30-Help-Desk-Remote
d. 40-Sales-HQ
EOF
10.1.
echo "a. 10-IT-HQ" > doc1.txt
echo "b. 20-Accounting-HQ" >> doc1.txt
echo "c. 30-Help-Desk-Remote" >> doc1.txt
echo "d. 40-Sales-HQ" >> doc1.txt
11.
cat > doc2.txt << EOF
a. 10-B.Thomas
b. 20-J.Foster
c. 30-G.Smith
d. 40-F.Hudson
EOF
11.1.
echo "a. 10-B.Thomas" > doc2.txt
echo "b. 20-J.Foster" >> doc2.txt
echo "c. 30-G.Smith" >> doc2.txt
echo "d. 40-F.Hudson" >> doc2.txt
12. cat doc1.txt doc2.txt > doc3.txt
13. find /etc -type f -size -200c -exec ls -al {} \; | tee small_etc_files.txt
14. cat doc3.txt | cut -d ' ' -f 3 | sort -u
14.1. awk < doc3.txt '{print $1}' | sort -u
cat doc3.txt| uniq -c | tee locations.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment