Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Main #23

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Main #23

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions answers lab-bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
1- Using the echo command print in console "Hello World". Here is some info about echo command [https://discuss.codecademy.com/t/what-are-practical-uses-of-the-echo-command/394788]
command_for_question_1_is echo as "Hello World"

2- Create a new directory called new_dir.
command_for_question_2_is mkdir new_dir

3- Delete/Remove the directory new_dir.
command_for_question_3_is rm -rf new_dir

4- Copy the file sed.txt from the lorem folder and paste it to the folder lorem-copy folder.
command_for_question_4_is mkdir lorem_copy then cp lorem/sed.txt lorem_copy

5- Copy the other two files from the lorem folder to lorem-copy folder in just one line using semicolon ;
command_for_question_5 is $ cp lorem/lorem.txt lorem_copy; cp lorem/at.txte lorem_copy

6- Show the sed.txt file content from the lorem folder.
command_for_question_6_is cat lorem/sed.txt

7- Show the at.txt file and lorem.txt file contents from lorem folder.
command_for_question_7_is cat lorem/at.txt

8- Print the first 3 rows in sed.txt file from lorem-copy folder.
command_for_question_8_is head -3 lorem_copy/sed.txt

9- Print the last 3 rows in sed.txt file from lorem-copy folder.
command_for_question_9_is tail -3 lorem_copy/sed.txt

10- Add Homo homini lupus. at the end of sed.txt file in the lorem-copy folder.
command_for_question_10_is echo "Homo homini lupus" >> lorem_copy/sed.txt

11- Print the last 3 rows in sed.txt file from lorem-copy folder. You should see Homo homini lupus..
command_for_question_11_is tail -3 lorem_copy/sed.txt

12- sed command is used to replace the text in a file. Use the sed command to replace all occurances of et with ET in the file at.txt file present in the folder lorem. You can use the following link to refer to sed commands [https://www.linode.com/docs/guides/manipulate-text-from-the-command-line-with-sed/] Check the contents of the sed.txt file using cat command.
command_for_question_12_is sed 's/et/ET/' lorem/at.txt

13- Find who is the system user.
command_for_question_13_is whoami

14- Find the current path of the directory you are in.
command_for_question_14_is pwd

15- List all files with the extension .txt in lorem folder.
command_for_question_15_is ls lorem/*.txt

16- Count the rows in sed.txt file from lorem folder. Look concatenate cat and wc with the pipe |.
command_for_question_16_is cat lorem/sed.txt | wc -l lorem/sed.txt

17- Count the files which start with lorem in all directories.
command_for_question_17_is ls -l lorem*/lorem* | wc -l

20- Store your name in a variable with read command.
command_for_question_20_is read var1 #input Natalia.

21- Print that variable
command_for_question_21_is echo $var1 #output Natalia

22- Create a new directory named with variable name.
command_for_question_22_is mkdir $var1

23- Remove that directory
command_for_question_23_is rm -rf Natalia or also: rm -rf $var1
14 changes: 7 additions & 7 deletions lorem/at.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
At vero eos ET accusamus ET iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum
deleniti atque corrupti quos dolores ET quas molestias excepturi sint occaecati cupiditate non
provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum ET dolorum fuga.
Et harum quidem rerum facilis est ET expedita distinctio.
At vero eos et accusamus ET iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum
deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non
provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga.
Et harum quidem rerum facilis est et expedita distinctio.
Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod
maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus.
Temporibus autem quibusdam ET aut officiis debitis aut rerum necessitatibus saepe eveniET
ut ET voluptates repudiandae sint ET molestiae non recusandae.
Itaque earum rerum hic tenETur a sapiente delectus, ut aut reiciendis voluptatibus maiores
Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniET
ut et voluptates repudiandae sint ET molestiae non recusandae.
Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores
alias consequatur aut perferendis doloribus asperiores repellat
10 changes: 10 additions & 0 deletions lorem/at.txt.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
At vero eos ET accusamus ET iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum
deleniti atque corrupti quos dolores ET quas molestias excepturi sint occaecati cupiditate non
provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum ET dolorum fuga.
Et harum quidem rerum facilis est ET expedita distinctio.
Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod
maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus.
Temporibus autem quibusdam ET aut officiis debitis aut rerum necessitatibus saepe eveniET
ut ET voluptates repudiandae sint ET molestiae non recusandae.
Itaque earum rerum hic tenETur a sapiente delectus, ut aut reiciendis voluptatibus maiores
alias consequatur aut perferendis doloribus asperiores repellat
10 changes: 10 additions & 0 deletions lorem_copy/at.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
At vero eos ET accusamus ET iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum
deleniti atque corrupti quos dolores ET quas molestias excepturi sint occaecati cupiditate non
provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum ET dolorum fuga.
Et harum quidem rerum facilis est ET expedita distinctio.
Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod
maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus.
Temporibus autem quibusdam ET aut officiis debitis aut rerum necessitatibus saepe eveniET
ut ET voluptates repudiandae sint ET molestiae non recusandae.
Itaque earum rerum hic tenETur a sapiente delectus, ut aut reiciendis voluptatibus maiores
alias consequatur aut perferendis doloribus asperiores repellat
10 changes: 10 additions & 0 deletions lorem_copy/at.txte
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum
deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non
provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga.
Et harum quidem rerum facilis est et expedita distinctio.
Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod
maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus.
Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet
ut et voluptates repudiandae sint et molestiae non recusandae.
Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores
alias consequatur aut perferendis doloribus asperiores repellat
4 changes: 4 additions & 0 deletions lorem_copy/lorem.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
11 changes: 11 additions & 0 deletions lorem_copy/sed.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium,
totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.
Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit,
sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt.
Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit,
sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem.
Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam,
nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur,
vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?Homo homini lupus
as Homo homini lupus
Homo homini lupus