联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codehelp

您当前位置:首页 >> Python程序Python程序

日期:2021-04-02 08:35

Linux Assessment Version 2
RULES:
1. Closed book, closed notes, closed Internet, closed people.
2. You may use the man pages using the command man and you may use the command line to test
your solutions.
3. You may ask Dave (prof Toth) questions, but you may not communicate with anybody else
about the assessment until Wednesday.
4. You have 90 minutes beginning when you look at this file, and no more. Taking additional
times is CHEATING. Your 90 minutes includes recording your answer in a .txt file you create
with vim. Uploading the file to Moodle is NOT considered part of the 90 minutes.
5. Solutions are due by 11:50 PM Tuesday March 30.
You do NOT need to copy the questions. Just number your answers!
NOTE: When I ask for a single command to do something, I mean anything you can write one a
line before hitting enter. Thus, if you need to chain multiple commands together using one or
more pipes to accomplish what I’ve asked, that would count as a single command.
1. Write a single command to terminate all instances of processes named solitaire.
2. Write a single command to output the number of lines in the file data.txt. Assume that data.txt
is in the directory you are currently in.
3. Assume that you are in the directory /home/my-name/ which contains the directory stuff. The
directory stuff contains many files and subdirectories. Write a single command to copy all the
contents of the stuff directory to a new directory /home/my-name/stuff/.
4. What command could I use to find the MAC address of my WiFi adapter?
5. I have a file called junk.txt that contains thousands of lines. Write a single command that prints
just the first 7 lines of the file.
6. I have a program called notshortenough that will need to run for many days on a remote server.
However, the server will close my connection after just 24 hours of idle time, and I can’t be
there to babysit everything for days on end, so we know my connection will get closed. Write a
single command to start that process running on the remote server (assume that I am logged into
it at the moment and the program long is in my current directory) such that it will run until it
finishes and it runs in the background.
7. My username is bill. Write a command to send the file data.txt in my current directory, which is
some subdirectory of my home directory, to my home directory (/home/bill/) on the remote
server with IP address 10.55.1.28.
8. I have a file called lost.txt in some subdirectory of my home directory /home/csc280-student/,
but I have no idea where it is. Write a single command that will locate the file and print out
where it is for me. Make no assumptions about where I currently am in the file system.
9. You own the file gold.txt in your current directory. Write a single command to make the owner
of the file dave.
10. Write a single command to “display the status of jobs that were started in the current shell
environment.” The command you give me as an answer should display “the status of all
stopped jobs, running background jobs and all jobs whose status has changed and have not been
reported by the shell.”
11. I’m currently in a directory that contains another directory called programs. Write a single
command to create a tar file called lotsa.tar in my current directory. The lotsa.tar file should
contain the programs subdirectory and everything in it.
12. I’m in the directory /home/staff/ which contains the directory housing. Write a single command
to list ALL the files and folders inside the housing directory including hidden ones (which start
with .), such that the listing shows the file permissions for each item listed and in “humanreadable”
format.
13. Write a single command to execute the command numbered 72 in my history.
14. Write a single command to print the lines of the file flights.txt that contain the string jk and only
those lines.
15. I may have multiple copies of the command pwd on my computer. Write a single command that
tells me the path of the version that will be run if I just type pwd without specifying the path to
it.
16. What command tells me where I am in the file system?
17. Write a single command that deletes all the files in my current directory whose names begin
with xyz and end with .doc.
18. I want to establish a remote terminal connection to the server with IP address 10.14.1.87. My
username on that server is sally. Write me a single command to connect to the server.
19. What does the up arrow do in the terminal window?
20. What command shows the running processes, automatically updating and refreshing the screen
by default until you hit q to quit?
21. I’m currently in a directory (/home/csc280-prof/hw/) that contains another directory called
programs. Write a single command to move the programs directory and everything inside it up
to /home/csc280-prof/.
22. I’m currently in the directory /home/bill/. Write a command to change my location to /usr/bin
using an absolute path.
23. I’m currently in the directory /home/bill/. Write a command to change my location to /usr/bin
using an relative path.
24. There’s a file data.txt on my webserver that you should download for class, and you know the
webserver’s IP address is 8.7.1.13, but you don’t have a login username/password for that
server. Write a single command that will download the file to your current directory.
25. If a command is going to give me lots more output than will fit on the screen, what are two
commands would I be able to pipe it through to allow me to scroll through the output one page
at a time?
26. I’m in /home/csc280-student/ which is currently empty. I’d like to create a directory
linux/badges/attempt1/ inside of /home/csc280-student/ with a single command. What’s that
command? HINT: you’ll need to use the man pages to figure out how to do this, as we
intentionally didn’t cover it.
27. What is the shortcut key sequence to clear the terminal window?
28. Will the command rmdir foo delete the non-empty directory foo that’s in my current directory?
29. Write a single command that lists all (and only) my previous commands that contained the word
goat.
30. I’m currently in the directory /home/csc280-student/ which contains a directory called stuff. The
directory stuff contains a directory called junk, which contains lots of files. Write a single
command to delete the directory junk and all its contents.
31. I have a just issued the command ./blah and the process blah is running. Then I suspended
it using control-z. What command will resume it running in the background?
32. Tell me a single command to stop the process circled in red in the image below. Note there are
multiple processes with the same name and I only want to stop the circled one.
33. Give a single command to change the permissions of the file temp.txt to be readable by
everybody, writable by the owner of the file, and executable for only the owner of the file and
the group for the file.
34. I have just started a process in the foreground and it’s spewing forth lots of output and I want to
stop it so I can restart it and direct all the output to a logfile instead. How do I stop it?
35. I have a file called data.txt that contains thousands of lines. Write a single command that prints
just the last 2 lines of the file.
36. I have a file temp.txt with one number per line, where the numbers are not in any particular
order. I want to create a new file ordered.txt with the numbers printed out one per line, where
the lines are ordered from high to low.
37. I want to print out the numbers from temp.txt in the previous question such that I only get a
single copy of any numbers in the file. So if there are 17 copies of the number 9 in the file, in
my output, I only want to see the number 9 once. Give me a single command to do it.
38. I want to edit a file in my current directory with vim. The file is named
abcdefghijklmnopqrstuvwxyz.txt. The only other files in that directory are abc.txt and def.txt.
Explain how I could do that (without renaming anything), without typing the whole name of the
file, and without using the wildcard character *.
39. I have a file people.txt in my current directory. The file has one person per line with the
person’s first_name:last_name:age like this
John:Doe:49
Suzy:Queue:42
Ima:Goofball:75
Write me a single command to print out all the last names in the file.
40. Given this output from the diff command diff abc.txt xyz.txt, tell precisely how the
files differ.
1c1
< Suzy Queue 123 Abstract St
---
> Suzy Stack 123 Abstract St
2a3
> Ivana Pizza 22222 Pineapple Rd
41. Give a single command using ps that lists all the running processes and lists their full
information.
42. Explain how to use fg to resume a suspended job that is NOT the one most recently suspended
or run as a background job.
43. Give me a single command to zip the subdirectory foo of my current directory into an encrypted
file called enc_foo.zip.
44. Use the table below to help answer this question. Write a single command to print the lines of
the file junk.txt that start with x and end with a. Hint: you’ll want a regular expression as part
of the solution.

版权所有:留学生编程辅导网 2020,All Rights Reserved 联系方式:QQ:99515681 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。