Jump to content

Will someone help how to do these tasks in linux?

I know all the commands, but I don't know how to apply them to these tasks.

 

I will explain with an example: I know a cat comedy that displays the contents of a file.

In task 5, in file 3 write / etc / cpuinfo

This needs to be done with the cat command and redirected to file 3. cat / etc / cpuinfo >> file3.txt

 

Before that, I didn't know that this command could do this job even though I knew that the cat command prints the contents of a file.

On the Internet, they explain what individual commands are for, but they do not explain how to do this type of task, so I do not know

 

Could someone in the pictures show one by one how to do these tasks, it would help me in the future with linux. Because we will have a linux server at school, and to know what to do in linux server, you must first be able to do these tasks, where is work with files, so I want me to know how to do each of these tasks. Thank you in advance.

 

 

 

1 Create the Tutorials directory and Copy in the Desktop directory
2 Create 5 files in the exercise directory (names file1.txt …….)
3 Save file 1 with the top command
4 Save file2 with the / etc / shadow file
5 File3 save the file / proc / cpuinfo
6 File 4 save / dev / sda
7 Save in file 5
- information on processes from 1-50
- linux user info
- information about the processor model (model name)
- the first five lines from the file / dev / sda
- the last 3 lines from the file / proc / cpuinfo
8. Compare file1 with file2 using color diff
9. Display the letters a in file 3
10.Sort and number the text in the file 4
11. Display the number of words in the file 1
12. Display the number of characters in the file 2
13. Display the number of bytes in the file 3
14.Create and save the file6 with the calendar for May 2020 display the field 5
15.Create a file7 save with the commands free uname ps ifconfig groups
- use vim to edit the file7
- enter the name of the command in the headers, write a short description of the command
16. Create and save file8 with lshw command
- create file 9 and save
a) information about the processor
b) information about the motherboard
c) ram information
d) support any information with a commentary using echo (Information about)
17. Copy file3, file5, file7 to copied directory
18. Transfer file 9 to file1 in the exercise directory
19. Go to the root (/) directory and copy file 9 to the user's home directory
20.Display the files of the linux directory (it is the directory where the user information was saved) after the decimal point and save in the file 10
21. Display the contents of directory information about the Desktop directory
22. Display the contents of the directory (same directory as user information) along with hidden files and save to file 10
23 Display the contents of the desktop with a decimal point and save to a file 10
24. Display only the / etc directory files and save to file 10
25.Display content with information about exercise directory groups only

Link to comment
Share on other sites

Link to post
Share on other sites

No offense, but this question seems like a homework someone is too lazy to do. You got the knowledge already - cat, bash redirection operators, diff, head, tail, sort etc. Just try them out in a virtual machine or something.

 

In addition, some of the tasks don't make a lot of sense, such as "File 4 save / dev / sda" - this makes no sense.

HAL9000: AMD Ryzen 9 3900x | Noctua NH-D15 chromax.black | 32 GB Corsair Vengeance LPX DDR4 3200 MHz | Asus X570 Prime Pro | ASUS TUF 3080 Ti | 1 TB Samsung 970 Evo Plus + 1 TB Crucial MX500 + 6 TB WD RED | Corsair HX1000 | be quiet Pure Base 500DX | LG 34UM95 34" 3440x1440

Hydrogen server: Intel i3-10100 | Cryorig M9i | 64 GB Crucial Ballistix 3200MHz DDR4 | Gigabyte B560M-DS3H | 33 TB of storage | Fractal Design Define R5 | unRAID 6.9.2

Carbon server: Fujitsu PRIMERGY RX100 S7p | Xeon E3-1230 v2 | 16 GB DDR3 ECC | 60 GB Corsair SSD & 250 GB Samsung 850 Pro | Intel i340-T4 | ESXi 6.5.1

Big Mac cluster: 2x Raspberry Pi 2 Model B | 1x Raspberry Pi 3 Model B | 2x Raspberry Pi 3 Model B+

Link to comment
Share on other sites

Link to post
Share on other sites

If you were only asking about a couple, that would be one thing, but this just looks like you copy-pasted your homework and wanted someone else to do it for you. Besides, to learn BASH and how to make a script, the best way is to just actually do it. Spin up a VM and try to do these yourself. Seeing someone write 

cat file1.txt | wc -w

doesn't mean you'll know  what they did or why that specifically works. Just remember that " >> " outputs the contents of the command to a file (useful if you need to add a line to a file, done with "echo 'Hello World!' >> test.txt"), " | " (referred to as a pipe) sends the output of one command as the input for another (useful for utilities like grep, wc, etc.), and " && " performs commands right after each other (i.e. "sudo apt update && sudo apt upgrade -y")

Link to comment
Share on other sites

Link to post
Share on other sites

Tbh its against the rules to ask for your homework to be done for you.

However if you have problems with a certain aspect you can ask.

 

But seriously do you want to know this stuff or just be a scam-artist with the diploma? If the first, study and learn. 🙂

When i ask for more specs, don't expect me to know the answer!
I'm just helping YOU to help YOURSELF!
(The more info you give the easier it is for others to help you out!)

Not willing to capitulate to the ignorance of the masses!

Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, jj9987 said:

No offense, but this question seems like a homework someone is too lazy to do. You got the knowledge already - cat, bash redirection operators, diff, head, tail, sort etc. Just try them out in a virtual machine or something.

 

In addition, some of the tasks don't make a lot of sense, such as "File 4 save / dev / sda" - this makes no sense.

This is not homework.

Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, RONOTHAN## said:

If you were only asking about a couple, that would be one thing, but this just looks like you copy-pasted your homework and wanted someone else to do it for you. Besides, to learn BASH and how to make a script, the best way is to just actually do it. Spin up a VM and try to do these yourself. Seeing someone write 

cat file1.txt | wc -w

doesn't mean you'll know  what they did or why that specifically works. Just remember that " >> " outputs the contents of the command to a file (useful if you need to add a line to a file, done with "echo 'Hello World!' >> test.txt"), " | " (referred to as a pipe) sends the output of one command as the input for another (useful for utilities like grep, wc, etc.), and " && " performs commands right after each other (i.e. "sudo apt update && sudo apt upgrade -y")

This is not homework. But okay, I will do tasks that I know how to do if I don't know, I'll ask.

 

Link to comment
Share on other sites

Link to post
Share on other sites

57 minutes ago, HanZie82 said:

Tbh its against the rules to ask for your homework to be done for you.

However if you have problems with a certain aspect you can ask.

 

But seriously do you want to know this stuff or just be a scam-artist with the diploma? If the first, study and learn. 🙂

This is not homework.
I want to know how to do it.
Besides, you can't get a diploma for doing homework at home, you have to pass an exam at school and then you get a diploma.

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, GamerGry123 said:

This is not homework.
I want to know how to do it.
Besides, you can't get a diploma for doing homework at home, you have to pass an exam at school and then you get a diploma.

Sorry for misunderstanding the question then.
But as you can see, it really looked like it. And sometimes there are unscrupulous people about.

(It looks like you just copied all the questions of the sheet straight over to the post.) Altho we cant know for sure, we have to go by what we see.

Sorry you got flagged as one of those lazy buggers. 😄

Also perfectly willing to share any info i have, but im sure there are some of those questions you can figure out yourself.

For the rest, ask us.

(Rather them *points at rest of the forum* They know the linuxes. 😄 )

When i ask for more specs, don't expect me to know the answer!
I'm just helping YOU to help YOURSELF!
(The more info you give the easier it is for others to help you out!)

Not willing to capitulate to the ignorance of the masses!

Link to comment
Share on other sites

Link to post
Share on other sites

3 hours ago, HanZie82 said:

Sorry for misunderstanding the question then.
But as you can see, it really looked like it. And sometimes there are unscrupulous people about.

(It looks like you just copied all the questions of the sheet straight over to the post.) Altho we cant know for sure, we have to go by what we see.

Sorry you got flagged as one of those lazy buggers. 😄

Also perfectly willing to share any info i have, but im sure there are some of those questions you can figure out yourself.

For the rest, ask us.

(Rather them *points at rest of the forum* They know the linuxes. 😄 )

Okay, I just started doing these tasks but I'm not sure if I'm doing them right.

 

In task 6, you need to save / dev / sda to file4

 

In the terminal it shows that it goes and the process does not end, and in the case of other files it was shown that it was saved, for example / proc / cpuinfo, it was visible that information about the processor was written in the text file and in the terminal it was visible that the process was already finished.

 

See the photos for what it looks like.

 

 

5.png

6.png

Link to comment
Share on other sites

Link to post
Share on other sites

3 hours ago, HanZie82 said:

Sorry for misunderstanding the question then.
But as you can see, it really looked like it. And sometimes there are unscrupulous people about.

(It looks like you just copied all the questions of the sheet straight over to the post.) Altho we cant know for sure, we have to go by what we see.

Sorry you got flagged as one of those lazy buggers. 😄

Also perfectly willing to share any info i have, but im sure there are some of those questions you can figure out yourself.

For the rest, ask us.

(Rather them *points at rest of the forum* They know the linuxes. 😄 )

Still how to save information about processes 1 to 50?

 

I know that processes are displayed in the terminal with the ps command, but several processes are shown to me, and if I type ps all, more processes are shown, but it is not 50.

 

The htop program shows processes in the terminal, but how to mark to save these processes from 1 to 50?

Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, GamerGry123 said:

Still how to save information about processes 1 to 50?

 

What do you mean, exactly?

 

Does 

ps -a | head -n 50

give you something closer to what you want?

Link to comment
Share on other sites

Link to post
Share on other sites

5 hours ago, HanZie82 said:

Sorry for misunderstanding the question then.
But as you can see, it really looked like it. And sometimes there are unscrupulous people about.

(It looks like you just copied all the questions of the sheet straight over to the post.) Altho we cant know for sure, we have to go by what we see.

Sorry you got flagged as one of those lazy buggers. 😄

Also perfectly willing to share any info i have, but im sure there are some of those questions you can figure out yourself.

For the rest, ask us.

(Rather them *points at rest of the forum* They know the linuxes. 😄 )

I did all the tasks I knew how to do.

 

Could you check if I did them right?

 

I didn't know how to do 5 tasks of all those marked in red and 3 of them I knew a bit how to do but not finish which are marked in green.

 

I am sending a link to the google drive with photos of how I was doing these tasks because only 20Mb can be sent here.

 

https://drive.google.com/drive/folders/17yJCiked80Gylgulu0EWBwd6pgZBFuyK?usp=sharing

linux.docx

Link to comment
Share on other sites

Link to post
Share on other sites

3 minutes ago, flindeberg said:

What do you mean, exactly?

 

Does 

ps -a | head -n 50

give you something closer to what you want?

the head -n 50 command will output the first 50 lines from a text file.

 

And I want to display 50 process lines

 

I have an idea how to do it, first save all processes with the command ps aux and then from this text file where I saved all processes with the command head -n 50 and save in a new file or change the same.

 

It would look like this:

 

ps aux > file1.txt

head -n 50 file1.txt > file1.txt

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, GamerGry123 said:

the head -n 50 command will output the first 50 lines from a text file.

I think you need to rethink a bit of how pipes work in Linux. Have you read up on stdin, stdout and stderr? (for example https://en.wikipedia.org/wiki/Standard_streams)

 

Linux makes no fundamental difference between a text file, any other file, a device (like your mouse, /dev/null or the interface to your drive), stdin, etc. In general terms, the text file is the special case. Rather think in terms of stdin, stdout, stderr etc, where files are just special cases. 

 

If you ever write to a file just to read from it again you are doing it wrong 🙂

 

Try what I gave you and modify it until you are happy. 

Link to comment
Share on other sites

Link to post
Share on other sites

13 hours ago, flindeberg said:

I think you need to rethink a bit of how pipes work in Linux. Have you read up on stdin, stdout and stderr? (for example https://en.wikipedia.org/wiki/Standard_streams)

 

Linux makes no fundamental difference between a text file, any other file, a device (like your mouse, /dev/null or the interface to your drive), stdin, etc. In general terms, the text file is the special case. Rather think in terms of stdin, stdout, stderr etc, where files are just special cases. 

 

If you ever write to a file just to read from it again you are doing it wrong 🙂

 

Try what I gave you and modify it until you are happy. 

What you sent me I don't understand.

 

In school, we learned so that we first save information to a file and then we can separate information from the same file that we need and redirect to another or overwrite the same file.

Link to comment
Share on other sites

Link to post
Share on other sites

9 hours ago, GamerGry123 said:

What you sent me I don't understand.

Just copy it and try it 🙂 

10 hours ago, GamerGry123 said:

In school, we learned so that we first save information to a file and then we can separate information from the same file that we need and redirect to another or overwrite the same file.

That is fundamentally flawed on so many different layers. Do they teach you how to use pipes? (i.e. '|')

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×