---
# System prepended metadata

title: Training onboard review questions

---

Training onboard review questions
===

:::info
One simple and concise sentence is enough for each answer.
:::
## 1. Git

1. What is the use of the `git clone ...`?
1. How to initialize a repository in Git?
1. What is the use of the `git remote set-url ...`?
1. What is the use of the `git remote add ...`?
1. What is the correct syntax to add a message to a commit?
1. What is staging area?
1. How to add a file to staging area?
1. What happen when you run `git fetch`?
1. What happen when you run `git pull`?
1. What happen when you run `git pull --rebase`?
1. What happen when you run `git rebase -i HEAD~5`?
1. What happen when you run `git rebase --abort`?
1. How to drop a commit in remote?
1. How to modify the last local commit?
1. How to modify an existing commit in remote?
1. What happen when you run `git push -u origin feature/123123`
1. What happen when you run `git push --force origin feature/123123`
1. What does the `git reset --mixed` and `git merge --abort` commands do?
1. What is the use of the `git config` command? Give 2 examples
1. What is your favourite git tool? Give some names.
1. What exactly is `git cherry-pick`?
1. What command helps us to know the branches merged into current local branch and which are not?
1. What does the `git status` command do?
1. What does the `git stash` command do?
1. How is Git `merge` different from Git `rebase`?
1. What is the main different between Git and GitHub?
1. What is the pull request in github?

## 2. Linux / Bash

### Questions
1. What is Linux? Redhat Enterprise Linux? Oracle Linux Enterprise? CentOS? Ubuntu?
1. What is LTS version of Ubuntu?
1. How to install a package in ubuntu?
1. What is the different of `yum` and `dnf`?
1. How to install a package with `dnf`?
1. What is the use of `vim` command?
1. What is the use of `grep` command?
1. What is the use of `unzip` command?
1. What is the use of `tar` command?
1. What is the use of `less` and `more` command? Name a case that we should use `less` but should not use `vim` 
1. How to create an user?
1. How to change password of an user?
1. What is the use of `sudo`?
1. What is the use of `wget`?
1. How to get the current IP of your machine?
1. How to get the list of openning ports on a local server?
1. What is use of `curl`?
1. How to find a list of open file related to 1 process?
1. How to find the list of clients which are connecting to a tcp port?
1. How to check the resource (ram/cpu) used by 1 process?
1. How to regularly check the result of a command?

### Setup your environment

:::info
Please note down some steps or create the guideline
:::

1. Download a VMware machine, [ubuntu](https://www.osboxes.org/ubuntu-server/) or [oracle](https://www.oracle.com/downloads/developer-vm/community-downloads.html)/[centos](https://www.osboxes.org/category/centos/) is your choice.
1. Create an user similar to your fortna email, eg `linhvu` (email `linhvu@fortna.com`)
1. Set the user password to `1`
1. Install `docker`
1. Add your user (eg `linhvu`) to `sudo` and `docker` group
1. (Optional) modify ... to run sudo without password 
1. Set your static IP of to `101`, eg `192.168.83.101` it must match the guest VM network. Using GUI if needed.
1. Run `sudo systemctl set-default multi-user.target`
1. Reboot

### Practices

:::info
For each request: provide only 1 single command to execute.
:::
1. Create a folder in your home directory, named `training-bash` inside `onboard`, inside folder `Projects` (1)
1. go into the created fo
1. Download the file here TBD. Using `wget` (2)
1. Extract the file in (2) into the folder of (1)
1. List all the file in folder (1)
1. Compress all text file to a single `tar` file: `asrs.tar.gz`
1. Remove all text files
1. Extract the tar file `asrs.tar.gz`
1. Count the total of lines contains `xception` in each file
1. Count the total of `NullPointerException` in each file
1. Count the total of lines contains `xception`, but do not contain `BusinessException`

#### Using the first file:
1. Print the last 100 lines
1. Print the first 100 lines


#### For the last 100000 lines of the first file:
:::info
hint: search for usages of `grep`, `awk`
:::
1. Print all lines contains `PORT` and port number and `READY`. It must include all ports, eg `PORT365READY` but only grep 1 time.
1. Print the name of all pipelines. For each pipeline, print only 1
1. Same as previous, but include the count of each pipelines
1. Print the lines contain `pipeline` and `duration`
1. Sort all pipelines execution by `duration`.
1. Print all execution time of pipeline `prepare-bin-for-custom-port-pipeline`
1. Sort all pipeline names by the execution time 
1. Same as previous but print the reverse order
1. Print top 10 smallest execution time of pipeline `prepare-bin-for-custom-port-pipeline`
1. Print top 10 longest execution time of pipeline `prepare-bin-for-custom-port-pipeline`
1. Print the min, max, count and average execution time of pipeline `prepare-bin-for-custom-port-pipeline`
1. Print the lines contain `PORT365`
1. Print the lines contain `portlocationready` AND `port_id>365`
1. Print the lines contain `PORT365` OR `port_id>365`
1. Save the output of previous command to a file name `365.txt`
1. Print the min, max, average of API sent to AutoStore
1. Count total of each method to autostore, eg `portlocationready`
1. Print the lines contain event for bin `4061940`
1. Print the lines contain event for bin `4061940` and `LpiQueueArray:36`
1. Print all lines logged between [`18:01` and `18:10`)
1. Count total bins dropped outside (see pattern `BM,bin_id,X`)

### `less` practicing
Open the first file:
1. How to navigate to the first event of `portlocationready` for port 365
1. How to navigate to the next event of `portlocationready`
1. How to navigate to the next page
1. How to navigate to the first line
1. How to navigate to the last line
1. How to navigate to the last event of `PORT365READY`
1. How to navigate to the previous event of `PORT365READY`

### `vim` practicing

Install `vim` first, using your OS package management software, eg `apt` or `yum`. 
:::info
You must use `vim` to complete the following quest. Practice with https://www.openvim.com/ if needed
:::

1. What is the key combination to start insert mode?
1. What is the key combination to quit and save the file?
1. What is the key combination to quit and does not save the file?
1. What is the key combination to cut and paste?
1. What is the key combination to copy and paste?
1. what is the key combination to set line number?
1. What is the key combination to replace a string with another string?
1. What is the key combination to deleting the current line?
1. How to move the cursor to the first line?
1. How to move the cursor to the last line?
1. How do we delete 2 lines?
1. How do we delete from current cursor position to the end of file?
1. How do we delete from current cursor position to the start of file?
1. How do we compare 2 files with vim?

#### Hands-on questions
1. Create a file `createschema.sql`
1. Paste or insert following content (6 lines).

```sql=
ALTER SESSION SET "_ORACLE_SCRIPT"=true;
DROP USER bob CASCADE;
CREATE USER bob IDENTIFIED BY bob;
GRANT CONNECT, RESOURCE, DBA TO bob;
COMMIT;

```
1. show the line number of vim
1. move the cursor to line 1
1. using `vim`, duplicate the block, start at line 6
1. replace `bob` with `alice`
1. go to line 6
1. delete current line (line 6)
1. delete the current line and 1 more line below
1. delete from current position to the end of file
1. save the file

the final content (expected output) look like:
```sql=
ALTER SESSION SET "_ORACLE_SCRIPT"=true;
DROP USER alice CASCADE;
CREATE USER alice IDENTIFIED BY alice;
GRANT CONNECT, RESOURCE, DBA TO alice;
COMMIT;
```

### `sed` practicing

1. how to print (without replace the content of file) `createschema.sql` but replace all `alice` with `fortna` 
1. how to replace the content of `createschema.sql`: all `alice` replaced by `fortna` 
1. how to replace a string contains `/` character

## 3. Maven

1. What is the different between `mvn clean`, `mvn clean install` and `mvn clean package install`
1. What is maven `bom`?
1. What is parent pom?
1. What is maven plugin?
1. What is order of plugin execution? Does the parent module plugin execute before the module plugin? 
1. How to modify maven settings?
1. What is maven repository?
1. Where is the maven local repository in your system?
1. How to configure the custom repository for maven?
1. What is the use of maven enforcer plugin?
1. What is the fat-jar and thin-jar?
1. How to create the runnable fat jar with maven?
1. How to create a thin jar without dependencies with maven?

## 4. Docker & docker swarm

1. Different between `docker` and `docker-compose`
1. How to find usage resources for each container?
1. How to mount a folder from local to docker container?
1. How to mount a port from docker container to the host network?
1. How to run a command inside the container


