Beruflich Dokumente
Kultur Dokumente
2018-19 Autumn
I confirm that I understand my coursework needs to be submitted online via Google Classroom under the
relevant module page before the deadline in order for my assignment to be accepted and marked. I am fully
aware that late submissions will be treated as non-submission and a marks of zero will be awarded.
Contents
INTRODUCTION ............................................................................................................................ 1
TRANSCRIPT ................................................................................................................................. 2
CONCLUSION.............................................................................................................................. 29
Bibliography............................................................................................................................... 30
CS5001NI Networks And Operating Systems
INTRODUCTION
The main objectives of this course work are as follows:
Introduction to Linux
1
Pujan Magar
CS5001NI Networks And Operating Systems
TRANSCRIPT
#Task 1
This command sets the prompt to display the pathname of the working directory as
home directory
$ /home/pujanmagar>mkdir –p WorldCup/{Argentina,France,Germany,Brazil,Japan}
/home/pujanmagar>ls WorldCup
#Task 2
$ /home/pujanmagar/WorldCup/Argentina> pwd
/home/pujanmagar/WorldCup/Argentina
Creates three files inside Argentina directory as file1, file2 and file3 by using
touch“utility
2
Pujan Magar
CS5001NI Networks And Operating Systems
#Task 3
/home/pujanmagar/WorldCup/Argentina> cd ..
/home/pujanmagar/WorldCup>
Removes the files file1, file2 and file3 from the Argentina Directory with interactive
mode prompting a message to be removed or not as shown below
/home/pujanmagar/WorldCup> ls -R
Shows the absence of Argentina Directory as well as files within it as shown below
./Brazil:
./France:
./Germany:
3
Pujan Magar
CS5001NI Networks And Operating Systems
./Japan:
OR
/home/pujanmagar/WorldCup> ls
#Task 4
Prints out the desired letters and numbers (alphanumericals) and symbols written
within the quotation mark using echo utility as shown below
14 < (2+2)
/home/pujanmagar/WorldCup> pwd
To display and verify that the current working directory is WorldCup as shown below
/home/pujanmagar/WorldCup
/home/pujanmagar/WorldCup> cd Japan/
/home/pujanmagar/WorldCup/Japan> pwd
/home/pujanmagar/WorldCup/Japan
/home/pujanmagar/WorldCup/Japan>
4
Pujan Magar
CS5001NI Networks And Operating Systems
#Task 5
At first “pwd;” command shows the current working directory as Japan, “cd;”
command takes to the home directory to “pujanmagar” and “pwd;” command shows
the current working directory as home directory “pujanmagar”
/home/pujanmagar/WorldCup/Japan
/home/pujanmagar
/home/pujanmagar>
#Task 6
cd ..; :takes one step back from the current working directory to WorldCup
/home/pujanmagar/WorldCup/Japan
/home/pujanmagar/WorldCup
/home/pujanmagar
/home/pujanmagar>
#Task 7
/home/pujanmagar
/home/pujanmagar> ls
5
Pujan Magar
CS5001NI Networks And Operating Systems
Lists out only the unhidden items present within the selected directory
/home/pujanmagar> ls –a
Lists out unhidden as well as hidden items present within the selected directory
/home/pujanmagar> ls -al
Lists out the hidden and unhidden items present within the selected directory alonf
with their permission properties to the users, groups and others about access level of
data manipulation
#Task 8
Command “cd cw2” tends to take into cw2 directory. But there is no such directory.
So, error message is thrown
/home/pujanmagar
/home/pujanmagar
/home/pujanmagar> ls -R
lists out all the recursive tree of parent as well as child folders and files as shown
below
17030795cw2 WorldCup
./WorldCup:
./WorldCup/Brazil:
6
Pujan Magar
CS5001NI Networks And Operating Systems
./WorldCup/France:
./WorldCup/Germany:
./WorldCup/Japan:
/home/pujanmagar>
#Task 9
Creating three separate files using the “cat >” command utility
aaabb Aaaaa
AAAAA
bbbcc Bbbbb
BBBBB
ff-ff Ccccc
CCCCC
cccdd Ddddd
DDDDD
7
Pujan Magar
CS5001NI Networks And Operating Systems
#Task 10
aaabb Aaaaa
AAAAA
bbbcc Bbbbb
BBBBB
ff-ff Ccccc
CCCCC
cccdd Ddddd
DDDDD
8
Pujan Magar
CS5001NI Networks And Operating Systems
#Task 11
#Task 12
aaabb Aaaaa
AAAAA
bbbcc Bbbbb
BBBBB
ff-ff Ccccc
CCCCC
cccdd Ddddd
DDDDD
aaabb Aaaaa
AAAAA
bbbcc Bbbbb
BBBBB
ff–ff Ccccc
CCCCC
cccdd Ddddd
9
Pujan Magar
CS5001NI Networks And Operating Systems
DDDD
aaabb Aaaaa
AAAAA
bbbcc Bbbbb
BBBBB
ff–ff Ccccc
CCCCC
cccdd Ddddd
DDDDD
aaabb Aaaaa
AAAAA
bbbcc Bbbbb
BBBBB
ff-ff Ccccc
CCCCC
cccdd Ddddd
DDDDD
aaabb Aaaaa
10
Pujan Magar
CS5001NI Networks And Operating Systems
AAAAA
bbbcc Bbbbb
BBBBB
ff–ff Ccccc
CCCCC
cccdd Ddddd
DDDDD
aaabb Aaaaa
AAAAA
bbbcc Bbbbb
BBBBB
ff–ff Ccccc
CCCCC
cccdd Ddddd
DDDDD
aaabb Aaaaa
AAAAA
bbbcc Bbbbb
BBBBB
ff-ff Ccccc
CCCCC
cccdd Ddddd
DDDDD
11
Pujan Magar
CS5001NI Networks And Operating Systems
#Task 13
aaabb Aaaaa
AAAAA
bbbcc Bbbbb
BBBBB
ff-ff Ccccc
CCCCC
cccdd Ddddd
DDDDD
cat test[XYZ] displays all the contents of three files having “test” as common at once.
#Task 14
/home/pujanmagar/WorldCup/France> ls -l
12
Pujan Magar
CS5001NI Networks And Operating Systems
total 0
/home/pujanmagar/WorldCup/France> ls -l testX
Listing out the access permission of testX file after adding the read and write
permissions
/home/pujanmagar/WorldCup/France> ls -l testX
13
Pujan Magar
CS5001NI Networks And Operating Systems
aaabb Aaaaa
AAAAA
bbbcc Bbbbb
BBBBB
ff-ff Ccccc
CCCCC
cccdd Ddddd
DDDDD
#Task 15
/home/pujanmagar/WorldCup/France> cd ..
14
Pujan Magar
CS5001NI Networks And Operating Systems
/home/pujanmagar/WorldCup> ls France/
aaabb Aaaaa
AAAAA
15
Pujan Magar
CS5001NI Networks And Operating Systems
bbbcc Bbbbb
BBBBB
ff-ff Ccccc
CCCCC
cccdd Ddddd
DDDDD
/home/pujanmagar/WorldCup> ls France/
#Task 16
Grep command
aaabb Aaaaa
bbbcc Bbbbb
It displays the contents having the “bb” up to the last line counts
AAAAA
BBBBB
ff-ff Ccccc
CCCCC
16
Pujan Magar
CS5001NI Networks And Operating Systems
cccdd Ddddd
DDDDD
1:aaabb Aaaaa
3:bbbcc Bbbbb
It displays the word lines containing “bb” along with their line numbers
/home/pujanmagar/WorldCup/Brazil> grep -l bb *
testX
testY
testZ
It displays all the files with “bb” contained within their lines
/home/pujanmagar/WorldCup/Brazil> grep -i bb *
testX:aaabb Aaaaa
testX:bbbcc Bbbbb
testX:BBBBB
It displays the contents of all files with “bb” included in their lines either containing
alphabet “b” or “B”
17
Pujan Magar
CS5001NI Networks And Operating Systems
/home/pujanmagar/WorldCup/Brazil> grep -i BB *
testX:aaabb Aaaaa
testX:bbbcc Bbbbb
testX:BBBBB
It also displays the contents of all files with “BB” included in their lines either
containing alphabet “B” or “b”
/home/pujanmagar/WorldCup/Brazil> grep -c bb *
testX:2
testY:2
testZ:2
It displays the total line counts containing “bb” of all the files
testX:AAAAA
1:aaabb Aaaaa
2:AAAAA
3:bbbcc Bbbbb
4:BBBBB
5:ff-ff Ccccc
18
Pujan Magar
CS5001NI Networks And Operating Systems
6:CCCCC
7:cccdd Ddddd
8:DDDDD
It displays all the contents with the respective line counts of testX
#Task 17
Using alias command to create a custom shortcut used for representing a command.
~/.bashrc is used in order to permanently store these alias. So that it could be used
in another terminal sessions further.
/home/pujanmagar> cd WorldCup/Brazil/
/home/pujanmagar> lsR.:
17030795cw2 WorldCup
./WorldCup:
./WorldCup/Brazil:
19
Pujan Magar
CS5001NI Networks And Operating Systems
./WorldCup/France:
./WorldCup/Germany:
./WorldCup/Home:
./WorldCup/Japan:
/home/pujanmagar> lsl
total 48
#Task 18
/home/pujanmagar> lsR
/home/pujanmagar> lsl
The aliased shortcuts are removed from the system and could not be used anymore
20
Pujan Magar
CS5001NI Networks And Operating Systems
#Task 19
/home/pujanmagar>touch .environmentalfile
/home/pujanmagar>nano .environmentalfile
/home/pujanmagar>touch .bashrc
/home/pujanmagar> .bashrc
Making a file named .environmentalfile and editing it. Making another file as .bashrc
/home/pujanmagar>exit
exit
pujanmagar@HRAP:~$ PS1='$PWD>'
#Task 20
/home/pujanmagar>nano .environmentalfile
/home/pujanmagar>nano .environmentalfile
#Task 21
/ home/pujanmagar>nano .environmentalfile
home/pujanmagar> .bashrc
21
Pujan Magar
CS5001NI Networks And Operating Systems
pujanmagar@HRAP: ~$PS1=”$PWD> ”
/home/pujanmagar>alias
#Task 22
/ home/pujanmagar>nano .environmentalfile
home/pujanmagar> .bashrc
#Task 23
/home/pujanmagar>noAllf
#Task 24
/home/pujanmagar>noAsubsir
#Task 25
/home/pujanmagar>noAcs
#Task 26
pujanmagar@HRAP:~$ history
1 history
2 clear
22
Pujan Magar
CS5001NI Networks And Operating Systems
3 rm .bash_history
4 PS1='$PWD>'
5 mkdir -p WorldCup/{Argentina,France,Germany,Brazil,Japan}
6 ls WorldCup
7 cd WorldCup/Argentina
8 pwd
10 cd ..
12 ls Argentina/
13 cat Argentina/file1
14 cat Argentina/file2
15 cat Argentina/file3
16 rm -i -r Argentina
17 ls Argentina
18 ls
20 pwd
21 cd Japan
22 pwd
23 pwd;cd;pwd
24 echo –e
"The starting command pwd displays the current working directory in which we are
working in. The command cd takes Japan directory to home directory and at last the
command pwd displays the current working directory as home directory."
25 cd WorldCup/Japan
23
Pujan Magar
CS5001NI Networks And Operating Systems
27 echo -e "The starting command pwd shows the current working directory, the
command cd .. takes Japan directory to WorldCup directory then again pwd
command shows the current working directory after that cd .. takes WorldCup
directory to home directory and at last pwd shows the current working directory as
home directory."
28 cd;pwd
30 ls
31 echo -e "The command ls displays all the file and folders 0f the home
directory."
32 ls -a
33 echo -e "The command ls -a displays all the files and folders including the
hidden files and folders of the current working directory."
34 ls -al
35 echo -e "The command ls -al displays the details of all the files and folders with
the formal list. Access permission is also displayed with other information like date
created, time, size etc."
36 cd;pwd;cd cw2;pwd
38 ls -R
40 cd WorldCup/France
41 cat>testX
42 cat>testY
43 cat>testZ
44 cat testX
24
Pujan Magar
CS5001NI Networks And Operating Systems
45 cat testY
46 cat testZ
51 cat testResult
52 cat test[XYZ]
53 echo -e "The command cat test[XYZ] concatentes the contest of testX testY
testZ."
54 ls -al
56 ls -al testX
57 cat testX
58 cat>testX
60 ls -al testX
61 cat testX
62 cat>testX
63 cd ..
64 ls -ld France
66 ls -ld France
67 cat France/testX
68 cat>France/newfile
69 ls -R France
25
Pujan Magar
CS5001NI Networks And Operating Systems
71 ls -ld France
72 cat France/testX
73 cat>France/newfile1
74 ls France
75 cd Brazil
76 grep bb testX
77 echo -e "The command grep bb testX displays the line containing bb."
78 grep -v bb testX
79 echo -e "This command grep -v bb testX displays the line which do not contain
bb."
80 grep -n bb testX
81 echo -e "grep -n bb testX command is used to display each matching line with
its line number."
82 grep -l bb *
83 echo "The command grep -l bb * display the line that contain bb from all the
files of the current directory as Brazil directory."
84 grep -i bb *
85 echo -e "The command grep -i bb * is used to displays the line which contain
bb along with its filename and it is not case sensitive."
86 grep -i BB *
87 echo -e "The command grep -i BB is used to search all the file in current
directory which contains the text BB and displays the matching line contains bb and
BB."
88 grep -c bb *
89 echo -e "The command grep -c bb * counts the number of bb from testX testY
and testZ and display the number with file name in front of it."
90 grep '^A' *
91 echo -e "The command grep '^A'^ is used to search all the data starting with
capital A in the file of current directory as Brazil and displays the line starts with
capital A from each file."
26
Pujan Magar
CS5001NI Networks And Operating Systems
93 echo -e "The command grep -n '^' testX displays the line number of testX file of
current directory."
94 cd
97 alias
98 lsR
99 lsl
102 lsR
103 lsl
105 exit
107 PS1='$PWD>'
108 lsl
109 lsR
111 exit
113 PS1='$PWD>'
114 noAllf
115 noAsubsir
116 . .bashrc
117 noAcs
27
Pujan Magar
CS5001NI Networks And Operating Systems
118 history
#Task 27
pujanmagar@HRAP:~$ !7
cd WorldCup/Argentina
#Task 28
pujanmagar@HRAP:~$ !c
cd WorldCup/Argentina
pujanmagar@HRAP:~$ exit
exit
28
Pujan Magar
CS5001NI Networks And Operating Systems
CONCLUSION
The tasks (i.e. 1-28) are completed successfully and are recorded in the script file
named 17030795cw2. In addition, the junk file containing the error commands is also
cleaned before finalizing the report. This report took a lot of effort as this was
unfamiliar Operating System. But the commands were practiced for many times for
ease. And finally it was completed by starting the script file, entering the suitable
commands and ending the script.
29
Pujan Magar
CS5001NI Networks And Operating Systems
Bibliography
Xiao, G., Zheng, Z., & Wang, H. (2016, September 27). Evolution of Linux operating system network.
Physica A, 249-258. Retrieved January 14, 2019, from https://ac.els-
cdn.com/S0378437116306379/1-s2.0-S0378437116306379-main.pdf?_tid=beedfa94-4db7-
44ae-ac6a-512a68e2901c&acdnat=1549208537_fad52584455f3369e4515dc366afe83b
30
Pujan Magar