LINUX 1.Enter the following commands: a. echo “April Showers, May Flowers” > May
ID: 3827684 • Letter: L
Question
LINUX
1.Enter the following commands:
a. echo “April Showers, May Flowers” > May2015; cal 5 2015 >> May2015
b. more May2015
2. Enter the following commands:
a. (echo “April Showers, May Flowers”; cal 5 2015) > May2015
b. more May2015
3. Enter the following commands:
a. cp file1 tempfile && echo “Copy successful”
b. cp nofile tempfile || echo “Copy failed”
4. Enter the following commands:
a. alias lndir=’ls –la’ | more
b. lndir
c. unalias lndir
5. Determine the following:
a. Your primary prompt
b. Your login shell
c. Your home directory
Explanation / Answer
Please find the result of given commands:
1.Enter the following commands:
a. echo “April Showers, May Flowers” > May2015; cal 5 2015 >> May2015
b. more May2015
Result and Explanation:
echo “April Showers, May Flowers” > May2015; (This will print the statement “April Showers, May Flowers” to the file named May2015)
cal 5 2015 >> May2015 (This will append the calender for the month 5 of 2015 to the file May2015, which mean May of 2015)
more May2015 (This will print the contents of file May2015)
Thus output gives :
April Showers, May Flowers
May 2015
Su Mo Tu We Th Fr Sa
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
--------------------------------------------------------
2. Enter the following commands:
a. (echo “April Showers, May Flowers”; cal 5 2015) > May2015
b. more May2015
Result and Explanation:
(echo “April Showers, May Flowers”; cal 5 2015) > May2015
This will also print the statement "April Showers, May Flowers" and calender of may 2015 combined to the file May2015
Thus output will be:
“April Showers, May Flowers”
May 2015
Su Mo Tu We Th Fr Sa
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
--------------------------------------------------
3. Enter the following commands:
a. cp file1 tempfile && echo “Copy successful”
b. cp nofile tempfile || echo “Copy failed”
cp file1 tempfile && echo “Copy successful” (This will copy the file file1 as tempfile and if it was successfull, means if the file file1 was present and copied as tempfile Copy successful message will be printed on screen)
cp nofile tempfile || echo “Copy failed” (This will copy the file nofile1 as tempfile and if it was not successfull, means if the file nofile1 was not present then Copy failed message will be printed on screen)
---------------------------------------------------
4. Enter the following commands:
a. alias lndir=’ls –la’ | more (This will create an alias for the command "’ls –la’ | more")
b. lndir (this will execute the newly created alias, ie, it will execute ’ls –la’ | more)
c. unalias lndir (This will remove the created alias Indir)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.