Project #20141 - Linux Homework

Simple Linux Commands.



1.What are the two Modes of VI?




2.type vi hello





3.Press a or i and Type the following information:



Are you





4.Save and exit the editor.  What command did you use to save and exit?



5.type:  cat hello   - What is the output?






6.Run the ls command.  Do you see the file hello?




7.Now run the ls -l command.  What are the permissions on the file hello?




8.Type the command, rm hello




9.Now type the ls command.  Is the file hello still there?  If not, why?




10.Type vi






11.Enter this text:

I really

Enjoy this

UNIX class

And the labs


12.Save the file calling it class, WITHOUT exiting VI.  What vi command do you use for this?




13.Now move the cursor over the y in really, and pres the letter x.  What happens?




14.Now put the letter y back in its proper place.  Tell me TWO ways to do this(what commands).






15.Put the cursor on the letter A in And.  Now type dd.  What did it do?



16.Exit the file



17.Type vi



18.Type in the text below

The Professor 

Is pretty cool




19.Now use this command, :w >> class



20.Now type :q! 



22.type cat class



21.What is the difference between the Visual Mode Command O, and the Visual Mode Command o?






22.What is the difference between the Visual Mode Command a, and the Visual Mode Command I?




23.What does the command, :q! do?




24.Use VI to Type in the file below 

New, what do you own the world?

How do you own disorder, disorder,

Now, somewhere between the sacred silence,

Sacred silence and sleep,

Somewhere, between the sacred silence and sleep,

disorder, disorder, disorder.


25.Save it and name it toxicity



26.Using VI go back into the file and use the command mode command: /disorder



27.What happened?



28.Use the re-do command to repeat that search (If you are not sure of the re-do search command use the text book to find it).


30.When finished with the search command type:  :nohlsearch 

This should turn off the highlights. Part 1: Creating a new file in vi

1.Create a directory called data if you do not already have one. 

2.Change directories to the data directory. 

3.To start the vi editor, type: $ vi filename

4.Use a new filename to create a new file. 

a.For the new file, there will be tildes (~) on each line and the 

status bar at the bottom will indicate a new file. 

b.opens in the command mode 

c.type i to put vi in the text insert mode the ESC key to return to the command mode 

e.type i and type in four lines of text. 

f.Press ESC key and then type :wq followed by the return key to save your file and quit vi 

g.Back in the UNIX command mode, select the cat command to view your new file contents. 

5.Exit out of vi

II.Part 2: vi commands

1.Open vi with the file created in part 1. 

2.For an existing file, it will be opened displaying its contents.

Unused lines are preceded by tilde (~) 

3.Type j at the command prompt to move the cursor down one line 

4.Type k at the command prompt to move the cursor up one line 

5.Type 2j at the command prompt to move the cursor down two lines 

6.Play with the other cursor commands to get a feel for manipulating the cursor from the command line 

7.You may find, particularly for smaller files, that it is easier to use the arrow keys in the text input mode to manage cursor movement 

8.In larger files, combining cursor commands with change commands can make it easier to handle the changes. 

9.Set the cursor in the upper left corner. If not still there, place vi in the command mode. 

10.Type cw which is the change word command. This removes the word at the current cursor position 

and will place you in the text insert mode to allow you to change the word there. 

Do it and press ESC to get back to the command mode. 

11.Repeat the same thing for the cc change line command. 

12.Type r B to change the first character at the current cursor position to B. 

This will NOT exit the command mode! 

13.Move the cursor to the start of the first line. 

14.Move the cursor to the center of the first line using 20l command. That is 20 "Lowercase L" NOT 20 "one" 

15.Type c$ to allow you to change the characters from the current cursor position to the end of the line. 

16.Press ESC key to return to the command mode. 

17.Move the cursor to beginning of a word in line 2. 

18.Type dw to delete that word. 

19.Type u to undo the last command, restoring the deleted word. 

20.Type dd to delete the entire line 

21.Type u to undo the delete and restore the line. 

22.Place the cursor in the middle of the second line at the middle of a word. 

23.Type xp to transpose the two characters at the cursor position. 

24.Move the cursor left one character. 

25.Type xp to transpose them back

III.Part 3: Cursor Movement

1.Copy the file, vitext from /home/global to your home directory

2.Open vitext in the vi editor. 

3.In the command mode, use each of these commands and record the result on the table below: 


CommandEffects from executing the command entered here   











IV.Part 4: Change Commands

1.Type the command :set number to set line numbers in your vitext file. 

2.Place the cursor at the first character in line 1. 

3.Type cw and type the new word Here in place of the first word. 

4.Return to the command mode (ESC). 

5.Type 4j to move down four lines. 

6.Type the command cc and replace the current line with: by beverages, I mean the non-alcoholic kind.

7.Return to the command mode and move the cursor to the third word in line 6.

What command did you use to move the cursor to the asked for position? 

8.Type r t. What did this command do? 

9.Type ~. What did this command do? 

10.Type the following sequence of commands and record what each did(ESC after each): 


CommandEffects from executing the command entered here   








Lab 7


Follow the commands below and record output or tell what is happening.





2.echo $x






4.echo $x



5.z   =   earlybird



6.echo The $ra are good






8.echo The $ra are good






10.readonly nhl






12.echo $nhl



13.export nhl


15.echo $nhl is cool


16.echo $x



17.Why did the command above not work?






19.echo $x    (did the command work now, if yes, why?)


20.Type man expr     Read about the expr command before trying the commands below


21.expr 2 + 2


22.expr 3 – 1


23.expr 4 \* 2


24.expr 10 / 2


25.expr 5 \* 2


26.sum=`expr 1 + 1`


27.echo $sum


28.diff=`expr 3 – 1`


29.echo $diff`expr 4 / 2`


31.echo $prod


32. quo=`expr 5 / 3`


33.echo $quo




34.Store the number 10 as e


35.Store the number 5 as f


36.Add the variables e and f


37.Multiply the variables e and f


38.Multiply the variables e and f


39.Divide the variables e and f


40.Give the following output:   The sum of e and f is:  15 (make sure you allow the computer to do the math and print it out here).  Do the same for diff, prod and quotient.



41. let x=6+2


42. echo $x


43.let x=6/2


44.echo $x


45. let x=6*2


46.echo $x


47.let x=6-2


48.echo $x



49.Type the following in sequence:

let x=1

let y=5

let z=10

let TOTAL=x+y+z

echo $TOTAL



50. echo “The sum of $x + $y +$z = `expr $x + $y + $z`”




51.Explain what the following functions are:





































Subject Computer
Due By (Pacific Time) 12/20/2013 12:00 am
Report DMCA

Chat Now!

out of 1971 reviews

Chat Now!

out of 766 reviews

Chat Now!

out of 1164 reviews

Chat Now!

out of 721 reviews

Chat Now!

out of 1600 reviews

Chat Now!

out of 770 reviews

Chat Now!

out of 766 reviews

Chat Now!

out of 680 reviews
All Rights Reserved. Copyright by - Copyright Policy