You are on page 1of 8

UNIX

1. How to get the OS name ?


2. How to know since when the server is up ?
3. How to get the last boot time of server ?
4. How to get the details of user ?
5. How to know who all are currently logged in and which program they are execut
ing currently ?
6. How to get the current date and time ?
7. How to get yesterdays date ?
8. How to get tomorrows date ?
9. How to print the date in the following format ? Todays date is : YYYY-mm-dd:H
H-MM-SS
10. How to change the users information ?
11. How to get the id of a particular user ?
12. How to know the present working directory ?
13. How to know which terminal is associated with your current session ?
14. How to get the current terminal settting details ?
15. How to see the calendar of March 1999 ?
16. How to see the calendar for the year 1992 ?
17. How to get the hostname ?
18. How to get the FQDN (Fully Qualified Domain Name) ?
19. Cretate a file using cat command ? What is the difference ctrl+d and ctrl+c
( when you are using the ctrl keys to save and exit )??
20. How to append contents to a existing file?
21. How to change the modification time of a file ?
22. Change the modification time of Qwest.ext file as 1999-Oct-10 23:25 if it e
xists !!
23. How many ways you can create a blank file ?
24. Cretate file My documents ?
25. Create a file filename . List ,rename and delete the same file .
26. What is the difference between hard link and soft link ?
27. How to get the inode number of the file ?
28. Explain the output of ls li .
29. How to get the access time and modfication time of a file ?
30. How to get the file size in kb,mb,gb ??
31. How to list the contents of a directory in a single column ?
32. How to create a hidden file and how to list the file ?
33. How to copy a file with the existing time stamp of source file ? i.e : time
stamp of source and destination file should be the same ..
34. Explain indirection,Redirection,Here document .
35. Explain Link count field .( output of ls l command ) ?
36. How to copy a file without using cp command ?
37. How to create a hard/soft link to a file without using ln command ?
38. What is link and unlink command ?
39. How to create a directory ?
40. Create the directory structure : A/B/C/D ?
41. Create directory Qwest with permission 700 ?
42. Rename the directory Qwest to Qwest_bkp ?
43. Create a directory WMAIP inside Qwest .
44. Copy the Whole Qwest directory to Qwest_bkp ?
45. Explain cd - ? How it works ?
46. How to go back to home directory ?
47. How to copy a directory recursively ?
48. How to remove a non empty directory ?
49. How to remove a empty directory ?
50. How to create a link to a directory ?
51. How to go to the root directory ?
52. How to go to other users home directory ?
53. Explain mkdir p and rmdir p ?
54. Explain about the following SHELL variables : HOME ,PWD,OLDPWD
55. Create a directory Qwest ?
56. Remove the directory Qwest ?
57. How to create a hidden directory ?
58. What is absolute path and relative path ?
59. Try to create a directory under / ( root ) drectory .Notice the error messag
e .
60. What is the default directory permission ?
70. What is the default file permission ?
71. What is the default umask value ?
72. How to change the umask value ?
73. How umask value plays the role in changing the permission ?
74. Let I want to set the umask value as 0077 permanently .What are the steps to
do it ? After the set up what will be the directory and file permissions ?
75. How to change the group of a file/directory ?
76. How to change the owner of the file or directory ?
77. Set the following permission to Qwest.txt
user : read,write
group:read
others: none
Set the permission in 2 ways .
78. Explain the octal representation ?
79. What is set id mode ?
80. What is sticky bit ?How to set sticky bit ?
81. How to revoke sticky bit ?
82. Cretate a directory Qwest_EX with 600 permission ,then try to cd to that di
rectory and analyse the error message .
83. Let you are the owner of a directory .The directory permission is 600 .Will
you able to list the contetnts ?
84. How many ways we can grant read,write,execute permission to all on Qwest.txt
( Qwest.txt is text file ) ?
85. What is the default permission for symbolic link(s) ?Can we change the permi
ssion of symbolic links ?
86. What will happen if you change the permission of symbolic/soft link (s) ?
87. Let in a directory you have 30 regular text files and 5 symbolic/soft links
and 10 directories . Recursively change the permission of regular file
s and directories to 700 without any change to linked files .
88. How to get the list of unique records from a file ?
89. How to get the list of duplicate records from a file ?
90. How to get the count of each unique record present in a file ?
91. Let in a file we have the following contents .How to get the uniq records us
ing sort ?
1
2
1
3
1
4
4
Required output is :
1
2
3
4
92. What is sort command and explain some useful options of sort command ?
93. How to perform numeric sort ?
94. How to get the list of 5 big size files, Which are present in your present
working directory ?
95. Let Qwest.txt file contains 110 lines . Write an one liner which will print
the lines 23 to 43 ?
96. What will be the output of head Qwest.txt
97. What will be the output of tail Qwest.txt
98. What is tail f ? When it is required ?
99. What is the purpose of more command ?
100. Explain about less and pg ?
101. What is cmp command ?
102. What is the purpose of diff command ?
103. What is the purpose of sdiff command ?
104. How to generate the sequence of numbers ?
105. What is the exit status of cmp command ?
106. What is the exit status of diff command ?
107. How to get the exit status of the following command ? diff Q1.txt Q2.txt
108. How to get the exit status of the following command ? cmp Q1.txt Q2.txt
109. What is the purpose of col p ?
110. How to get the following output using seq command ? 1:2:3:4:5:6:7:8:9:10
111. How to get the record/line count of a file ?
112. How to know how many lines are present in a file ?
113. How to know how many words are present in a file ?
114. How to know how many characters are present in a file ?
115. How to know how many alpha numeric characters are present in a file ?
116. How to view a file ?
117. Suppose you opened a file with view command and did some modification .How
to save the modifications ?
118. How to save a file ?
119. Suppose 2 users opened the same file .one of the user modified some content
s .The other user wants to see the content without exiting from the vi edit
or .What is the command to refresh/ see the modified contents of the file ?
120. How to insert a text to a file ?
121. What is the command to come back to the shell temporarily ?
122. What is the command to save and exit from vi editor ?
123. What is the command to exit without save ?
124. What is wq! ?
125. What is q! ?
126. How to go to the last line of a file ?
127. How to go the end of the current line ?
128. How to add a line below and above the current cursor position ?
129. How to go to a specific line ? Let line 10 ?
130. How to append text to the end of a line and in between ?
131. How to join two lines ?
132. How to set the line numbers ?
133. How to unset the line number ?
134. How to move up ,down ,left and right from the cursor position ?
135. How to delete a word ?
136. How to delete 3 words from current cursor position ?
137. How to delete 3 characters from current cursor position ?
138. How to replace a character ?
139. How to delete a single line ?
140. How to delete multiple lines ?
141. How to undo ?
142. How to copy line # 15 to # 20 after line number 36 ?
143. How to move line # 15 to # 20 after line number 36 ?
144. How to copy 5 lines from the current position and paste it as per requireme
nt ?
145. What is w ?
146. How many modes are present in vi ?
147. Suppose in a file Qwest pattern is present . How will you replace Qwest wit
h IBM ?
148. Suppose in a file Qwest pattern is present . How will you replace Qwest wit
h IBM from line number 3 to 9?
149. What is . And $ ?
150. Suppose in a file Qwest pattern is present . How will you replace Qwest wit
h IBM from line number 1 to current cursor position?
151. Suppose in a file Qwest pattern is present . How will you replace Qwest wit
h IBM from line number current cursor position to last line?
152. How to edit multiple files ?What is n and rew ?
153. Suppose I want edit the line 10 of a file .When the file will be opened ,I
want the cursor should be present in the very beginning of line # 10 ?
154. How to copy the contents from a file and paste the same copied content in t
he current file .
155. How to get the password file entry for linux1 user?
156. Let the user name is unknown .It may be linux1, Linux1, LINUX1 .In that sc
enarion how to get the password file entry for linux1 user ?
157. How to search recursively /etc/ directory ,To get the list of files contain
ing string "10.140.7.1" ?
158. When you search for linux1, grep will match TRNlinux1, Linux123, etc.How to
force grep to select only those lines containing matches that form whole w
ords i.e. match only linux1 word: ?
159. How to use grep to search 2 different words in a file Qwest.txt .The words
are : Anil and srikanth ?
160. How to count lines when words has been matched ?
161. What is the use of -n option ( grep -n) ?
162. How to print the line that does not contain Qwest string ?
163. How to get the name of files which conains the string "Nithin" ?
164. grep command often used with pipes. For example print name of hard disk dev
ices:
# dmesg | egrep '(s|h)d[a-z]'
165. Display cpu model name:
# cat /proc/cpuinfo | grep -i 'Model'
However, above command can be also used as follows without shell pipe:
# grep -i 'Model' /proc/cpuinfo
166. you can force grep to display output in colors:
$ grep --color linux1 /etc/passwd
167. How to search the file Qwest.txt from current directory downwards?
168. How to find all files which begin with 'S' or 'N' from current directory do
wnwards ?
169. How to search directories called backup from /opt/proj directory downwards
?
170. How to search all directories from /opt/proj directory downwards for files
whose inode number is 1234 ?
171. How to search root directory downwards for files which have less than 2 lin
ks ?
172. How to search current directory downwards for all files whose owner is Qwes
t and group is default ?
173. How to search in current directory downwards for all files whose size is gr
eater than 3mb?
174. How to search in current directory downwards for all files which were acces
sed more than 2 months ago ?
175. How to search in current directory downwards for all files which were modif
ied more than 1 year ago ?
176. How to search in current directory downwards for all files which were modif
ied in last 10 hours ?
177. How to search in current directory downwards for all files which were modif
ied more than 5 hours ago ?
178. Search in current directory downwards for all files whose name is core and
remove the files ?
179. What is the difference between xargs and exec ?
180. Search in current directory downwards for all files which are modified afte
r /tmp/Qwest.txt ( newer than /tmp/Qwest.txt) ?
181. Search only in current directory ( not in sub directories ) for all files w
hich are modified after /tmp/Qwest.txt ( newer than /tmp/Qwest.txt) ?
182. What is the equivalent option for -maxdepth 1 ?
183. Which one of the following command is better and safe ?
find ./ -name "Qwest.txt" -type f -ls
find ./ -name "Qwest.txt" -type f -print |xargs ls -l
184. How to create a tar archive ?
185. How to extract a tar archive ?
186. How to see the contents of a tar archive ?
187. How to add a new file to a existing tar archive ?
188. How to remove a file from a existing tar archive ?
189. How to tar and gzip at the same time ?
190. How to gzip a file ?
191. How to gzip all files present in a directory ?
192. How to unzip a .gz file ?
193. How to zip a directory ?
194. How to unzip zip archive ?
195. How to view the contents of .gz file ?
196. How to compress a file and and how to view the contetnts of a compressed fi
le ?
197. How to uncompress a compressed file ?
198. How to list all process of the user Qwest ?
199. How to list all processes ?
200. Which one is the 1st process ?
201. How to get the current state of the process ?
202. How to identify a zombie process ?
203. How to get the startup time of the process ?
204. How to get the nice value of the process ?
205. How to get the priority of a process ?
206. How to get the current kernel operation of a process ?
207. How to get the pid and ppid of a process ?
208. How to get the owner details of a process ?
209. How to stop a given process ?
210. How to kill a process forcefully ?
211. How to terminate a process ?
212. How to stop several processes that ignore the default signal ?
213. Which command will stop all of your processes and log yourself off ?
214. How to stop all processes that you own ?
215. How to get the list of signals ?
216. How to kill the last back ground job ?
217. How to get the PID of current shell ?
218. How to modify the scheduling priority ?
219. What is the default nice value ?
220. What is the highest priority value ?
221. What is the lowest priority value ?
222. How to get the process details of user Qwest using pgrep ?
223. How to kill all the processes of user Qwest using pkill ?
224. How to get the virtual memory statistics information ?
225. How to get the IO statistics information ?
226. What is the equivalent command for top ?
227. How to get the top n processes ?
228. How to get the working directory of a process ?
229. How many ways we can back ground a job ?
230. How to fore ground a job ?
231. How to get the pid of background jobs ?
232. Why nohup is required ?
233. What is the default output file for nohup ?
234. Syntax of nohup command ?
235. How to run a script in back ground ?
236. Suppose one job ( fore ground job) is running on your console. Now you want
to make the job to run in back ground .What are the steps ?
237. What is the use of & ?
238. Will you able to kill a process owned by root ?
239. Schedule to a job which will run only once at 22:00 ?
240. How to check the jobs present in at queue ?
241. How to remove a job from at queue ?
242. How to schedule a job using batch ?
243. Schedule a job Clean which will run every Sunday at 3:45 AM ?
244. Schedule a job Clean which will run every day at 12 :45:35 ?
245. Schedule a job Clean which will run on last day of every month ?
246. Schedule a job Clean which will run on last Sunday of every month ?
247. Schedule a job Clean which will run on 2nd Tuesday of every month ?
248. Schedule a job Clean which will run at 5:45 AM from every Mon-Fri ?
249. Schedule a job Clean which will run in every 30 minutes on sundays.
250. Schedule a job which will run on 1st of every month on 2010 and 2011 ?
251. How to check whether cron job is executed or not ?
252. If job did not run as per cron then what are the actions need to be taken ?
253. Will the schedule jobs run when the password for the user expired ?
254. Shcedule a job which will run only on Jan 3rd every year ?
255. How to check the file system use ?
256. How to check the disk use for a specific directory ?
257. How to check the file system use in kb/mb/gb ?
258. How to identify a local file system and a NFS file system ?
259. How to check the quota information for a specific user ?
260. What is bdf ?
261. How to get the mount points ?
262. How to get the details of inodes used and inodes free ?
263. How to send an email using mail ?
264. How send an email using mailx ?
265. How to send an email using sendmail ?
266. How to send an email with attachment ?
267. How to send an email with attachment and message body ?
268. How to check the IP addresses of system ?
269. How to get the IP address using lanscan ?
270. How to check whether a port is listening or not ?
271. What is the purpose of ipcs command ?
272. What is the purpose of ipcrm command ?
273. How to check whether a server is available in net work or not ?
274. How to submit a job to a printer ?
275. How to check the status of print jobs ?
276. How to check how many jobs are present in the printer queue ?
277. How to remove or cancel a job from printer queue ?
278. How to perform arithmetic operations using bc ? Give some examples ?
279. How to perform arithmetic operations using expr ?
280. How to perform arithmetic operations using (( )) ?
281. How to add 2 floating point numbers ?
282. How confirm that file transfer is successful ?
283. Explain the use of cksum command ?
284. What is the difference between sum and cksum ?
285. How to tranfer a file in ascii mode ?
286. What is the syntax of scp command ?
287. How to automate ssh login to different server ?
288. What is remsh ?
289. You need to see the last fifteen lines of the files dog, cat and horse. Wha
t command should you use?
290. Who owns the data dictionary?
291. You routinely compress old log files. You now need to examine a log from tw
o months ago. In order to view its contents without first having to de
compress it, use the _________ utility.
292. You suspect that you have two commands with the same name as the command is
not producing the expected results. What command can you
use to determine the location of the command being run?
293. You locate a command in the /bin directory but do not know what it
does. What command can you use to determine its purpose."
294. You wish to create a link to the /data directory in bob's home directory
so you issue the command ln /data /home/bob/datalink but the
command fails. What option should you use in this command line to be
successful."
295. When you issue the command ls -l, the first character of the resulting
display represents the file's ___________."
296. What utility can you use to show a dynamic listing of running processes?
297. Where is standard output usually directed?
298. You wish to restore the file memo.ben which was backed up in the tarfile
MyBackup.tar. What command should you type?"
299. You need to view the contents of the tarfile called MyBackup.tar. What
command would you use?"
300. You want to create a compressed backup of the users' home directories.
What utility should you use?"
301. What daemon is responsible for tracking events on your system?
302. You have a file called phonenos that is almost 4,000 lines long. What text
filter can you use to split it into four pieces each 1,000 lines long?"
303. You would like to temporarily change your command line editor to be vi.
What command should you type to change it?"
304. What account is created when you install Linux?
305. What command should you use to check the number of files and disk
space used and each user's defined quotas?"
306. In order to run fsck on the root partition, the root partition must be
mounted as _____________"
307. In order to improve your system's security you decide to implement
shadow passwords. What command should you use?"
308. Bob Armstrong, who has a username of boba, calls to tell you he forgot
his password. What command should you use to reset his command?"
309. The top utility can be used to change the priority of a running process?
Another utility that can also be used to change priority is __________
_?"
310. What command should you type to see all the files with an extension of
'mem' listed in reverse alphabetical order in the /home/ben/memos
directory."
311. What file defines the levels of messages written to system log files?
312. What command is used to remove the password assigned to a group?
313. What command would you type to use the cpio to create a backup called
backup.cpio of all the users' home directories?"
314. What can you type at a command line to determine which shell you are
using?"
315. What type of local file server can you use to provide the distribution
installation materials to the new machine during a network installatio
n?"
316. When you create a new partition, you need to designate its size by
defining the starting and ending _____________."
317. What key combination can you press to suspend a running job and place
it in the background?"
318. The easiest, most basic form of backing up a file is to _____ it to another
location."
319. In order to prevent a user from logging in, you can add a(n) ________at
the beginning of the password field."
320. What utility can you use to automate rotation of logs?
321. In order to display the last five commands you have entered using the
history command, you would type ___________ ."
322. What command can you use to review boot messages?
323. What is the name and path of the main system log?
324. can you define the linux boot process?
325. what is initrd?
326. how you change run levels in linux
327. you want /dev/hda10 mounted whenever your system
boots what you will do"
328. you want bind to be run at boot time ,which command
you will use"
329. which utility will give you information about running
process at run time"
330. you want to know if nfs package is installed on your
system"
331. what is the difference between rpm , yum and RHEN
332. what is a proc directory
333. what is exit status in linux
334. What does nslookup do? Explain its two modes.
335. What is 'inode'?
336. What is use of sed command?
337. What is the difference between Telnet and SSH?
338. How to recover a deleted file in linux ?
339. What is the minimum number of partitions you need to install Linux?
340. How do you send a mail message to somebody?
341. What is the port no for FTP?
342. What is the port no for TFTP?
343. How to restrict users to their home directories?
344. How to restrict total number of users accessing FTP server?
345. I want to copy multiple files with out prompting for any info, how can I do
that
one?"
346. Some times Local users cannot log in. How to resolve this issue?
347. Write a command to find all of the files which have been accessed within
the last 30 days."
348. how to see unallocated hard disk space on linux
349. what is the command to make a process to run in the
background from foreground?"
350. double space a file(between lines)
351. triple space a file
352. undo double-spacing (assumes even-numbered lines are always blank)
353. insert a blank line above every line which matches "regex"
354. insert a blank line below every line which matches "regex"
355. insert 5 blank spaces at beginning of each line (make page offset)
356. delete BOTH leading and trailing whitespace from each line
357. substitute "foo" with "bar" ONLY for lines which contain "baz"
358. substitute "foo" with "bar" EXCEPT for lines which contain "baz"
359. change "scarlet" or "ruby" or "puce" to "red"
360. reverse each character on the line (emulates "rev")
361. if a line ends with a backslash, append the next line to it
362. dd commas to numeric strings, changing "1234567" to "1,234,567"
363. print section of file between two regular expressions
364. print all of file EXCEPT section between 2 regular expressions
365. delete all lines except duplicate lines
366. delete the last line of a file
367. delete the last 10 lines of a file
368. delete ALL blank lines from a file

You might also like