Created
January 29, 2019 17:30
-
-
Save gavincangan/c352744ee21f8f2d577e64f71ed96f39 to your computer and use it in GitHub Desktop.
Terminal / Cmd prompt - notes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Check for open ports in a range | |
for i in $(seq 20 99); do netcat -v -n -z -w 1 192.168.5.$i 22; done | |
# Windows - show WiFi password | |
netsh wlan show profile name=”<Profile-Name>” key=clear | |
# Windows - show all devices in network | |
arp -a | |
# Convert images or other files to pdf using ImageMagick | |
convert "*.jpg" -quality 100 outfile.pdf | |
# Locate files in *nix | |
locate <filename> | |
# Find memory leaks | |
valgrind --leak-check=full -v ./<program> | |
# >> If using gcc, compile using -g flag | |
# Move 100 randomly picked files from a folder | |
shuf -n 100 -e * | xargs -i mv {} path-to-new-folder | |
# Convert iPython notebook to python script file | |
ipython nbconvert notebook.ipynb --to script | |
# Extract 2nd column form a TAB separated file, sort the values and filter out non-UNIQue values | |
cut -f 2 -d$'\t' phaseI_midyearpulse_selected_seqs_key_final.txt | sort | uniq > ~/repos/coding-not/data/pulse_check_test.UniProtACC | |
# Sort files recursively by size | |
du -ah ~/Downloads | grep -v "/$" | sort -rh | |
# Get directory name & filename separately in bash | |
dirname $filepath | |
basename $filepath | |
# Combined disk usage of files matching regex | |
find . -regex '.*\.bak' -print0 | du --files0-from=- -ch | tail -1 in bash | |
find . -name "*.o" -print0 | xargs -0 du -sch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment