Commit 70d5cc5e authored by ROHIT KUMAR JENA's avatar ROHIT KUMAR JENA

upper commit

parent 9950333c
#! /bin/bash
ssh-keygen -t rsa
ssh $1@$2 -t 'exit'
ssh-copy-id -i ~/.ssh/id_rsa.pub $1@$2
ssh-add
#! /bin/sh
while true; do sleep 1; done
#!/bin/bash
# Please use 'source' command to check the correctness of the script
# For task A, sub-task 3, we change the PS1 variable so that it shows the required format.
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\] - \[\033[01;34m\]\t [\W]\[\033[00m\]:$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h - \t [\W]:$ '
fi
# For task A, sub-task 4, we gave an alias for bk command using $OLDPWD variable.
# Given an alias
alias bk='cd "$OLDPWD"'
# For task A, sub-task 5, we made a custom Welcome message which is color-coded for beautification.
# Echo with color codes - \e[31m - red, \e[92m - green , \e[0m - white
echo -e '\e[31m / / / /__ / / /___
/ /_/ / _ \/ / / __ \
/ __ / __/ / / /_/ /
/_/ /_/\___/_/_/\____/
\e[92m
| | / /___ _____/ /___/ /
| | /| / / __ \/ ___/ / __ /
| |/ |/ / /_/ / / / / /_/ /
|__/|__/\____/_/ /_/\__,_/
\e[0m'
\ No newline at end of file
Group Number 37
Members - (Meet Taraviya,150050002) (Akash Trehan,150050031) (Rohit Kumar Jena,150050061)
Meet Taraviya, Roll- 150050002
Honor Code-
I shall pledge to follow all the rules and guidelines issued by sir, while attempting the lab.
Akash Trehan, Roll- 150050031
Honor Code-
I pledge by my honor that I have not used unauthorized help in this assignment and have given my complete efforts.
Rohit Kumar Jena, Roll- 150050061
Honor Code-
I pledge to do my lab in a legitimate way, and not to provide or recieve any unauthorized help.
Contributions -
Meet Taraviya - 100%
Akash Trehan - 100%
Rohit Kumar Jena - 100%
----------------------------------------------------------------------------------
Task A
----------------------------------------------------------------------------------
In the ~/.bashrc file, there is a `shopt` option that the script uses for custom optional behavior. `shopt` is for using default autocompletion. It uses the file -
`/usr/share/bash-completion/bash_completion`
to show suggestions for autocomplete.
The part in else contained other file that contains the path to autocomplete file. This is used for custom autocompletion.
----------------------------------------------------------------------------------
Task B
----------------------------------------------------------------------------------
In the /proc directory, we used the following line to find the relevant file. The relevant file name is /proc/meminfo
`ls | grep mem`
We got the meminfo file where we discovered the details. We used the following command to get the desired output.
cat meminfo | grep Mem | tr -d ' ' | cut -d ':' -f2
----------------------------------------------------------------------------------
Task C
----------------------------------------------------------------------------------
The command used to ssh is -
`ssh atrehan@mars.cse.iitb.ac.in`
Now for getting the GUI in our local, we use the -X flag(for X Window system)
`ssh -X atrehan@mars.cse.iitb.ac.in`
`subl /tmp/lab3_inlab_C3.txt` -> Open the file in sublime text on mars(Also opens Sublime GUI on local machine)
`ps aux | grep subl` -> To check that subl is running on mars
----------------------------------------------------------------------------------
Task D
----------------------------------------------------------------------------------
3. To run infiniteLoop.sh in background -
`sh infiniteLoop.sh &`
We already had an idea about this. We read this through the links posted on Piazza.
4. To get Process ID of this running script -
`ps aux | grep infiniteLoop`
To kill the process -
`kill <Process ID>` (Process ID of the running script)
Through Sir's demonstrations in class, we came to know about the use of `ps`. Using the `man` command we found out the usage for `kill` command, which is very straight-forward.
5. cell.sh was trapping all signals which prevented us from exiting it using any normal key presses of the keyboard. Searching on the internet, we found that SIGKILL cannot be trapped and the process exits anyways. `kill` sends in SIGINT but `kill -9` sends SIGKILL signal.
`kill -9 <Process ID>` (Process ID of running cell.sh script)
----------------------------------------------------------------------------------
Citations
----------------------------------------------------------------------------------
1. ASCII Art - http://patorjk.com/software/taag/#p=display&f=Slant&t=hello%0Aworld
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment