Giter Site home page Giter Site logo

lab-bash's Introduction

Bash Lab

Intro

Let's practice with bash, a programming language that runs on the command line!

Deliverable

Open the jupyter notebook in this folder named solutions.ipynb and type in the exercise titles in one cell, and in another cell the command you used to solve the exercises.

Setup

  1. Go to the folder where you are running in the terminal. When you run ls
$ ls
  1. You should see:
README.md lorem solutions.ipynb
  1. Try to do all the exercises without changing directories.

Exercises

  • Print Hello World on console.

  • Create a new directory named new_dir.

  • Delete that directory.

  • Copy the sed.txt file inside the lorem folder to the lorem-copy folder. TIP: It may be necessary to create the lorem-copy folder first.

  • Copy the other two files from the lorem folder to the lorem-copy folder in a single line.

  • Displays the contents of the sed.txt file inside the lorem folder.

  • Displays the contents of the at.txt and lorem.txt files inside the lorem folder.

  • Displays the first 3 lines of the sed.txt file inside the lorem-copy folder.

  • Display the last 3 lines of the file sed.txt inside the lorem-copy folder.

  • Adds Homo homini lupus. to the end of file sed.txt inside the lorem-copy folder.

  • Display the last 3 lines of the sed.txt file inside the lorem-copy folder. You should now see Homo homini lupus..

  • Replace all occurrences of et with ET from the at.txt file inside the lorem-copy folder. You must use sed.

  • Find the active user on the system.

  • Find where you are on your file system.

  • List the files ending with .txt in the lorem folder.

  • Count the number of lines that the file sed.txt has inside the lorem folder.

  • Counts the number of files beginning with lorem that are in this directory and in internal directories.

  • Find all occurrences of et in at.txt inside the lorem folder.

  • Count the number of occurrences of the string et in at.txt inside the lorem folder.

  • Count the number of occurrences of the string et in all files in the lorem-copy directory.

bash files

Any bash command or commands can be stored in a file and executed whenever you want. Obviously you can use your favorite editor. We create the file:

$ touch list_files.sh

And we include the content we want. In this case list files:

#!/bin/bash
ls

Run the script:

$ bash list_files.sh

And we will see by console the following output.

README.md lorem solutions.ipynb

Bonus

  • Store in a variable name your name.

  • Print that variable.

  • Create a new directory named after the contents of the name variable.

  • Delete that directory.

  • Displays the processes in hierarchical form that are running on your computer:

    1. using the top or htop command.
    2. Using the ps command with arguments
  • Display information about your processor on the screen

  • Create 3 aliases and make them available every time you log in.

  • Compress the lorem and lorem-copy folders into a file called lorem-compressed.tar.gz

  • Unzip the file lorem-compressed.tar.gz into the folder lorem-uncompressed

  • Create a bash script to print the numbers from 1 to 100.

lab-bash's People

Contributors

pauperl avatar gasparms9 avatar breogann avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.