Im new to Unix Im using Puttyand Im confused Please answer a
\"I\'m new to Unix, I\'m using Putty......and I\'m confused, Please answer all the question*****
Hint: List of commands to read and use: cd, pwd, ls, echo, cat, od, quoting character and output redirection operator >
1)Change your working directory to your login directory.
2)A new file can be created in 4 different ways: (i) vi, (ii) touch, (iii) cp, and (iv) cat command. You have used touch and cp commands before. In this question, you will use cat command. In part II, you will use the vi text editor.
Create a short file using cat command and output redirection operator >. The content of the file must be typed from the keyboard, which is the default standard input (stdin) device. End the input to the file by typing Ctrl d keys at the same time.
Copy the command you have created to a new file.
5)Display the content of the file you have created using one od command with appropriate option(s) for each question below:
a.Display in character form
b.Display in hexadecimal form
c.Display in octal form
d.Display in both character and octal form
6)Using echo command, answer how the end of line (also called new line) character is displayed. NOTE: Shell gives special meaning to certain characters like *, ?, \\ and others. To make shell not to give special meaning to that character, you have to put a \\ in front of it. This is called quoting character. Therefore, you have to quote the character \\ by putting a \\ in front of it like \\\\ in order for the echo command to display it. Read more about it quoting character in your textbook. The end of line character is the representation of the “enter” key. The ASCII character code for the “enter” key is not a displayable single character like the letter ‘a’ for example. Hence, the system displays it differently.
7)Using echo command, answer: (i) the ASCII number code for new line (enter key) and (ii) for any one letter, display the letter and its ASCII number code. This can be done by comparing the output of the character form and the hexadecimal form above.
8)Search Internet for ASCII table and give the ASCII code for one character and one digital of your choice.
In your answer, specify whether the number is decimal or octal or hexadecimal or binary
Solution
1)cd command ia used to return to the login directory.
2) cat > sample.txt
After pressibg enter the cursor is not returned on the prompt. Instead the cursor is placed on to the next line allowing you to enter text into your file.
3) a) od -c file.txt
b) od -Ax -c file.txt
c) od -Ax -b file.txt
d) od -cb file.txt
6) echo $\'hello \ world\'
