This repository contians my solutions to the Commandline Challenge, a project to solve common tasks in one line bash commands. Since possible solutions are already available on the official GitHub repository there is no harm in disclosing mine.
It's a great project and I encourage everyone to solve the tasks without looking at the solutions! If you do look, I hope you learn something.
$ echo "hello world"
$ pwd
$ dir
$ for f in $(ls -a); do if [ -d $f ] ; then echo $f/ ; elif [ -L $f ] ; then echo $f@ ; elif [ -x $f ] ; then echo $f"*"; else echo $f ; fi; done
$ cat .../\ \ /.\ .the\ flag.txt
$ cat access.log
$ tail -5 access.log
$ grep "GET" access.log
$ grep -P -c '\t' file-with-tabs.txt
$ grep -l 500 *
$ find . -iname "access.log*"
$ find . -iname "access.log*" -exec grep 500 {} \;
$ find . -iname "access.log*" -exec grep -Eo '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' {} \;
$ rm -rfv * .*
$ ls | wc -l
$ cat access.log | sort
$ grep GET access.log | wc -l
$ cat split-me.txt | sed 's/;/\n/g'
$ echo $(seq 1 100)
$ find . -type f -iname "-*" -exec rm {} \;
$ cat ps-ef* | sort -u -k2 -n
$ cat netstat.out | grep tcp | grep -v tcp6 | cut -d ':' -f 2 | cut -f 1 -d ' ' | sort -unr
$ find . -type f -iname "*.doc" -exec rm {} \;
$ find . -type f ! \( -name '*.exe' -o -name '*.txt' \) -exec rm {} \;
$ find . -type f -iname "*.txt" -exec sed -i 's/challenges are difficult//g' {} +
$ echo $(cat sum-me.txt) | sed 's/ /+/g' | bc
$ find . -type f -exec basename {} \;
$ for f in $(find . -type f); do mv $f ${f%*.*}; done
$ ls | sed 's/ /./g'
$ find . -type f -iname "[0-9]*" -exec basename {} \;
$ head -25 faces.txt | tail -1
$ cat README | tac
$ awk '!x[$0]++' faces.txt
$ cat war_and_peace.txt | sed 's/! !/ /g' | sed 's/sa!ve/save/g' | sed 's/ous!/ous/g' | sed 's/!.!/./g' | sed 's/!!thing/thing/g' | sed 's/he!/he/g' | sed 's/ll!/ll/g' | sed 's/ain..$/ain!/g' | sed 's/!wi/wi/g'
$ for ip in $(grep -Eo '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' access.log.1); do grep $ip access.log.2| cut -d ' ' -f1; done
$ find . -iname "access.log*" | xargs grep -h -B 1 --no-group-separator 404 | grep -v 404
$ for f in $(find . -iname "*.bin"); do if ! diff base.bin $f >/dev/null; then basename $f; fi; done