In this lab we are going to practice with bash, a shell and command-line language!
-
Fork the repo in your git hub account and then clone the folder "lab-bash" to your machine and navigate to it folder.
-
Check the contents of the folder using the "ls" command
$ lsand you should see the following:
exercises inputs lorem lorem-copy modules outputs README.md- Stay in the same directory/folder and complete the following exercises.
- 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]
- Create a new directory called
new_dir. - Delete/Remove the directory
new_dir. - Copy the file
sed.txtfrom theloremfolder and paste it to the folderlorem-copyfolder. - Copy the other two files from the
lorem foldertolorem-copyfolder in just one line using semicolon;. - Show the
sed.txtfile content from theloremfolder. - Show the
at.txtfile andlorem.txtfile contents fromloremfolder. - Print the first 3 rows in
sed.txtfile from lorem-copy folder. - Print the last 3 rows in
sed.txtfile from lorem-copy folder. - Add
Homo homini lupus.at the end ofsed.txtfile in thelorem-copyfolder. - Print the last 3 rows in
sed.txtfile fromlorem-copyfolder. You should seeHomo homini lupus.. sedcommand is used to replace the text in a file. Use thesedcommand to replace all occurances ofetwithETin the fileat.txtfile present in the folderlorem. You can use the following link to refer tosedcommands [https://www.linode.com/docs/guides/manipulate-text-from-the-command-line-with-sed/] Check the contents of the sed.txt file usingcatcommand.- Find who is the system user.
- Find the current path of the directory you are in.
- List all files with the extension
.txtin lorem folder. - Count the rows in
sed.txtfile from lorem folder. Look concatenatecatandwcwith the pipe|. - Count the files which start with
loremin all directories.
- Store your
namein a variable withreadcommand. - Print that variable.
- Create a new directory named with variable
name. - Remove that directory.
