Bash manages autocomplete using 'readline' library which in turn provides functions for applications that allow users to edit command lines.
When tab is pressed, readline calls back to bask which in turn returns a list of possible completions. Readline then inserts as many characters that are common for all functions.
Bash also has a builtin 'complete' function to define how to complete commands. First it matches with commands, if nothing then file names. One can also customise this.
Bash also stores history and stores size in HISTSIZE variable. Can be seen using history.
Task B:
'meminfo' file in the /proc directory contains information regarding memory usage
grep searches for the words (-w option) MemTotal and MemFree in meminfo. \| is used to escape the pipe operator as 'or'.
tr translates the data. -d option with " " argument removes spaces.
cut -d separates the data by delimiter ':'. -f option helps select data fields in output which is '2' in this case.
Task C:
Command used for 'ssh'ing : ssh shaan@mars.cse.iitb.ac.in
Command used for graphical output on local machine: ssh -X shaan@cse.iitb.ac.in
-X option enables X11 forwarding onto the local machine
Task D:
./infiniteLoop.sh &
OR
source infiniteLoop.sh &
'&' runs the script in the background directly; instead one could use bg to throw the process to background. (source infiniteLoop.sh was used as the alternative gave a 'permission denied' error) We looked this up on the internet
ps -aux | grep infiniteLoop.sh
- get pid
kill [process-id]
OR
pkill [script-name]
We started with bringing the process to foreground and then kill it but obviously it was wrong as it killed all fg processes. So we used kill [process-id] but that required to first look up the process-id using 'ps -aux' piped with grep.
pkill [script-name] kills the process started by the script whose name we passed as argument.
I pledge on my honour that I have not given or received unauthorised assistance on this assignment or any previous task. -Shaan
I pledge on my honour that I have not given or received unauthorised assistance on this assignment or any previous task. -Abhishek
I pledge on my honour that I have not given or received unauthorised assistance on this assignment or any previous task. -Vishwajeet
Contribution:
Shaan : 100%
Abhishek: 100%
Vishwajeet: 100%
Regarding restricting login only through cURL or wget:
*Maybe* as cURL does not support JS or cookies, one can detect if the site is being accessed through the browser or cURL.
Regarding terminal not displaying the pokemon:
*Maybe* as the terminal does not support all characters, they just get ignored alongwith the recognised characters in between while html just ignores them and prints the one it knows.
Reflection Essay:
Bash scripting is amazing! The time when you are able to successfully run a dictionary attack is gold (Note: I *might* be exaggerating). Firstly, kudos to the ones who constructed the whole set. Besides a lot, we also learnt how to Google. cURL and Ncat is a lot of power on the command line. Regex is fun though confusing at times; an infinite number of syntaxes. sed took some time to learn. Dictionary attack was fun!