> For the complete documentation index, see [llms.txt](https://mainekhacker-1.gitbook.io/mainekhacker/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mainekhacker-1.gitbook.io/mainekhacker/linux-commands-checklists.md).

# linux Commands CheckLists:

## linux Commands

**Beginners**

* Beginners

## 💻 Kali Linux Basics: Cheat Sheet for Beginners

November 05, 2024

***

### 🧭 Navigation & Directory Management

| Command               | Description                         | Example                   |
| --------------------- | ----------------------------------- | ------------------------- |
| `pwd`                 | Print current directory             | `pwd`                     |
| `ls`                  | List directory contents             | `ls`                      |
| `ls -l`               | List contents with details          | `ls -l`                   |
| `ls -a`               | Include hidden files in listing     | `ls -a`                   |
| `cd [directory]`      | Change directory                    | `cd Documents`            |
| `cd ..`               | Move up one directory               | `cd ..`                   |
| `cd ~`                | Go to the home directory            | `cd ~`                    |
| `mkdir [folder_name]` | Create a new directory              | `mkdir new_folder`        |
| `rm [file]`           | Delete a file                       | `rm file.txt`             |
| `rm -r [directory]`   | Remove a directory and contents     | `rm -r old_folder`        |
| `cp [source] [dest]`  | Copy files or directories           | `cp file1.txt file2.txt`  |
| `mv [source] [dest]`  | Move or rename files or directories | `mv file.txt newname.txt` |

### 📝 File Operations

| Command                | Description                      | Example               |
| ---------------------- | -------------------------------- | --------------------- |
| `cat [file]`           | Display file contents            | `cat notes.txt`       |
| `less [file]`          | View contents with scroll option | `less notes.txt`      |
| `head -n [num] [file]` | Show the first n lines of a file | `head -n 5 notes.txt` |
| `tail -n [num] [file]` | Show the last n lines of a file  | `tail -n 5 notes.txt` |
| `nano [file]`          | Open file in nano editor         | `nano notes.txt`      |
| `vim [file]`           | Open file in vim editor          | `vim notes.txt`       |

### 🔍 Search for Files and Text

| Command                        | Description                            | Example                     |
| ------------------------------ | -------------------------------------- | --------------------------- |
| `find [path] -name [filename]` | Find files by name in a path           | `find / -name file.txt`     |
| `locate [filename]`            | Quickly locate files (uses index)      | `locate file.txt`           |
| `grep '[text]' [file]`         | Search text within a file              | `grep 'error' log.txt`      |
| `grep -r '[text]' [dir]`       | Recursively search text in a directory | `grep -r 'error' /var/logs` |

### 📦 Package Management with APT

| Command                      | Description                                | Example                 |
| ---------------------------- | ------------------------------------------ | ----------------------- |
| `sudo apt update`            | Refresh list of available packages         | `sudo apt update`       |
| `sudo apt upgrade`           | Install updates for all installed packages | `sudo apt upgrade`      |
| `sudo apt install [package]` | Install a specific package                 | `sudo apt install vim`  |
| `sudo apt remove [package]`  | Uninstall a specific package               | `sudo apt remove vim`   |
| `dpkg -i [file.deb]`         | Manually install a .deb package            | `dpkg -i mypackage.deb` |

### 🔒 Permissions and Ownership

| Command                         | Description                                 | Example                       |
| ------------------------------- | ------------------------------------------- | ----------------------------- |
| `chmod [mode] [file]`           | Change permissions (rwx) for a file         | `chmod 755 script.sh`         |
| `chown [user]:[group] [file]`   | Change ownership of a file or directory     | `chown root:staff file.txt`   |
| `chown -R [user]:[group] [dir]` | Change ownership for directory and contents | `chown -R user:user /project` |

Each number in `chmod` represents permissions for Owner, Group, and Others:

| Number | Permissions | Meaning              |
| ------ | ----------- | -------------------- |
| 7      | `rwx`       | Read, Write, Execute |
| 5      | `r-x`       | Read, Execute        |
| 6      | `rw-`       | Read, Write          |
| 4      | `r--`       | Read only            |

Examples:

* `chmod 755 file.sh` → Owner has full access (`7` = `rwx`); group and others can read and execute (`5` = `r-x`).
* `chmod 644 file.sh` → Owner can read and write (`6` = `rw-`); group and others can only read (`4` = `r--`).

### 📊 System Monitoring

| Command              | Description                              | Example        |
| -------------------- | ---------------------------------------- | -------------- |
| `top`                | Monitor running processes in real-time   | `top`          |
| `htop`               | Colorized view of running processes      | `htop`         |
| `df -h`              | Show disk usage in human-readable format | `df -h`        |
| `du -sh [directory]` | Show size of a directory                 | `du -sh /home` |
| `free -h`            | Show memory usage                        | `free -h`      |
| `uname -a`           | Display system information               | `uname -a`     |
| `ps aux`             | Show all running processes               | `ps aux`       |

### 🌐 Network Essentials

| Command         | Description                          | Example                            |
| --------------- | ------------------------------------ | ---------------------------------- |
| `ifconfig`      | Show network interface configuration | `ifconfig`                         |
| `ip a`          | List IP addresses of interfaces      | `ip a`                             |
| `ping [host]`   | Check connectivity to a host         | `ping google.com`                  |
| `netstat -tuln` | List open ports                      | `netstat -tuln`                    |
| `curl [URL]`    | Fetch data from a URL                | `curl http://example.com`          |
| `wget [URL]`    | Download files from a URL            | `wget http://example.com/file.zip` |

### 💾 File Compression and Archiving

| Command                      | Description                          | Example                     |
| ---------------------------- | ------------------------------------ | --------------------------- |
| `tar -cvf archive.tar [dir]` | Create a .tar archive of a directory | `tar -cvf backup.tar /data` |
| `tar -xvf archive.tar`       | Extract contents of a .tar archive   | `tar -xvf backup.tar`       |
| `gzip [file]`                | Compress a file                      | `gzip file.txt`             |
| `gunzip [file.gz]`           | Decompress a .gz file                | `gunzip file.txt.gz`        |
| `zip [archive.zip] [file]`   | Compress files into a .zip archive   | `zip archive.zip file.txt`  |
| `unzip [archive.zip]`        | Extract contents of a .zip file      | `unzip archive.zip`         |

### 🔧 Process Management

| Command        | Description                              | Example         |
| -------------- | ---------------------------------------- | --------------- |
| `kill [PID]`   | Terminate a process by its ID            | `kill 1234`     |
| `pkill [name]` | Terminate a process by name              | `pkill firefox` |
| `bg`           | Move a job to the background             | `bg`            |
| `fg`           | Bring a background job to the foreground | `fg`            |
| `jobs`         | List background jobs                     | `jobs`          |

### ⏰ Scheduling with Cron

| Command      | Description                                          | Example                  |
| ------------ | ---------------------------------------------------- | ------------------------ |
| `crontab -e` | Edit the current user’s cron jobs                    | `crontab -e`             |
| Cron syntax  | `* * * * * command` (min, hour, day, month, weekday) | `*/5 * * * * /script.sh` |

### 🔑 SSH & Remote Access

| Command                         | Description                                 | Example                                |
| ------------------------------- | ------------------------------------------- | -------------------------------------- |
| `ssh user@host`                 | Connect to a remote system                  | `ssh user@192.168.1.10`                |
| `scp [source] user@host:[dest]` | Copy files to a remote system               | `scp file.txt user@192.168.1.10:/path` |
| `rsync -av [source] [dest]`     | Sync files between local and remote systems | `rsync -av /local user@host:/remote`   |


---

# 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://mainekhacker-1.gitbook.io/mainekhacker/linux-commands-checklists.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.
