> For the complete documentation index, see [llms.txt](https://www.logeshpaul.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.logeshpaul.com/wiki/code/bash.md).

# Bash

### General

* `pwd` - shows the current directory path
* `ls` - lists the files in the current path
* `touch <filename.extension>` - creates a new file in the current path
* `cd <path>` - checkout to the path

#### Terminal command - Navigate

* `ctrl` + `a` - to move the cursor to the beginning of the line
* `ctrl` + `e` - to move the cursor to the end of the line

#### Terminal command - Delete

* `ctrl` + `w` - to delete the last word
* `ctrl` + `u` - to delete all the way back to the start of the line
* `ctrl` + `k` - to delete to the end of the line

#### Permission

* `sudo chgrp -R admin /usr/local` - set write permission for admin for certain dir
* `sudo chown -R $(whoami) /usr/local` - makes `/usr/local` writeable for the user

#### Port

Find port usage

```sh
 ps -ef | grep puma
```

Kill all processes running on a port

```sh
lsof -ti:9000 | xargs kill 
```

where 9000 is the port number here

#### Advanced

* `ctrl` + `r` - Search through the command history (after pressing, type to search, press ctrl-r repeatedly to cycle through more matches, press Enter to execute the found command, or hit the right arrow to put the result in the current line to allow editing)

**Open VSCode from the terminal**

<figure><img src="/files/YLIEdJBJMYDGuyS6rC4g" alt=""><figcaption></figcaption></figure>

```sh
code .
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://www.logeshpaul.com/wiki/code/bash.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
