linux大作业代码,哪位高手大哥能帮我解决一下的我的linux大作业,里面题很难!

最近老师给我留了一个linux大作业,全英文的,而且里面的题我感到很难,各种题型都有,希望哪位高手大哥帮我解决,小弟这厢先谢谢了.下面就是这个作业.

Part1 Write out the correct commands according to the questions. (20x1)

Examples:

command

function description command

terminate terminal session and log out : exit

current directory : .

parent directory : ..

Send output to stdout and file : tee -a file

-append if the file exist

display manual page for command : man command

start interactive communication with user1 : write user1

display string : echo string

Get input for command from a file : cmd < file

Questions:

1. Create an alias called ll that executes the 'ls ?l' command.

2. Set a shell variable named VAR equal to the name “$(var)”. How do you see the contents of that variable?

3. Concatenate file1 and file2 into file3.

4. Remove the directory named is “Dir”, without any prompt information before removal.

5. How can you modify the permissions of the file “FILE”, so that your partners belonging to the same group can write the file ?

6. Display the files start with character “a” and contain the character 'b'?

7. Display the files start with “Foo” and end with three digits?

8. Delete a user which name is “Foo” and his HOME directory must be removed at the same time.

9. Find the file less than 10k in the current directory.

10. Print the lines number of file “Foo.txt” on the screen.

11. Display all the current users in your computer:

12. Assume a file contains more than 200 lines, display the lines from 101 to 150:

13. List only sub-directory names (not include file names) in current directory:

14. Redirect standard error to standard out :

15. Mount an usb disk to the directory /disk/usb:

16. Switch to user named "user1":

17. Create empty file or update timestamp on existing file:

18. Remove directories in interactive model:

19. Extract files from an archive test.tar.gz:

20. Display files in long format including permissions, ownership and size:

Part2 Write out appropriate commands according to the questions. (10x2)

1. Print the lines of the file good.txt to the file bad.txt exclude the starting 10 lines:

2. Now there are two files named good.txt and bad.txt in the sub-directory test, how can you exchange the names of the two files?

3. Mount Windows C disk (hda1) on the directory /winsys

4. Remove all files and directories recursively from the current directory.

5. Print all the processes with the user id that are running on the system with the full information.

6. How to sort the lines of a file named score according to the numeric sequence?

7. In your HOME directory, create an empty file names goodnews

Change the permission of this file to -rwxr-x--x

8. Check the disk usage of a directory named test, and only display the space size of the whole directory in byte.

9. Display yesterday’s date. Its output is in mm-dd-yy format.

10. How can you print the lines which contain the string I'm $lost in the last 100 lines of the file named badnews?

Part 3: (8+8+10+14)

1. Write a shell script to check the items of a designated directory which must be input from your terminal: if the item is a directory, delete it; else print the name of this item.

2. Write a shell script to display the odd lines of a given file.

3. Write a shell script using a directory as input, if the input is null, use current directory as input. The routine is used to find all files with suffix ".c" and ".cpp", and then compare each other to check out whether there exist two files having the same contents: if exist, print out the corresponding names of these files.

4. Write an ANSI C code. Use a Makefile to build it (including compile and link) into binary file.

The function of this binary file should be:

Read a serial of numbers from a given file, and then find the Top 5 maximum numbers.

You should give:

1. Makefile ( hint : one main file and one sub-routine file )

2. all C source code

3. the whole procedure of how you compile and link

--------------------next---------------------

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值