> For the complete documentation index, see [llms.txt](https://sh.howtocode.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sh.howtocode.dev/2.0.0.part2intro/2.1.0.environment/2.1.2.envestablished.md).

# যেভাবে এনভায়রনমেন্ট তৈরী হয়

আমরা যখন লগইন করি কম্পিউটারে, bash চালু হয় কিছু কনফিগারেশন ফাইল থেকে ঠিক করে নেয় সকল ইউজারের জন্য এনভায়রনমেন্ট কেমন হবে। এই ফাইলগুলো শুরুতে পড়া হয় বলে এদের স্টার্টআপ ফাইল বলে। এরপর bash ইউজারের হোম ডিরেক্টরিতে থাকা আরও কিছু কনফিগারেশন ফাইল পড়ে। কোন ফাইলের পরে কোন ফাইলটি পড়া হবে তা নির্ভর করে শেল সেশনটি কীরকমের তার উপরে। শেল সেশন দুরকম হয়: ক) লগইন শেল ও খ) নন-লগইন শেল

লগইন শেলে শুরুতেই ইউজারনেম ও পাসওয়ার্ড জানতে চাওয়া হয়। আর লগইন করতে না হলে, যেমনটা আমরা হরহামেশাই ব্যবহার করছি সেটা হচ্ছে নন-লগইন শেল।

লগইন শেল এখান থেকে এক বা একাধিক কনফিগারেশন ফাইল পড়ে:

| ফাইল              | যা থাকে                                                                                                                                                                                                               |
| ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| /etc/profile      | একটি কনফিগারেশন ফাইল যা সব ইউজারের উপরে কার্যকর হয়। এজন্য একে গ্লোবাল কনফিগারেশন স্ক্রিপ্টও বলা হয়।                                                                                                                   |
| \~/.bash\_profile | ইউজারের নিজস্ব স্টার্টআপ ফাইল যা তার হোম ডিরেক্টরিতে থাকে। গ্লোবাল কনফিগারেশনকে ইউজারের প্রয়োজন অনুযায়ী আরও পরিমার্জিত বা পরিবর্ধিত করতে এটি ব্যবহৃত হয়। একই জিনিস দুইটি কনফিগারেশন ফাইলে থাকলে এটির থেকে কার্যকর হয়। |
| \~/.bash\_login   | যদি \~/.bash\_profile ফাইলটি না পাওয়া যায় তাহলে এই স্ক্রিপ্টটি পড়ে।                                                                                                                                                   |
| \~/.profile       | \~/.bash\_profile বা \~/.bash\_login কোনোটাই যদি না পাওয়া যায় তাহলে এটি পড়া হয়।                                                                                                                                       |

অন্যদিকে নন-লগইন শেল মাত্র দুটি ফাইল পড়ে:

| ফাইল             | যা থাকে                                                                  |
| ---------------- | ------------------------------------------------------------------------ |
| /etc/bash.bashrc | নন লগইন শেলের জন্য গ্লোবাল কনফিগারেশন স্ক্রিপ্ট যা সবার জন্য ব্যবহৃত হয়। |
| \~/.bashrc       | ইউজারের নিজস্ব স্টার্টআপ ফাইল                                            |

একটা নন-লগইন শেল আসলে লগইন এর পরেই পাওয়া যায়। আপনি যখন গ্রাফিকালি লগইন করেন তখনই আপনার লগইন শেল এর কনফিগারেশন ফাইলগুলো পড়ে কার্যকর করা হয়ে যায়। নন-লগইন শেলগুলো আসলে লগইন শেলের চাইল্ড প্রসেস। তাই লগইন শেলের কনফিগারেশনগুলোও এর উপর কার্যকর হয়।

## কী থাকে কনফিগারেশন ফাইলে?

আপনি যদি `less ~/.bashrc` কমান্ডটি ব্যবহার করেন তাহলে নিজস্ব নন-লগইনশেল কনফিগারেশন ফাইলটি দেখতে পারবেন। আপনার ব্যবহৃত ডিস্ট্রিবিউশনের ধরন অনুযায়ী এর হেরফের হবে। যেমন, আমার Ubuntu Gnome 14.04 এর ক্ষেত্রে শুরুর তিন লাইন এরকম:

```
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
```

এর প্রত্যেক লাইনের শুরুতে '#' চিহ্ন আছে। তার অর্থ এগুলো কার্যকর হবে না, এগুলো কমেন্ট। কনফিগারেশন ফাইলের বিভিন্ন অংশের কাজ বোঝাতে কমেন্ট ব্যবহার করা হয়। যেমন আমরা যদি bash history সম্পর্কিত কনফিগারেশন দেখি:

```
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth

# append to the history file, don't overwrite it
shopt -s histappend

# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000
```

প্রথমে দুটি কমেন্ট ও তারপর একটি কমান্ড:

```
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth
```

এখানে বলা হয়েছে ডুপ্লিকেট কমান্ড ও স্পেস দিয়ে শুরু করা কমান্ড হিস্ট্রিতে রাখা হবে না। এবং তারপরের লাইনে এ সম্পর্কিত আরও অপশন দেখতে bash(1) ম্যানুয়াল দেখতে বলা হয়েছে। সবশেষে `HISTCONTROL=ignoreboth` কমান্ড দিয়ে কাজটি করা হল। একইভাবে হিস্ট্রিসাইজ ও হিস্ট্রিফাইলসাইজ নির্ধারণ করা হয়েছে। এবং বলা হয়েছে যে হিস্ট্রিফাইল ওভাররাইড না করে এ্যাপেন্ড করতে।


---

# 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, and the optional `goal` query parameter:

```
GET https://sh.howtocode.dev/2.0.0.part2intro/2.1.0.environment/2.1.2.envestablished.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
