Prac 4 Linux
Prac 4 Linux
ii) 12 * 12
12*12
144
iii) 144 / 3
144/3
48
iv) scale = 2 25 / 7
v) (8 + 2) * 5
(8+2)*5
50
vi) (2 + 3) + 8 - 4 * (6 – 3)
(2+3)+8-4*(6-3)
1
vii) 2^6
2^6
64
viii) 12*12; 12 / 6
12*12;12/6
144
2
ix) ibase=2
11001010
ibase=2
11001010
202
x) obase=2
14
obase=2
14
11
19. Display all the users currently logged in the system with heading.
guest-MmIkKm@ubuntu:~$ who -Hu
NAME LINE TIME IDLE PID COMMENT
guest-MmIkKm pts/1 2017-01-02 01:03 . 2541 (:0)
iii) d=`date`
echo “Today’s date is $d”
guest-MmIkKm@ubuntu:~$ echo "Today's date is $d"
Today's date is Mon Jan 2 02:08:19 PST 2017
25. Display and count the number of lines, words and characters of file “demo”.
guest-URijZ7@ubuntu:~$ cat demo
a
d
c
d
guest-URijZ7@ubuntu:~$ wc demo
5 4 9 demo
29. Display and count the number of lines, words and characters of file “demo” and “example”
and “test”.
guest-URijZ7@ubuntu:~$ wc demo example test
5 4 9 demo
4 4 8 example
3 3 6 test
12 11 23 total
31. Count the number of all users currently logged in to the system.
guest-URijZ7@ubuntu:~$ who|wc -l
1
32. Store the number of users currently logged in to the system in file “testdemo”.
guest-URijZ7@ubuntu:~$ who|wc -l > testdemo
guest-URijZ7@ubuntu:~$ cat testdemo
1
33. Display and store the listing of all filenames in file “list”.
guest-URijZ7@ubuntu:~$ ls| tee list
demo
demo.txt
Desktop
Documents
Downloads
example
examples.desktop
Music
Pictures
Public
Templates
test
testdemo
Videos
34. Display and store the list of all users currently logged in into the system in file users.
guest-URijZ7@ubuntu:~$ ls| tee users
demo
demo.txt
Desktop
Documents
Downloads
example
examples.desktop
list
Music
Pictures
Public
Templates
test
testdemo
users
Videos