Вы находитесь на странице: 1из 21

Shell scripting workshop:

Que 1:-Write a script to give the cube (power raised to 3) of a number user inputs

Ans:--

#! /bin/bash
# Cube of user input
clear
echo -e "Enter No for cube:\c"
read numb
echo "Cube of $numb : `expr $numb \* $numb \* $numb`"

---------------------------------------------------------------------------

Que 2:-Convert any script using nested if then fi to multilevel if then fi

Ans:--

nested if then fi

#! /bin/bash
# Convertnested if then fi to multilevel if then fi

echo -e "Enter No:\c";read num


echo "1-Square"
echo "2-Cube"

echo -e "Enter 1 or 2:\c"


read choice

if [ $choice -eq 1 ]
then
echo "Square:`expr $num \* $num`"
else
if [ $choice -eq 2 ]
then
echo "Cube:`expr $num \* $num \* $num`"
else
echo "Thank you. Try again."
fi
fi

=======================
multilevel if then fi

#! /bin/bash
# Convert any script using nested if then fi to multilevel if then fi

echo -e "Enter No:\c";read num


echo "1-Square"
echo "2-Cube"
echo -e "Enter 1 or 2:\c"
read choice

if [ $choice -eq 1 ]
then
echo "Square:`expr $num \* $num`"
elif [ $choice -eq 2 ]

then
echo "Cube:`expr $num \* $num \* $num`"
else
echo "Thank you. Try again."
fi

-------------------------------------------------------------------------------------------------------

Que 3:-Write the program studied in while to give output of multiplier and multiplicand in
ascending order

Ans:--

#! /bin/bash
# while to give output of multiplier and multiplicand in ascending order

echo -e "Enter multiplier:\c";read mp


echo -e "Enter multiplicand:\c";read md
num=1
while [ $md -gt 0 ]
do
echo "$mp * $num = `expr $mp \* $num`"
md=$[ md - 1]
num=$[ num + 1 ]
done

---------------------------------------------------------------------------------------------------

Que 4:--

Write any script to use loop and if then fi within one another (eg loop within if then fi
or vice versa)

Ans:--

loop within if

#! /bin/bash
# factorial
echo -e "Enter number for factorial:\c";read fact
ans=1
if [ $fact -eq 0 ]
then
echo "Ans:1"
elif [ $fact -gt 0 ]
then
for i in $(seq 1 $fact)
do
ans=$[ ans * i ]
done
echo Ans:$ans
else
echo "factorial not exist."
fi

=======================
if within loop

#! /bin/bash
# count down time bomb
echo -e "Enter second:\c"

read asd
clear
echo count down start
while [ $asd -gt -1 ]
do
if [ $asd -gt 0 ]
then
echo "$asd"
sleep 1
else
echo -e "blast off\c"
sleep 1;echo -e ".\c"
sleep 1;echo -e ".\c"
sleep 1;echo -e ".\c"
fi
asd=$[ asd - 1 ]
done

-------------------------------------------------------------------------------------------------------

Que 5:-In any multiplication example, also give the square of the answer (eg 5 * 4 = 20 400)

Ans:--

#! /bin/bash
# multiplication and its square
echo -e "Enter any two number(use space)\c";read as df
ans=`expr $as \* $df`
echo -e "Multiplication:$ans \nSquare of ans:`expr $ans \* $ans`"

------------------------------------------------------------------------------------------------------

Que 6:-Write any script with breakpoints, that is to stop and show you intermediate results

Ans:--

Workshop for Background processes:

Que 1:-List all the daemons running on your system.

Ans:-ps aux

USER

PID %CPU %MEM

VSZ RSS TTY

STAT START TIME COMMAND

root

1 0.0 0.0 3664 1980 ?

Ss 21:11 0:00 /sbin/init

root

2 0.0 0.0

0?

21:11 0:00 [kthreadd]

root

3 0.0 0.0

0?

21:11 0:00 [ksoftirqd/0]

root

4 0.0 0.0

0?

21:11 0:00 [kworker/0:0]

root

6 0.0 0.0

0?

21:11 0:00 [migration/0]

root

7 0.0 0.0

0?

21:11 0:00 [watchdog/0]

root

8 0.0 0.0

0?

21:11 0:00 [migration/1]

root

10 0.0 0.0

0?

21:11 0:00 [ksoftirqd/1]

root

11 0.0 0.0

0?

21:11 0:00 [watchdog/1]

root

12 0.0 0.0

0?

21:11 0:00 [migration/2]

root

13 0.0 0.0

0?

21:11 0:00 [kworker/2:0]

root

14 0.0 0.0

0?

21:11 0:00 [ksoftirqd/2]

root

15 0.0 0.0

0?

21:11 0:00 [watchdog/2]

root

16 0.0 0.0

0?

21:11 0:00 [migration/3]

root

17 0.0 0.0

0?

21:11 0:00 [kworker/3:0]

root

18 0.0 0.0

0?

21:11 0:00 [ksoftirqd/3]

root

19 0.0 0.0

0?

21:11 0:00 [watchdog/3]

root

20 0.0 0.0

0?

S< 21:11 0:00 [cpuset]

root

21 0.0 0.0

0?

S< 21:11 0:00 [khelper]

root

22 0.0 0.0

0?

21:11 0:00 [kdevtmpfs]

root

23 0.0 0.0

0?

S< 21:11 0:00 [netns]

root

25 0.0 0.0

0?

21:11 0:00 [sync_supers]

root

26 0.0 0.0

0?

21:11 0:00 [bdi-default]

root

27 0.0 0.0

0?

S< 21:11 0:00 [kintegrityd]

root

28 0.0 0.0

0?

S< 21:11 0:00 [kblockd]

root

29 0.0 0.0

0?

S< 21:11 0:00 [ata_sff]

root

30 0.0 0.0

0?

root

31 0.0 0.0

0?

S< 21:11 0:00 [md]

root

34 0.0 0.0

0?

21:11 0:00 [khungtaskd]

root

35 0.0 0.0

0?

21:11 0:00 [kswapd0]

root

36 0.0 0.0

0?

SN 21:11 0:00 [ksmd]

root

37 0.0 0.0

0?

SN 21:11 0:00 [khugepaged]

root

38 0.0 0.0

0?

21:11 0:00 [fsnotify_mark]

root

39 0.0 0.0

0?

21:11 0:00 [ecryptfs-kthrea]

root

40 0.0 0.0

0?

S< 21:11 0:00 [crypto]

root

49 0.0 0.0

0?

S< 21:11 0:00 [kthrotld]

root

53 0.0 0.0

0?

21:11 0:00 [kworker/1:1]

root

54 0.0 0.0

0?

21:11 0:00 [scsi_eh_0]

root

55 0.0 0.0

0?

21:11 0:00 [scsi_eh_1]

root

56 0.0 0.0

0?

21:11 0:00 [scsi_eh_2]

root

57 0.0 0.0

0?

21:11 0:00 [scsi_eh_3]

root

58 0.0 0.0

0?

21:11 0:00 [scsi_eh_4]

root

59 0.0 0.0

0?

21:11 0:00 [scsi_eh_5]

root

62 0.0 0.0

0?

21:11 0:00 [kworker/u:5]

root

63 0.0 0.0

0?

21:11 0:00 [kworker/u:6]

root

65 0.0 0.0

0?

S< 21:11 0:00 [binder]

root

85 0.0 0.0

0?

S< 21:11 0:00 [deferwq]

root

86 0.0 0.0

0?

S< 21:11 0:00 [charger_manager]

root

87 0.0 0.0

0?

S< 21:11 0:00 [devfreq_wq]

root

88 0.0 0.0

0?

21:11 0:00 [khubd]

21:11 0:00 [kworker/1:2]

root

271 0.0 0.0

0?

root

272 0.0 0.0

0?

S< 21:11 0:00 [ext4-dio-unwrit]

root

290 0.0 0.0

0?

root

356 0.0 0.0 2836 608 ?

root

387 0.0 0.0 3256 1508 ?

Ss 21:11 0:00 /sbin/udevd --daemon

root

667 0.0 0.0 2848 352 ?

root

668 0.0 0.0

0?

root

672 0.0 0.0

0?

S< 21:11 0:00 [kpsmoused]

root

673 0.0 0.0

0?

21:11 0:00 [ips-adjust]

root

675 0.0 0.0

0?

21:11 0:00 [ips-monitor]

root

677 0.0 0.0

0?

S< 21:11 0:00 [cfg80211]

root

709 0.0 0.0

0?

S< 21:11 0:00 [kvm-irqfd-clean]

root

749 0.0 0.0

0?

S< 21:11 0:00 [hci0]

root

750 0.0 0.0

0?

syslog
root

21:11 0:00 [jbd2/sda5-8]

21:11 0:00 [flush-8:0]

0?

21:11 0:00 upstart-socket-bridge --daemon

21:11 0:00 [irq/45-mei]

21:11 0:00 [wl_event_handle]

816 0.0 0.0 31064 1512 ?


818 0.0 0.0

21:11 0:00 upstart-udev-bridge --daemon

Sl 21:11 0:00 rsyslogd -c5

S< 21:11 0:00 [hd-audio0]

102
861 0.0 0.0 4244 1980 ?
--activation=upstart

Ss 21:11 0:00 dbus-daemon --system --fork

root

873 0.0 0.0 7224 2816 ?

Ss 21:11 0:00 /usr/sbin/modem-manager

root

875 0.0 0.0 4744 1868 ?

Ss 21:11 0:00 /usr/sbin/bluetoothd

avahi
880 0.0 0.0 3456 1480 ?
[ubuntu1204.local]

21:11 0:00 avahi-daemon: running

avahi

21:11 0:00 avahi-daemon: chroot helper

883 0.0 0.0 3456 436 ?

root

884 0.0 0.0

0?

S< 21:11 0:00 [krfcommd]

root

897 0.0 0.1 32444 5704 ?

Ssl 21:11 0:00 NetworkManager

root

903 0.0 0.0 11076 3552 ?

Ss 21:11 0:00 /usr/sbin/cupsd -F

root
908 0.0 0.1 26944 4304 ?
debug

Sl 21:11 0:00 /usr/lib/policykit-1/polkitd --no-

root
914 0.0 0.0 5960 2040 ?
Ss 21:11 0:00 /sbin/wpa_supplicant -B -P
/run/sendsigs.omit.d/wpasupplicant.pid -u -s -O /var/run/wpa_supplicant
root

975 0.0 0.0 4632 860 tty4

Ss+ 21:11 0:00 /sbin/getty -8 38400 tty4

root

984 0.0 0.0 4632 860 tty5

Ss+ 21:11 0:00 /sbin/getty -8 38400 tty5

root

999 0.0 0.0 4632 856 tty2

Ss+ 21:11 0:00 /sbin/getty -8 38400 tty2

root

1003 0.0 0.0 4632 860 tty3

Ss+ 21:11 0:00 /sbin/getty -8 38400 tty3

root

1005 0.0 0.0 4632 864 tty6

Ss+ 21:11 0:00 /sbin/getty -8 38400 tty6

root
1023 0.0 0.0 2176 716 ?
/var/run/acpid.socket
root

1024 0.0 0.0 35752 3748 ?

root

1025 0.0 0.0 3604 636 ?

Ss 21:11 0:00 acpid -c /etc/acpi/events -s


Ssl 21:11 0:00 lightdm
Ss 21:11 0:00 /usr/sbin/irqbalance

whoopsie 1026 0.0 0.1 26464 4708 ?

Ssl 21:11 0:00 whoopsie

root
1046 1.4 0.4 47532 18572 tty7 Ss+ 21:11 0:15 /usr/bin/X :0 -auth
/var/run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch -background none
root

1048 0.0 0.0 2620 916 ?

daemon

Ss 21:11 0:00 cron

1049 0.0 0.0 2472 344 ?

Ss 21:11 0:00 atd

root
1199 0.0 0.1 17244 4064 ?
daemon

Sl 21:11 0:00 /usr/lib/accountsservice/accounts-

root

Ss+ 21:11 0:00 /sbin/getty -8 38400 tty1

1221 0.0 0.0 4632 868 tty1

root
1245 0.0 0.0 34212 3336 ?
daemon

Sl 21:11 0:00 /usr/sbin/console-kit-daemon --no-

root

Sl 21:11 0:00 /usr/lib/upower/upowerd

1358 0.0 0.1 28980 4456 ?

colord 1524 0.0 0.2 54680 10920 ?


gnu/colord/colord

Sl 21:11 0:00 /usr/lib/i386-linux-

root

1527 0.0 0.0 17872 3808 ?

Sl 21:11 0:00 lightdm --session-child 12 19

rtkit

1554 0.0 0.0 21332 1248 ?

SNl 21:11 0:00 /usr/lib/rtkit/rtkit-daemon

root
1571 0.0 0.0 2928 1300 ?
S 21:11 0:00 /sbin/dhclient -d -4 -sf
/usr/lib/NetworkManager/nm-dhcp-client.action -pf /var/run/sendsigs.omit.d/networkmanager.dhclient-eth1.pid -lf /var/lib/dhcp/dhclient-63a92590-d60f-48ba-ac95a413baeb7773-eth1.lease -cf /var/run/nm-dhclient-eth1.conf eth1
nobody 1576 0.0 0.0 5404 1156 ?
S 21:11 0:00 /usr/sbin/dnsmasq --no-resolv
--keep-in-foreground --no-hosts --bind-interfaces --pidfile=/var/run/sendsigs.omit.d/network-manager.dnsmasq.pid --listen-address=127.0.0.1
--conf-file=/var/run/nm-dns-dnsmasq.conf --cache-size=0 --proxy-dnssec
root

1631 0.0 0.0

0?

21:12 0:00 [kworker/3:2]

sagar 1687 0.0 0.1 55944 4032 ?


--daemonize --login

Sl 21:12 0:00 /usr/bin/gnome-keyring-daemon

sagar

Ssl 21:12 0:00 gnome-session --session=ubuntu

1698 0.0 0.2 50904 9024 ?

sagar 1733 0.0 0.0 4080 208 ?


Ss 21:12 0:00 /usr/bin/ssh-agent /usr/bin/dbuslaunch --exit-with-session gnome-session --session=ubuntu
sagar 1736 0.0 0.0 3940 484 ?
S 21:12 0:00 /usr/bin/dbus-launch --exit-withsession gnome-session --session=ubuntu
sagar 1737 0.1 0.0 6300 2784 ?
pid 5 --print-address 7 --session

Ss 21:12 0:01 //bin/dbus-daemon --fork --print-

sagar 1748 0.0 0.4 157988 16240 ?


daemon/gnome-settings-daemon
sagar

1755 0.0 0.0 8408 2220 ?

Sl 21:12 0:00 /usr/lib/gnome-settingsS 21:12 0:00 /usr/lib/gvfs/gvfsd

sagar 1757 0.0 0.0 36080 3192 ?


-f /home/sagar/.gvfs
sagar

Sl 21:12 0:00 /usr/lib/gvfs//gvfs-fuse-daemon

1765 1.7 1.6 212620 64472 ?

Sl 21:12 0:16 compiz

sagar 1770 0.0 0.0 9272 2912 ?


gnu/gconf/gconfd-2

S 21:12 0:00 /usr/lib/i386-linux-

sagar

S 21:12 0:00 syndaemon -i 2.0 -K -R -t

1774 0.0 0.0 3712 792 ?

sagar 1779 0.0 0.1 99608 5196 ?


target=syslog
sagar

S<l 21:12 0:00 /usr/bin/pulseaudio --start --log-

1780 0.0 0.3 115368 14772 ?

Sl 21:12 0:00 nm-applet

sagar 1782 0.0 0.2 59104 8400 ?


daemon/gnome-fallback-mount-helper

Sl 21:12 0:00 /usr/lib/gnome-settings-

sagar 1783 0.0 0.2 40664 8040 ?


gnome-authentication-agent-1

Sl 21:12 0:00 /usr/lib/policykit-1-gnome/polkit-

sagar

1784 0.0 0.2 81080 11148 ?

Sl 21:12 0:00 bluetooth-applet

sagar

1785 0.8 0.7 163676 30100 ?

Sl 21:12 0:07 nautilus -n

sagar 1803 0.0 0.1 29648 4268 ?


monitor

S 21:12 0:00 /usr/lib/gvfs/gvfs-gdu-volume-

sagar 1805 0.0 0.0 14104 2492 ?


helper

S 21:12 0:00 /usr/lib/pulseaudio/pulse/gconf-

root

Sl 21:12 0:00 /usr/lib/udisks/udisks-daemon

1807 0.0 0.0 25516 3760 ?

root
1808 0.0 0.0 6556 732 ?
devices

21:12 0:00 udisks-daemon: not polling any

sagar 1812 0.0 0.0 20488 2140 ?


monitor

Sl 21:12 0:00 /usr/lib/gvfs/gvfs-afc-volume-

sagar 1815 0.0 0.0 9212 2156 ?


monitor

S 21:12 0:00 /usr/lib/gvfs/gvfs-gphoto2-volume-

sagar 1820 0.0 0.0 10148 3652 ?


:1.6 /org/gtk/gvfs/exec_spaw/0

S 21:12 0:00 /usr/lib/gvfs/gvfsd-trash --spawner

sagar

1826 0.0 0.0 8340 2032 ?

S 21:12 0:00 /usr/lib/gvfs/gvfsd-metadata

sagar

1833 0.1 0.2 50812 9372 ?

Sl 21:12 0:01 /usr/lib/bamf/bamfdaemon

sagar 1838 0.0 0.0 8440 2392 ?


S
--spawner :1.6 /org/gtk/gvfs/exec_spaw/1
sagar 1839 0.0 0.0 2236 532 ?
decorator

21:12 0:00 /usr/lib/gvfs/gvfsd-burn

Ss 21:12 0:00 /bin/sh -c /usr/bin/compiz-

sagar

1840 0.0 0.2 42552 10552 ?

Sl 21:12 0:00 /usr/bin/gtk-window-decorator

sagar

1847 0.4 0.4 96640 19204 ?

Sl 21:12 0:04 /usr/lib/unity/unity-panel-service

sagar 1849 0.2 0.1 48988 6072 ?


service

Sl 21:12 0:02 /usr/lib/indicator-appmenu/hud-

sagar 1860 0.0 0.1 67432 6028 ?


messages/indicator-messages-service

Sl 21:12 0:00 /usr/lib/indicator-

sagar 1862 0.0 0.2 62572 9316 ?


printers/indicator-printers-service

Sl 21:12 0:00 /usr/lib/indicator-

sagar 1869 0.0 0.1 74556 6724 ?


datetime/indicator-datetime-service

Sl 21:12 0:00 /usr/lib/indicator-

sagar 1870 0.0 0.1 70772 6088 ?


session/indicator-session-service

Sl 21:12 0:00 /usr/lib/indicator-

sagar 1871 0.0 0.1 54376 4412 ?


Sl 21:12 0:00 /usr/lib/indicatorapplication/indicator-application-service
sagar 1872 0.0 0.1 136748 6432 ?
sound-service
sagar

1910 0.0 0.0 7980 2364 ?

Sl 21:12 0:00 /usr/lib/indicator-sound/indicatorS 21:12 0:00 /usr/lib/geoclue/geoclue-master

sagar 1920 0.0 0.1 21480 4608 ?


geoip-provider

S 21:12 0:00 /usr/lib/ubuntu-geoip/ubuntu-

sagar 1927 0.0 0.2 42256 8604 ?


notification-daemon

Sl 21:12 0:00 /usr/lib/gnome-disk-utility/gdu-

sagar

1931 0.0 0.2 74420 9564 ?

Sl 21:13 0:00 telepathy-indicator

sagar
5

1937 0.0 0.1 43416 6392 ?

Sl 21:13 0:00 /usr/lib/telepathy/mission-control-

sagar 1942 0.0 0.2 91340 9248 ?


accounts/goa-daemon

Sl 21:13 0:00 /usr/lib/gnome-online-

sagar

Sl 21:13 0:00 zeitgeist-datahub

1947 0.0 0.1 56604 6500 ?

sagar

1948 0.0 0.2 41000 8368 ?

Sl 21:13 0:00 gnome-screensaver

sagar

1954 0.0 0.1 46320 5144 ?

Sl 21:13 0:00 /usr/bin/zeitgeist-daemon

sagar

1962 0.0 0.2 52064 8140 ?

Sl 21:13 0:00 /usr/lib/zeitgeist/zeitgeist-fts

sagar

1970 0.0 0.0 4228 284 ?

sagar

1975 0.0 0.3 52608 11792 ?

S 21:13 0:00 /bin/cat


Sl 21:13 0:00 update-notifier

sagar 1987 0.0 0.2 75848 9616 ?


applications/unity-applications-daemon

Sl 21:13 0:00 /usr/lib/unity-lens-

sagar 1990 0.0 0.1 89216 5568 ?


daemon

Sl 21:13 0:00 /usr/lib/unity-lens-files/unity-files-

sagar 1993 0.0 0.1 81772 7244 ?


music-daemon

Sl 21:13 0:00 /usr/lib/unity-lens-music/unity-

sagar 1995 0.0 0.3 79960 12092 ?


lens-video/unity-lens-video

Sl 21:13 0:00 /usr/bin/python /usr/lib/unity-

root
2044 0.0 0.2 17980 9112 ?
service/system-service-d

21:13 0:00 /usr/bin/python /usr/lib/system-

sagar 2046 0.0 0.0 79608 3776 ?


musicstore-daemon

Sl 21:13 0:00 /usr/lib/unity-lens-music/unity-

sagar 2063 0.0 0.3 101188 13624 ?


Sl 21:13 0:00 /usr/bin/python /usr/lib/unityscope-video-remote/unity-scope-video-remote
sagar

2105 0.0 0.0 33516 2448 ?

root

2140 0.0 0.0 3252 1064 ?

21:14 0:00 /sbin/udevd --daemon

root

2141 0.0 0.0 3252 828 ?

21:14 0:00 /sbin/udevd --daemon

root

2142 0.0 0.0

0?

Sl 21:13 0:00 /usr/lib/dconf/dconf-service

sagar 2143 0.0 0.1 36736 3972 ?


dup-monitor

Sl 21:14 0:00 /usr/lib/deja-dup/deja-dup/deja-

sagar 2162 0.9 0.6 106860 26608 ?


/home/sagar/Desktop/processes-cvs
0

2308 0.0 0.0

sagar

2421 0.2 0.3 93440 14696 ?

sagar

2427 0.0 0.0 2404 724 ?

sagar

2428 0.1 0.0 7256 3668 pts/0

root

2503 0.0 0.0

sagar

2508 0.0 0.0 4948 1160 pts/0

R+ 21:28 0:00 ps aux

sagar

2509 0.0 0.0 7256 2240 pts/0

D+ 21:28 0:00 bash

0?

Sl 21:17 0:06 gedit

root

0?

21:14 0:00 [kworker/2:2]

21:19 0:00 [kworker/0:1]


Sl 21:27 0:00 gnome-terminal
S 21:27 0:00 gnome-pty-helper

Ss 21:27 0:00 bash


21:28 0:00 [kworker/0:2]

--------------------------------------------------------------------------------------------------

Que 2:-List all the processes running under root in your system

Ans:-ps -u root

PID TTY

TIME CMD

1?

00:00:00 init

2?

00:00:00 kthreadd

3?

00:00:00 ksoftirqd/0

4?

00:00:00 kworker/0:0

6?

00:00:00 migration/0

7?

00:00:00 watchdog/0

8?

00:00:00 migration/1

10 ?

00:00:00 ksoftirqd/1

11 ?

00:00:00 watchdog/1

12 ?

00:00:00 migration/2

13 ?

00:00:00 kworker/2:0

14 ?

00:00:00 ksoftirqd/2

15 ?

00:00:00 watchdog/2

16 ?

00:00:00 migration/3

17 ?

00:00:00 kworker/3:0

18 ?

00:00:00 ksoftirqd/3

19 ?

00:00:00 watchdog/3

20 ?

00:00:00 cpuset

21 ?

00:00:00 khelper

22 ?

00:00:00 kdevtmpfs

23 ?

00:00:00 netns

25 ?

00:00:00 sync_supers

26 ?

00:00:00 bdi-default

27 ?

00:00:00 kintegrityd

28 ?

00:00:00 kblockd

29 ?

00:00:00 ata_sff

30 ?

00:00:00 khubd

31 ?

00:00:00 md

34 ?

00:00:00 khungtaskd

35 ?

00:00:00 kswapd0

36 ?

00:00:00 ksmd

37 ?

00:00:00 khugepaged

38 ?

00:00:00 fsnotify_mark

39 ?

00:00:00 ecryptfs-kthrea

40 ?

00:00:00 crypto

49 ?

00:00:00 kthrotld

53 ?

00:00:00 kworker/1:1

54 ?

00:00:00 scsi_eh_0

55 ?

00:00:00 scsi_eh_1

56 ?

00:00:00 scsi_eh_2

57 ?

00:00:00 scsi_eh_3

58 ?

00:00:00 scsi_eh_4

59 ?

00:00:00 scsi_eh_5

62 ?

00:00:00 kworker/u:5

63 ?

00:00:00 kworker/u:6

65 ?

00:00:00 binder

85 ?

00:00:00 deferwq

86 ?

00:00:00 charger_manager

87 ?

00:00:00 devfreq_wq

88 ?

00:00:00 kworker/1:2

271 ?

00:00:00 jbd2/sda5-8

272 ?

00:00:00 ext4-dio-unwrit

290 ?

00:00:00 flush-8:0

356 ?

00:00:00 upstart-udev-br

387 ?

00:00:00 udevd

667 ?

00:00:00 upstart-socket-

668 ?

00:00:00 irq/45-mei

672 ?

00:00:00 kpsmoused

673 ?

00:00:00 ips-adjust

675 ?

00:00:00 ips-monitor

677 ?

00:00:00 cfg80211

709 ?

00:00:00 kvm-irqfd-clean

749 ?

00:00:00 hci0

750 ?

00:00:00 wl_event_handle

818 ?

00:00:00 hd-audio0

873 ?

00:00:00 modem-manager

875 ?

00:00:00 bluetoothd

884 ?

00:00:00 krfcommd

897 ?

00:00:00 NetworkManager

903 ?

00:00:00 cupsd

908 ?

00:00:00 polkitd

914 ?

00:00:00 wpa_supplicant

975 tty4

00:00:00 getty

984 tty5

00:00:00 getty

999 tty2

00:00:00 getty

1003 tty3

00:00:00 getty

1005 tty6

00:00:00 getty

1023 ?

00:00:00 acpid

1024 ?

00:00:00 lightdm

1025 ?

00:00:00 irqbalance

1046 tty7

00:00:17 Xorg

1048 ?

00:00:00 cron

1199 ?

00:00:00 accounts-daemon

1221 tty1

00:00:00 getty

1245 ?

00:00:00 console-kit-dae

1358 ?

00:00:00 upowerd

1527 ?

00:00:00 lightdm

1571 ?

00:00:00 dhclient

1631 ?

00:00:00 kworker/3:2

1807 ?

00:00:00 udisks-daemon

1808 ?

00:00:00 udisks-daemon

2044 ?

00:00:00 system-service-

2140 ?

00:00:00 udevd

2141 ?

00:00:00 udevd

2142 ?

00:00:00 kworker/2:2

2308 ?

00:00:00 kworker/0:1

2503 ?

00:00:00 kworker/0:2

------------------------------------------------------------------------------------------------------

Que 3:-Run the sleep command and place it in the background Then kill it in the background

Ans:-sleep 300

^Z
[1]+ Stopped

sleep 300

ps

PID TTY
2428 pts/2

TIME CMD
00:00:00 bash

2517 pts/2

00:00:00 sleep

2518 pts/2

00:00:00 ps

bg %1
[1]+ sleep 300 &

kill -9 %1
[1]+ Killed

sleep 300

------------------------------------------------------------------------------------------------------

Que 4:-Run the vim editor (on any file) and place it in the background. Bring it to the foreground and
kill it. Was it successful?

Ans:-vim abc.txt

^z
[1]+ Stopped

vim abc.txt

Now put in background

bg %1
[1]+ vim asd.txt &
[1]+ Stopped

vim abc.txt

so, we cann't put vim in backgroung. if we put it in background then it automaticaly stopped.

fg %1

then it display vim editor and so we can execute kill command when it is in foreground.
so we cannt kill in fg.

----------------------------------------------------------------------------------------------

Que 5:-Run the command $ sudo apt-get update. Put it in the background. What are the problems you
face. Try to find the cause yourself.

Ans:-sudo apy-get update &


[1] 2857

jobs
[1]+ Running

sudo apt-get update &

problem:-- by writting '&' putting into background. but when you press enter key after
writting command.
process will continue to display in terminal but cursur doesn't work in terminal.

after giving command


fg %1
cursur is wrok normally.

CVS
Que 1:-List the importance of versioning software developments.

Ans:-Version Control System is a software tool, which helps in keeping track of all revisions and
releases of a project's source code.
Able to track changes made by different users and their contribution towards collabrative
development of project.
Allows multiple people to work simultaneously.
Enables retrieval of old systems.
Helps to manage different versions, releases.
Works well over LAN, WAN (server/client).
Works fine for any ASCII file.

------------------------------------------------------------------------------------------------

Que 2:-Install the CVS server and prove to yourself the creation and existence of CVSROOT.

Ans:--

--------------------------------------------------------------------------------------------------

Que 3:-What is the symbolic meaning meaning of CVSROOT. (Why is the repository not just
another linux folder)

Ans:--

CVSROOT is an environment variable for location for CVS repository.

It is set to repository directory for local use.

---------------------------------------------------------------------------------------------

Que 4:-Is there any other similar software you are aware of?

Ans:--

Github software which is host on github.com

sourceforge which is open source repository on sourceforge.net

code.google.com from google.

bazzar from cononical.

Subversion

-----------------------------------------------------------------------------------------------

Вам также может понравиться