Professional Documents
Culture Documents
INT301
INT301
--> use any open source software to generate a detailed report of your system to
investigate what
happened on a computer in last 3 months.
-->
-->
1. Open Source Software- Open Source Software is a computer software whose source
code is available to general
public for use as it is or with modifications. This software usually doesn't
require a license.
--> OSS is always released under a license or copyright which must meet the
criteria of Open Src definition
--> The major difference between proprietary software and open source software
is that open source software
doesn't require license.
---> Advantage of OS
1. Free of Cost
2. Flexibility
3. Relability and Quality
1. WinZip
2. Adobe Acrobat 8 Professional
1. Stability
2. Relability
3. User-friendly
--> Pragmatism vs Idealism - The key difference between pragmatism and idealism is
that prgamatism considers the practical consequences
of an action as its main componenet where as idealism considers mental
enitites or thoughts and idea as its main component.
-> The owner has the right to licenese the copyright of thier work to third parties
through a written agreement.
2. TradeMark Act 1999 - The Trademark Act 1999 states that trademark is a graphical
mark that is capable of distinguishing the
goods or services of one person from other. A trademark provides protection for
symbols, colors, shapes, words, etc.
representing goods or services. The validity for trademark is 10 years which
can be renewd succesively.
3. The Patent Act 1970 - The Patent Act 1970 is an IPR that protects any new
invention. It protects the right of the inventor and
prevent unauthorized use and missappropriation of registered patent. The patent
is only registered if invention is novel and
original and is not introduced in any public domain. The validity of patent is
20 years.
4. Design Act 2000- The Design Act 2000 is an IPR that protects shape,
configuration, pattern, applied to any article either in 2d
or 3d or in both forms. A design is only registered if it is novel and original
and is not introduced to any public domain.
---> Software license - It is an agreement that gives a user the right to use a
paticular software
4. End User license agreement - It is an agreement between author and the end user
of the application.
--> General Public License - To make a software freely available we need to release
it under a free software license for that
purpose we use General Public License.
1.
1. Adware
2. Demoware - It is CS that allows user to see what full version of the software
looks like
3. free software - same as previous
4. shareware software - same as previous
5. liteware software - It is CS that which is of limited verison or lite version of
particular software.
The user has to pay to use this liteware software.
6. spyware software - It is CS that is used by the organization to track their
user's activity.
Copyright - It is an act which states that the original author of the work shall be
the first owner of the work.
This act further states that the owner has right to license the
copyright of their work to the third
parties through a written agreement.
Copyleft - It is an act where a software owner has granted its users a license to
modify and alter thier work such
permission and license are known as Copyleft.
--> It is also known as the right to use, modify and distribute the software on
condition anything derived from it
is bound by the same condition.
<--------------Open and Closed Source Technologies -------------->
1. Open Source Technology - refers to Open source software all the definition of
OSS
<----------------------Linux Theroy------------------------------->
1. shell - It is a program that takes the command typed by the user and calls OS to
run those commands
2. shell script - It is a plain text file which stores one command per line
3. System defined variables - These variables are defined and maintained by the
system itself. They are defined
using Capital letters
4. User defined variables - These variables are defined and maintained by the user
itself. Lower letters
6. readonly variables - They are the variables which can't be modified i.e;
readonly variable_name
7. unsetting variable - Once you unset a variable you can't access the value of
that variable
<----------------------------Theory of Open Source ----------------------------->
Int 301 -
--> Note - Shell scripts store plain text file, generally one command per line.
--> shell - It is the collection of commands group of commands that we can create
to run multiple things
-> we can either use .bash .sh for file extension for script for identification
1. mkdir
2. cd
3. pwd - present working directory
4. nano script.sh -- GNU nano is the editor
5. who -
6. tty - terminal type
7. whoami - name of the user
8. touch - to create a empty file
9. cat - display the data content on the terminal
10. ls -l ---> to see the properties associated with that file
11. chmod- change mode - giving permission , r-4, w-2, x-1 - 7
----------> 23 january
#!/bin/bash - inital statement so that your system execute the script bash --->
bash is the shell
----> copy and paste from source to destination within the same directory
1. first you need to create a new file - using --> touch new.sh
2. copy from source to destination -> cp variable.sh new.sh
----> difference between echo and printf --> echo- gives the new line each time ,
printf- doesn't gives the new line
--> our main concern is owner it already has read and write permission but it
doesn't have execute right
--> r-4, w-2, x-1 ---> 1. chmod 777 - This is octal method
Note - We are only concerned about the user/owner that's why he need to assign
EXECUTE command to it
that's why we are giving it 7, r-4 w-2 x-1, by default the permission
given to file is 6 we are giving it
one more right i.e; execute command.
---> In conclusion we can say that we need to chmod because it only has read write
permission without execute
permission it won't run that's why we are giving execute also, x -1
--> env --> gives all the system defined variables also known as environment
variables
--> echo $SHELL , --> it gives the current shell -> /bin/bash
6. $$ - PID of bash - process id of bash -> bash is the shell where our entire code
is working
--> System defined variables-> Capital letters, fetch value of EV using $, they
always have name and value associated with it.
--> User defined variables -> Small letters, we can set and unset value -> set x =
10 , unset value b="lpu" c=1, read value $x
-----> read only x = It doesn't allow you to change the value, x=5 and x=20, it
won't change
----> Generally new file is started with #!/bin/bash -- by default our shell is
bash
---> Note: From where we start the positional paramters from there input will be
start taking
---> If I start $1 at second line now from there input will start taking
----> (STDIN - It is an initial buffer -> reading is done by the keyword --> always
consider your self as an Operating system )
----> $? - It is not concerned wether the line before it was executed or not. It is
concerned with the command that executed
before it. It takes the previous command
scale - It is a command which tells us how much decimal line we need ---> bc - It
is the basic calculator
Question- Write shell script to create a file inside a directory. The file name
should be passed as first argument and the
directory name/path should be passed as second argument
-----> Command Line Arguments = This means take input during run time
----> How to run the file if you want to enter the things in run time
./nano.sh _$1_ _$2_ ---> You have to give input at run time beside the file name
------> Write CLA to make a directory and take them as 3rd and 4th arguments and
create 2 files as
1st and 2nd arguments
----> We can also make two files at one touch $1 $2 - It is during run time only
--> Question#2 Write a shell script which checks the total number of command line
arguments passed. If the argument count is
greater than 5 display the message "Too many arguments"
---> Hints
---> $# - count
---> Take input during run time i.e; command line
----> To count CLA we have to use #$
Ans
if [ $# -gt 5 ]
then
echo "too many command line argumetns"
else
echo "$*"
---> if [ $a -eq $b ]
Question - WASS to take file name as CLA and check whether its writeable or
readable?
#!/bin/bash
if [ ! -e $1 ]
then
echo "file doesn't exists"
elif [ ! -r $1 ]
then
echo "file is not readable"
elif [ ! -w $1 ]
then
echo "file is not writeable"
else
echo "file is both readable or writeable"
fi
# user - rwr
# group - rw-
# others - r--
----code--->
for i in $*
do
chmod 764 $i
done
---code--->
---> For than more time we are going to use for loop
Q--> Write a shell script to print the "long list" of all the file names #passed at
the command line
----code--->
---code--->
---code---->
cd $1
fc=0
for i in *
do
if [ -d $i ]
then
fc=$(($fc+1))
fi
done
echo $fc
---code---->
2. WASS to display a valid message if the name entered by the user if the current
logged in user.
---> Notes
4. WASS take a file/dir name from a command line. If name starts with f create file
with that name, if name starts with d
create directory for that name.
#!/bin/bash
for i in $*
do
case $i in f*)
touch $i
;;
d*)
mkdir $i
;;
*)
echo "not a valid name"
;;
esac
done
Notes - We can't use filename and dirname using while we have to use for
------------------------->
function_name()
{
statements...
# function calling requires 2 arguments formal and actual. If you don't pass the
arguments it won't create any file
-> $* - It is used to take value of the arguments passed at the command line
-> return is a value passed by the functions to notify the execution has done
competed successfully
-> return is used to know the status of the execution --> whether it executed or
not.
-> 0 - represents successfully done, -1 - Not done
# function call
name You can doit
ret=$?
echo "Return value is $ret"
o/p - It will be 10 because the return is 10 now -- reutrn is only saying that the
if the functions have successfully executed.
----code---->
1. echo ${arr[@]}
2. echo ${arr[*]}
3. echo ${arr[@]:0}
4. echo ${arr[*]:0}
----> When we press - CLT+C - It send SIGINT command to the OS to stop the command.
--> Clt + Z - to stops the execution --> A signal is send SIGINT to tell the OS to
stop the execution
--> top - It gives similar all the process running to Task Manager in Windows --
How to come out of it? --> Press q
--> when you are not in root you have to use sudo.
1. man mkdir
2. man 2 mkdir
Q. Let us create a man page for the following bash script I have written:
#!/bin/bash
1. First create a file with the name --> test.1 -> here 1 denotes the section
--> to see the difference between two revisions associated with the file you can
use ..................................................-> resdiff .....
-> As the RCS only saves the changes between versions, it's also very space
efficient. , ci- check in , co- check out
touch Test
rcs -i Test --> i = initialization
nano Test
---> OS event driven, interrupt driven ( <-- ) symbolic links created ( actual
file is accessed)
--> Once initialization is done you have to initialize again and again -> rcs -i
Test
---> How to check the difference ? -> rcsdiff -r1.1 -r1.2 test1 , 2c2,
Q. WASS to create file/directory the deault permissions as read and write at the
time of creation
umask - set whatever you don't want to assign -> umask and chmod are complement
from each other
command - umask - 0022 - first is the paratiy bit , 0 - don't assign zero to users
that means assign
--> you will set what you don't want to assign
--> first zero is the paraity bit which returns when it successfully operated
--> 0 assign everything ---> rwx
--> 2 - means don't assign write --> r
--> 2 - means don't assign write ---> r
-> file - 6
-> dir = 7
----------------------------------------->
Q. WASS to create a text file and run date command in that in background.
--> redirection (>) - It will create the target file even if it doesn't exist.
-> so if you do , date > file -> even if the file doesn't exist
redirection (>) will create it
--> If you want to append then , date & >> q_l , >> It is for appending
--------------------------------------->
Q. WASS to create a user named 'table' and set password for that user to 123.
---> when it asks for the password --> prompt for the password
--> Create a folder -> inside the bash and initalize it with git init --> git add .
(to track it)
--> git status (will tell you whether there is changes to be commited) -->
--- For adding a username and email - User name and email should be same as the one
you have created
1. git config --global user.name "aryan-098max"
2. git config --global user.eamil "aryangupta4279@gmail.com"
3. git config --global --edit ( to check the usernam and emailid in the Visual
studio code)
Note - You have to use same username and email with which you have created the
file.
Note - From bash you can create notepad in particular folder -> command-> notepad
test.txt
--> adding directory as a safe directory -> command -> git config --global -add
safe.directory desktop:/Int301 ( this is the directory path)
Note- If you are already in that path you don't have to write the directory name
3. git add. (to add the files that you have created) (.) - It represents all the
files in present working directory(pwd)
-> before you do commit you have to add the files (send them to staging
process)
4. git status ( to check the staging process)
5. git commit -m 'doing the task' (commit it)
6. git log ( to check the emailId and username)
7. git remote add origin (link of the new repo from the browser)
if the file already exists ( command : git remote rm origin)
8. git push -u origin master ( master is the file that we are in) -u is for
tracking
9. git remote - tells me the origin
10. git remove -v -> gives me the origin
--> After doing some changes in the file what you have to do , No need to add the
origin the second time. when you are pushing.
1. git add .
2. git commit -m 'this is the second revision'
3. git push -u origin master
--------------> Creating branches in Git, when multiple people are working in the
same project we will divide the task and create branch for each people
----> The changes that have been done in the branche isn't shown in the main branch
--> Now we are going to merge the branches to reflect the changes
-> (you will merge master with local_branch) then it will show the changes
1. git merge local_branch_301 -> do this in master now master have the changes
done in branch
2. git push -u origin master ( you have to do push again then only it will show
the chnages)
---> Undo changes - we will do it to the directory that has already been intialized
--> after adding do commit -> git push -u origin master ->
--> checkout only chnages locally but if you want to revert in github
--> git log --> to get the id
--> git revert paste commit id...
--> git add .
--> git commit -m 'modified''
--> git push -u origin master
<---------------------------------------------------------->
2. How do you write the rename? --> rename a git hub file
1. GDB