# Basics Commands

## Cheat.sh

{% embed url="<https://cheat.sh/>" %}

## Cat: Command not found

Replace `cat` by `tee < <file>`

## Usefull commands

```
adduser username
addgroup groupname
usermod -a -G <groups seperated by commas> <user>

uname -a

#kernel version
uname -r
cat /proc/version

# OS version
lsb_release -a

# Listening ports
netstat -tulpn

id
groups # admin can read logs on /var/log

sudo -l

ps -aux # search for root processes

# see EoP

free # memory
top # process / CPU

# Zip
unzip myzip.zip

# Rar
unrar x archive.rar

# Gunzip
gzip -d filename.gz
gunzip -k filename.gz   //-k keep (don't delete) original file .gz
zcat filename.gz > filename

# Bzip2
bzip2 -d filename.bz2 // This command will not preserve original archive file
bzip2 -dk filename.bz2 // To preserve the original file

# Tar
tar xvf file.tar

# Tar + Gzip
tar -xzvf archive.tar.gz

# Tar + Bz2
tar -xjvf archive.tar.bz2

# Tar + Xz
tar -xJvf archive.tar.xz
```


---

# Agent Instructions: 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://0xss0rz.gitbook.io/0xss0rz/pentest/privilege-escalation/linux/basics.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.
