# Command Line Fun

### Environment Variables

echo $PATH

[![image.png](https://wiki.togogo.ch/uploads/images/gallery/2022-08/scaled-1680-/cJZimage.png)](https://wiki.togogo.ch/uploads/images/gallery/2022-08/cJZimage.png)

export b=10.11.1.220  
ping -c 2 $b

[![image.png](https://wiki.togogo.ch/uploads/images/gallery/2022-08/scaled-1680-/x68image.png)](https://wiki.togogo.ch/uploads/images/gallery/2022-08/x68image.png)

There are many other environment variables defined by default in Kali Linux. We can view these by running <span class="pr-block">env</span> at the command line:

[![image.png](https://wiki.togogo.ch/uploads/images/gallery/2022-08/scaled-1680-/HZWimage.png)](https://wiki.togogo.ch/uploads/images/gallery/2022-08/HZWimage.png)

### Bash History

While working on a penetration test, it's important to keep a record of commands that have been entered into the shell. Fortunately, Bash maintains a history of commands that have been entered, which can be displayed with the <span class="pr-block">history</span> command.<sup class="footnote-ref">[1](https://portal.offensive-security.com/courses/pen-200/books-and-videos/modal/modules/command-line-fun/the-bash-environment/bash-history-tricks#fn1)</sup>

Holding down <span class="kb-block">C</span> and pressing <span class="kb-block">r</span> will invoke the *reverse-i-search* facility. Type a letter, for example, <span class="pr-block">c</span>, and you will get a match for the most recent command in your history that contains the letter "c". Keep typing to narrow down your match and when you find the desired command, press <span class="kb-block">I</span> to execute it.

[![image.png](https://wiki.togogo.ch/uploads/images/gallery/2022-08/scaled-1680-/OuKimage.png)](https://wiki.togogo.ch/uploads/images/gallery/2022-08/OuKimage.png)