[Startup Engineering] HW3 Quiz: Linux, Command Line, Dev Environment, Git(Answer)

1. What tool is most appropriate for changing all instances of foo to bar in a file?

sed #Quick find/replace within a file. 찾아바꾸기.

2. What is the result of running:    yes | nl | head | tail -n +10 | awk ‘{print $1}’


3. Which of the following tools is most appropriate for debugging a linking issue? (Note: for this question, you should Google each of these commands and figure out which one applies; the rest of the questions will only cover commands from the lecture, but Googling commands is a very frequent exercise.)

ldd #prints the shared libraries required by each program or shared library specified on the command line. Learn more…

4.Which of the following command/flag combinations enable the use of multiple processors?

xarg -p Learn more…

xarg #build and execute command lines from standard input

[option] -p #Prompt the user about whether to run each command line and read a line from the terminal. Only run the command line if the response starts with `y’ or `Y’. Implies -t.

5.Which of the following commands will list all python files containing the string asdf under the current directory?

find -type f -name ‘*py’ -print0 | xargs -0 grep -l -i ‘asdf’

6.You have a five million row table in tab-delimited text format named foo.txt. Which of the following commands would be useful for finding the sum of the values in the fifth column, taken over all rows which have the phrase transcription factor as the entry in their third column?

awk #Useful scripting language for working with tab-delimited text. Very fast for such purposes, intermediate size tool.

7. The next few questions refer to the genomic data set NC_007779.ptt.You can retrieve it via wget https://spark-public.s3.amazonaws.com/startup/data/NC_007779.ptt 
What does the following command do?
curl -s https://spark-public.s3.amazonaws.com/startup/data/NC_007779.ptt | wc -l

Counts the number of lines in the ptt file #wc (=word count) -l(=line)

8. Which of the following commands counts the number of rows in NC_007779.ptt that have the word ‘protein’ in them?(multiple choice)

grep protein NC_007779.ptt | wc -l
cat NC_007779.ptt | grep protein | wc -l

9. Which of the following commands prints the 123rd line of NC_007779.ptt?

cat NC_007779.ptt | head -123 | tail -l
awk ‘NR==123’ NC_007779.ptt
sed -n ‘123p’ NC_007779.ptt

10. Which of the following prints the number of bytes in NC_007779.ptt?

echo `wc -c NC_007779.ptt` #???? I don’t know why it is answer.

>> wc -w NC_007779.ptt

스크린샷 2013-07-09 오전 1.57.47

스크린샷 2013-07-09 오전 1.57.20

echo는 그냥 입력한대로 출력해주는 명령어이고, wc는 word count. 근데 정답이 아니라길래 오답을 써서 점수는 받았으나, 왜 이것이 정답으로 되어 있는지 전혀 이해가 안가는 중.. -_ –  역시나 포럼에서도 난리가 난 듯. 정답을 입력했는데 왜 오답이냐는 둥~ 나도 쓰고싶지만 이미 많으니까 굳이 안써도 되겠지..;;

11. Which command would you use to create a symbolic link to a file?

ln -s

12. Which git command syncs the remote repository with all the changes you’ve made in your local git repository?

git push

13. For your new startup, you plan to commit your git repository to two different locations. (eg. github and heroku)
Say you have already pushed your local repository to github and would now like to push it heroku as well.
Which of the following git commands would you use to accomplish this?

git remote add (0)

14. What is the SHA-1 hash of the first commit of the git repository https://github.com/startup-class/setup.git? (Hint: You might find git log useful.)

우선 패스… 강의를 더 찾아듣고 다시 푸는 것으로 하겠음;;;

15. Why is it good practice to have a setup.git and dotfiles.git?

It makes it easy to rebuild a remote environment just like the one you’ve been using, and eases deployment.


헤헤 ~ 여백을 이용한 깨알홍보>_< (어째서?)

앱 & 서비스 기획자입니다. 잘하고 싶어요.

Sliding Sidebar