3

Click here to load reader

Unix1

Embed Size (px)

DESCRIPTION

u

Citation preview

Page 1: Unix1

1. How do you change the access permission (add group read/write) to all the files inthe current directory containing the word “cali” in their names?a. chmod g+rw *cali*b. setperm r+w *cali*c. chmod 0060 *cali*

2. What is the command to find the differences in the lines containing “1999” betweenthe files orig.txt and copy.txt, and add the result to file result.1999?a. diff orig.txt –d copy.txt | grep 1999 > result.1999b. diff orig.txt copy.txt | grep 1999 >> result.1999 c. grep 1999 *.txt >> result.199

3. Create a new file “new.txt” that is a concatenation of “file1.txt” and “file2.txt”a. cat file1.txt file2.txt > new.txtb. make new.txt=file1.txt+file2.txtc. tail file.txt | head file2.txt > new.txt

4. What is the command to search all files in your current directory for the word“apple”?a. grep apple*b. find apple –allc. lookup appled. where apple

5. How do you print the first 15 lines of all files ending by “.txt”?a. print 15 .txtb. cat *.txt –length=15c. head -15 *.txt

6. Make a copy of file “upper” in the directory two levels up.a. jump -2 upperb. cp upper ../..c. cp upper -2/

7. Count the files you own in all your directories.a. ls –IR | grep myusername | wc –lb. ls –a | cnt*c. ls –n ~myusername

8. Change the current directory to /usr/local/bina. mv /usr/local/bin.b. cd /usr/local/bin.c. Setdir /usr/local/bin.

9. Which command is used to change your password?b. passc. passwdd. pwd

10. Which command will display a calendar?a. calb. dis calc. view cald. calendar

Page 2: Unix1

3. Which command can be used to display the contents of a file on the screen?a. lsb. grepc. dogd. cat

4. Which command allows you to determine if a host is connected to the internet?a. ls-lab. cmdc. pwdd. ping

5. Which command would you use to create a sub-directory in your home directory?a. mkdirb. dirc. cpd. rm

6. The wc command will report all misspelled words.a. Trueb. False

7. To change access modes on files you can use the chmod command.a. Trueb. False

8. To change the owner of the file you could use the chowned command.a. Trueb. False

9. head is the command that writes the first 10 lines of a file to the screen.

10. The pwd_ command will display the absolute pathname for the directory thatyou are working in.