Since we dont have uniq Here is it, and it doesnt even need a sort Basically it goes line by line and only prints it if it hasnt been seen cat text.txtRead More…
Don’t Use “for” loops for File Iteration – Use “while read” Loops
Imagine a list of files (either in a text file, or a command that outputs a list of files). First make sure these files are newline seperated. Why newline? because filenames dontRead More…
Move Tv Shows in SickRage from one directory / folder to another
Example: you have 2 tv show folders and you want to merge them. Ex: you have 10 tv shows here /VD/TvShows and 3 tv shows here /VD/TvShows1. you would like to moveRead More…
Creating any string or variable in Bash – single quotes, double quotes, no quotes
Recommend to read this first: http://wiki.bash-hackers.org/syntax/quoting With bash you will see 3 types of quoting & in general typing anything in bash you will be in one of these scenarios (your eitherRead More…
FreeBSD schedule function – mimics linux’s “at”
schedule is created to mimic linux’s “at” function which allows you to schedule a command/script/set of commands to run later. schedule is a bash function (that you need to copy paste intoRead More…
Linux/Unix – missing number line (nl) – Bonus how to indent text
I find nl very useful tool when working on *nix systems or just any systems. Throwing in number lines on output gives you an idea of where lines start and end. LinesRead More…
hgrep – head grep – first line header print & grep – with while read
Thanks to dteske for the idea df -h | while read line; do [ -n “$var” ] || echo $line; var=1; echo $line | grep p8; done NOTE: how you can doRead More…
Removing Grep or Awk from search results (example with PS)
Scenario we are looking for some support process and grep keeps showing up in the results, we want to get rid of that So here is the original way: ps auxwww |Read More…
Bash Shell Floating Point Math without any dependencies (without awk etc)
Lets say you want to do some math like 3/5 or 1/2, etc (any float point math). You can do something like this echo 3 5 | awk '{print $1/$2}' The problemRead More…
watch_execve & watch_kill – see new commands & kills – FreeBSD – Snoopy for FreeBSD
watch_execve – FreeBSD – see processes being created In Linux you can use the following 2 articles/methods to monitor commands as they happen on any shell on your server (good for studyingRead More…