See on dokumendi vana versioon!
Linux basics tasks 1
Intro
First commands:
ls (list) Show the files that are in the folder where you are.
mkdir (make directory) Create a folder within the file that we are.
cd (change directory) It can make you move between directories, so you can move around the entire linux file system. To move, you just have to put the directory where you want to go to enter, to exit, we will have to put „..“ after cd.
Example:
cd "directory" cd ".."
ls -a There are hidden files so that not everyone is within reach of them, but we are not all the world, so with this command, it shows ALL the files that are inside the directory that we want to see.
pwd (print working directory) It allows you to see the entire address of the directory that you are.
Task
Create on the desktop a folder called „Potato_1“ inside it we will create another folder called „Potato_2“ and inside it, „Potato_3“
You can use the „pwd“ or „ls -a“ command to see the address of the directory.
Linux basics tasks 2
touch Create a file
cp (copy) It allows copying files and directories from one site to another.
Example:
cp "origen" "destination"
mv (move) It allows moving files and directories from one site to another.
Example:
mv "origen" "destination"
rm (remove), rmdir (remove directory) You can delete files or directories.
Example:
rm "file" rm "carpet"
clear (clear screen) With this command you can clean the terminal window.
cat (concatenate) You can see what is inside a file, so you can see the content.
less The command less writes the contents of a file onto the screen a page at a time.
head The head command writes the first ten lines of a file to the screen.
tail The head command writes the first ten lines of a file to the screen.
Examples:
tail -n 20 "file" (will show you the last 20 lines of the file)
grep It searches files for specified words or patterns.
wc To do a word count
cut To cut a words or patterns.
Example:
cut 3 "file" (cut from the third letter) cut 2-7 "file" (take the letters from positions 2 to 7)
Task
Create a file with this message „I want to eat hamburgers with potatoes. I like them“ and u need to take only the „I like them“. Use the commands you have learned.