0% found this document useful (0 votes)
162 views2 pages

Viva Questions 3it11 Usp Lab

The document provides instructions for various commands in Linux/Unix including: - Checking the shell, date, users, directory ($SHELL, date, who, pwd) - Removing files and directories (rm, rm -rf) - Finding username, sending email (whoami, mail) - Counting words, lines, characters (wc) - Searching files and directories (grep) - Listing and stopping processes (ps, kill) - Running processes in background (&) - Conditional statements and comparisons in shell scripts (if, -eq, -ne, etc.) - Testing file properties (-s, -f, -d etc.) - Boolean logic (-a, -

Uploaded by

krishnamamta
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
162 views2 pages

Viva Questions 3it11 Usp Lab

The document provides instructions for various commands in Linux/Unix including: - Checking the shell, date, users, directory ($SHELL, date, who, pwd) - Removing files and directories (rm, rm -rf) - Finding username, sending email (whoami, mail) - Counting words, lines, characters (wc) - Searching files and directories (grep) - Listing and stopping processes (ps, kill) - Running processes in background (&) - Conditional statements and comparisons in shell scripts (if, -eq, -ne, etc.) - Testing file properties (-s, -f, -d etc.) - Boolean logic (-a, -

Uploaded by

krishnamamta
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

VIVA QUESTIONS 3IT11 USP LAB 1. 2. 3. . ". $. '. How do you find out whats your shell?

- echo $SHELL Whats the command to find out todays date? - date Whats the command to find out users on the system? - who How do you find out the current directory youre in? - !wd How do you remo#e a file? - rm How do you remo#e a % in files the all with&- rm -rf How do you find out your own username? - whoami How do you send a mail messa)e to some*ody? - mail some*ody+techinter#iews.com -s ,-our su*.ect -c ,cc+techinter#iews.com, How do you count words0 lines and characters in a file? - wc How do you search for a strin) inside a )i#en file? - )re! strin) filename How do you search for a strin) inside a directory? - )re! strin) 2 How do you search for a strin) in a directory with the su*directories recursed? - )re! -r strin) 2 What are 345s? - 6hey are !rocess 45s )i#en to !rocesses. 7 345 can #ary from 1 to $""3". How do you list currently runnin) !rocess? - !s How do you sto! a !rocess? - 8ill !id How do you find out a*out all runnin) !rocesses? - !s -a) How do you sto! all the !rocesses0 e9ce!t the shell window? - 8ill 1 How do you fire a !rocess in the *ac8)round? - .:!rocess-name ; How do you refer to the ar)uments !assed to a shell scri!t? - $10 $2 and so on. $1 is your scri!t name. Whats the conditional statement in shell scri!tin)? - if <condition= then > fi How do you do num*er com!arison in shell scri!ts? - -e?0 -ne0 -lt0 -le0 -)t0 -)e How do you test for file !ro!erties in shell scri!ts? - -s filename tells you if the file is not em!ty0 -f filename tells you whether the ar)ument is a file0 and not a directory0 -d filename tests if the ar)ument is a directory0 and not a file0 -w filename tests for writea*ility0 -r filename tests for reada*ility0 -9 filename tests for e9ecuta*ility How do you do @oolean lo)ic o!erators in shell scri!tin)? - A tests for lo)ical not0 -a tests for lo)ical and0 and -o tests for lo)ical or. How do you find out the num*er of ar)uments !assed to the shell scri!t? - $B Whats a way to do multile#el if-elses in shell scri!tin)? - if <condition= then <statement= elif <condition= <statement= fi How do you write a for loo! in shell? - for <#aria*le name= in <list= do <statement= done How do you write a while loo! in shell? - while <condition= do <statement= done How does a case statement loo8 in shell scri!ts? - case <#aria*le= in <!ossi*le-#alue-1=C <statement=DD <!ossi*le-#alue-2=C <statement=DD esac How do you read 8ey*oard in!ut in shell scri!ts? - read <#aria*le-name= How do you define a function in a shell scri!t? - function-nameEC < Bsome code here return = How does )eto!ts command wor8? - 6he !arameters to your scri!t can *e !assed as -n 1" -9 21. 4nside the scri!t0 you can iterate throu)h the )eto!ts array as while )eto!ts nF9 o!tion0 and the #aria*le $o!tion contains the #alue of the entered o!tion. what is shell and 8erne? what are ty!es of shell?

(.
/. 11. 11. 12. 13. 1 . 1". 1$. 1'. 1(. 1/. 21. 21. 22.

23. 2 . 2". 2$. 2'. 2(. 2/. 31. 31.

32. 33.

3 . 3". 3$. 3'. 3(. 3/. 1. 1. 2. 3.

list any " GS what do you understand *y command line ar)ument? what are features of uni9? difference *etween linu9 n uni9? e9!lain *anner command? how to use head and tail? how to com!are two files? how to find common data *etween two files? What is H4 editor? How to construct case in shell?

You might also like