# Third-party tools

```{block, type='tip'}

A great playlist covering many command line tools is available below. It has a special focus on tools that are suitable for Data Scientists and Machine Learning Engineers.

[![](http://img.youtube.com/vi/kyaTtJRjMCU/0.jpg)](http://www.youtube.com/watch?v=kyaTtJRjMCU "")
```

The commands that you have so far used are built-in - that is they come preinstalled with your system. They are useful, but they are just scratching the surface of what is possible with the CLI. There is a multitude of tools that you can use there, and here we will go through a few.

## `wget`

This is one of the best ways to download a file from the internet. You can even use it to download files even when you are using a normal browser such as Google Chrome, since the download might often hang, or you can close the browser window by accident. Example usage:

```{bash eval = FALSE}
wget [fileurl]
```

```{block, type='tip'}

Use `wget` to download a file from a web page (i.e. ArXiV paper). Which browser functionality can help you with that?
```

## `sed`

This library can be used to edit the contents in a file with a very good speed. Unfortunately the syntax to use it is not so easy. You can use it for example to remove all commas from a file:

```{bash eval = FALSE}
sed 's/,//g' file  > new_file
```

```{block, type='tip'}
:class: tip

Use `sed` to change the delimiter of a whole file.
```

## `grep`

This is a tool to search for content within a file. For example if we want to see if we have `scikit-learn` installed in a virtual environment we can do the following:

```{bash eval = FALSE}
pip freeze | grep scikit
```

```{block, type='tip'}
How can you use `grep` to get information on all of the current working processes on your machine related to your browser?
```

# Command-line text editors

When working with remote machnies, such as AWS ec2, you will be required to edit files and write code without a GUI. While there have been developments on using tools such as [VSCode to edit remote files](https://code.visualstudio.com/docs/remote/ssh), sometimes it's easier to use a command-line text editor. There are many such tools, but the most popular are [nano](https://www.nano-editor.org/), [vim](https://www.vim.org/) and [emacs](https://www.gnu.org/software/emacs/). The latter two of those are actually the tools of choice for many programmers, and are extremely powerful (at the cost of a very steep learning curve). A nice way to learn VIM is by checking out the [VIM Adventures website](https://vim-adventures.com/) - you can learn it by playing a game!

For our purposes we'll focus on using the basics of `vim` to edit files. It is more complex than `nano` but provides some great added functionality, such as synthax highlighting, to make your remote editing work easier.

Vim comes preinstalled on Linux, which is the typical server machine, and you can start it like this:

```
vim testfile.py
```

This will create this new file and start editing. Vim has several modes of operation, the default one is the selection mode. You can use this to navigate the code by using the arrows. If you want to enter the insert mode, to edit files, press `i`. Then you can start typing, as you would normally in a GUI editor. After you're done, you have to come back to the select mode, by pressing `ESC`. Then you can use the vim commands to save and exit. This command is `:wq`. If you want to quit without saving do `:q!`.

