professional documents
home
Upload
docsters
Upload
about me
contact me
user photo
Bhanu Chowdary
IT profeesional
Tata Conultancy Servic...
submit clear
Word Document

Unix Exercise center doc

IRM UNIX Exercise TATA Consultancy Services Page 1 of 2 UNIX Exercise Create a directory with your name under the default home directory for the user “trainee” Create a file “samplefile” in your home directory. Give the file above appropriate permissions if necessary. What do you think appropriate permissions should be? Turn the sticky bit on for the directory you have created Write a script which prompts for your name and then prints on stdout Hello “yourname” Today is “today’s date and time” Write a script to print the names of all the files in the current directory using for loop Create a file “-myfile” in your directory. Remove the above file Write 100 lines in a file each containing text “Unix is a wonderful world” Hint : Use a loop construct Write a shell script which will take 3 command line arguments and perform arithmetic The 3 args in the order are number number operation number is a normal integer operation could be sum, difference or product Hint (Use functions, $#, case, expr etc) Use tail to show the contents of dynamically growing file. Hint echo a message in a file using infinite loop . Also place a delay so that the file doesn’t grow very rapidly. Open one more session to run tail. Given a file named “/data/training/sam/inputfile”, do the following in separate scripts a. Print the count of all the blank lines b. Print all the lines having the string “new” in them c. Print all the lines having the last field greater than 20000 << The table at the end of this case study should help you >> IRM UNIX Exercise TATA Consultancy Services Page 2 of 2 Copy all the files and subdirectories under /data/training/sam to /data/training/yourgroupdirectory/. Hint: Use tar cvf to create the tar first from /data/training/sam and then untar the created tar under /data/training/yourgroupdirectory using tar xvf Use the find command in /data/training/sam (separate scripts) a. To print all the files having 0 bytes b. To print all the directories c. To print all the files having only read permissions for u,g and o. Use grep or related filter to print lines containing either Arizona or California (case insensitive search) in the file /data/training/sam/inputfile. Read the file /data/training/sam/inputfile line by line and print each line followed by a line saying “This was line n “ n=1,2,3.. In the file ( containing 50 lines “Unix is a wonder….”, replace all the occurrences of wonderful with gruesome ) Also add “This” at the start of each and every line Write a shell script which will write a warning to a file if any of the local filesystems exceeds a certain limit (70 %). The script would write the date and time as well as the name of the filesystem along with the current capacity in percentage. Make entries into the Cron table to run a script every 15 mins. The script should write ‘Hello World’ into a file. Write a shell function to demonstrate use of local variables within that function. Declare a variable outside the function and another within the function both with the same name. Use sed to replace all the occurrences of new with old in the file given below. These are the contents of /data/training/sam/inputfile FNAME LNAME STATE AGE AMOUNT mark horton california 23 40000 rafael perez new mexico 21 25000 melody moses alabama 22 10000 joe buselmeir new york 31 50000 tim noble arizona 41 12000
rate this doc
email this doc
embed this doc
add to folder
digg reddit stumble delicious
flag this doc
333
31
not rated
0
11/20/2007
English
Preview

Unix Exercise

bhanu1311 11/20/2007 | 291 | 35 | 0 | technology
Preview

Unix_lab exercise

honeytech 11/12/2007 | 172 | 13 | 0 |
Preview

unix lab2 exercise

honeytech 11/12/2007 | 158 | 14 | 0 |
Preview

UNIX

sanyam 6/1/2008 | 126 | 23 | 0 | educational
Preview

unix[2]

msaleem 11/14/2007 | 252 | 15 | 0 | technology
Preview

Unix Tutorial

Chad_Cataman 9/24/2008 | 61 | 5 | 0 | technology
Preview

Unix-Internet-Fundamentals-HOWTO

msaleem 11/14/2007 | 325 | 26 | 0 | technology
Preview

Outlook-to-Unix-Mailbox

msaleem 11/14/2007 | 335 | 8 | 0 | technology
Preview

UNIX_shell_script_standards_for_PowerCenter_7

bhanu1311 9/25/2007 | 760 | 70 | 1 | technology
Preview

Unix Cheet Sheet

dice1976 11/1/2007 | 904 | 129 | 0 | technology
Preview

Unix Command

ziaul 9/24/2007 | 551 | 80 | 0 | technology
Preview

Rootkits Unix Windows

orlandoleal 10/31/2007 | 968 | 13 | 0 | educational
Preview

inter_unix

msaleem 11/9/2007 | 147 | 7 | 0 | technology
Preview

unix_history

msaleem 11/9/2007 | 139 | 1 | 0 | technology
Preview

Unix Exercise

bhanu1311 11/20/2007 | 291 | 35 | 0 | technology
Preview

OCA

bhanu1311 11/6/2007 | 395 | 54 | 0 | educational
Preview

UNIX_shell_script_standards_for_PowerCenter_7

bhanu1311 9/25/2007 | 760 | 70 | 1 | technology
 
review this doc