materjalid:linux_basics
Erinevused
Siin näed erinevusi valitud versiooni ja hetkel kehtiva lehekülje vahel.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
materjalid:linux_basics [2019/04/25 10:07] – luciano | materjalid:linux_basics [2019/04/25 13:40] (Hetkel kehtiv) – luciano | ||
---|---|---|---|
Rida 1: | Rida 1: | ||
- | ====== Linux basics tasks 1 ====== | + | ====== Linux basics tasks ====== |
===== Intro ===== | ===== Intro ===== | ||
__First commands:__ | __First commands:__ | ||
Rida 29: | Rida 29: | ||
You can use the " | You can use the " | ||
- | |||
- | |||
- | ====== Linux basics tasks 2 ====== | ||
**touch** | **touch** | ||
Rida 95: | Rida 92: | ||
We go to the root folder, and inside etc, we look for all the folders that have the name " | We go to the root folder, and inside etc, we look for all the folders that have the name " | ||
- | ====== | + | Optional: |
+ | |||
+ | | ||
+ | The name for the script is script1.sh | ||
+ | |||
+ | ===== Redirection | ||
+ | |||
+ | **cat** | ||
+ | If you use the cat command, without specifying any site, you can write in it, it will return what you are saying. | ||
+ | |||
+ | (to exit you will have to press the ctrl + d) | ||
+ | |||
+ | ===== Redirecting the Output===== | ||
+ | |||
+ | We use the > symbol to redirect the output of a command. | ||
+ | |||
+ | Example: | ||
+ | cat > potato | ||
+ | (now you write what you want and when you finish press ctrl + d) | ||
+ | what you have written in the potato file will be printed | ||
+ | |||
+ | ===== Task ===== | ||
+ | |||
+ | Use the cat command to create a file (for example list1) where you keep the name of about 3 fruits. | ||
+ | |||
+ | ===== Appending to a file ===== | ||
+ | |||
+ | We use the symbol >> to add more elements to the file list without deleting the previous ones. | ||
+ | |||
+ | ===== Task ===== | ||
+ | |||
+ | Add 3 more fruits to list1 and create another file called list2 where you put another 4 fruits. | ||
+ | |||
+ | Now you will have to join all the fruits in a file called biglist only using the commands that you have learned. | ||
+ | |||
+ | ===== Redirecting the Input ===== | ||
+ | |||
+ | **sort** | ||
+ | |||
+ | The command sort alphabetically or numerically sorts a list. | ||
+ | |||
+ | ===== Task ===== | ||
+ | |||
+ | Use the sort command to sort alphabetically the fruits that you have put in biglist, once you have it, save the result in another file called sortbiglist | ||
+ | |||
+ | ===== Wildcards | ||
+ | |||
+ | The character * is called a wildcard, and will match against none or more character(s) in a file (or directory) name. For example, in your unixstuff directory, type | ||
+ | |||
+ | ls list* | ||
+ | |||
+ | This will list all files in the current directory starting with list.... | ||
+ | |||
+ | Try typing | ||
+ | |||
+ | ls *list | ||
+ | |||
+ | This will list all files in the current directory ending with ....list | ||
materjalid/linux_basics.1556176053.txt.gz · Viimati muutnud: 2019/04/25 10:07 persoon luciano