Linux System Navigation & File Handling

September 20, 2025
No Comments
3 min read

১. ফাইল সিস্টেম এবং ডিরেক্টরি স্ট্রাকচার বোঝা

Linux এ সবকিছু ফাইল এবং ডিরেক্টরি আকারে থাকে। Root থেকে শুরু করে sub-directory গুলো hierarchical ভাবে সাজানো থাকে।

Important directories:

DirectoryPurpose (ব্যবহার)
/Root directory, সবকিছু এখান থেকে শুরু
/homeUser এর personal files, যেমন /home/username
/binCommon binaries (commands)
/sbinSystem binaries (admin commands)
/etcConfiguration files
/varVariable files (logs, spool)
/usrUser programs and data
/tmpTemporary files
/devDevice files
/mntMount point for temporary mounts
/mediaRemovable media (USB, CD)

২. ডিরেক্টরি নেভিগেশন (Navigation)

২.১ Current Directory দেখার জন্য

Bash
pwd
  • pwd = Print Working Directory
  • উদাহরণ:
$ pwd
/home/hasnat

২.২ Directory List দেখার জন্য

Bash
ls
ls -l
ls -a
ls -lh
  • ls → ফাইলের নাম দেখায়
  • ls -l → বিস্তারিত দেখায় (permissions, owner, size)
  • ls -a → hidden files দেখায় (ফাইলের নাম যদি . দিয়ে শুরু হয়)
  • ls -lh → human readable size দেখায়

২.৩ Directory Change করা

Bash
cd /path/to/directory
cd ..      # parent directory এ যাওয়া
cd ~       # home directory এ যাওয়া
cd -       # previous directory এ ফিরে যাওয়া

৩. ফাইল এবং ডিরেক্টরি তৈরি/ডিলিট করা

৩.১ ডিরেক্টরি তৈরি

Bash
mkdir new_folder
mkdir -p parent_folder/child_folder  # nested directory

৩.২ ফাইল তৈরি

Bash
touch file.txt
  • touch শুধু ফাইল create করে বা existing ফাইল এর timestamp update করে।

৩.৩ ফাইল/ডিরেক্টরি কপি

Bash
cp source.txt destination.txt
cp -r folder1/ folder2/   # directory copy

৩.৪ ফাইল/ডিরেক্টরি move বা rename

Bash
mv oldname.txt newname.txt
mv file.txt /path/to/destination/

৩.৫ ফাইল/ডিরেক্টরি delete

Bash
rm file.txt
rm -r folder_name
rm -rf folder_name  # force delete, সাবধানে ব্যবহার করতে হবে

৪. File Viewing / Reading

৪.১ File content দেখার জন্য

Bash
cat file.txt       # পুরো content দেখায়
less file.txt      # page by page দেখায় (scrollable)
more file.txt      # less এর simplified version
head file.txt      # প্রথম 10 line দেখায়
head -n 20 file.txt  # প্রথম 20 line
tail file.txt      # শেষ 10 line
tail -f file.txt   # real-time updates (logs) দেখার জন্য)

৫. Wildcards এবং Pattern Matching

Linux এ অনেক কমান্ডে wildcard ব্যবহার করা যায়:

WildcardMeaning
*0 বা অনেক character
?1 character
[abc]a বা b বা c character
[0-9]0 থেকে 9 পর্যন্ত character

উদাহরণ:

Bash
ls *.txt        # সব txt ফাইল দেখাবে
ls file?.txt    # file1.txt, file2.txt ইত্যাদি
ls [a-c]*.txt   # a, b, c দিয়ে শুরু হওয়া txt ফাইল

৬. Piping & Redirection

৬.১ Output Redirect

Bash
ls > files.txt   # output files.txt এ লেখা
ls >> files.txt  # append mode

৬.২ Input Redirect

Bash
sort < unsorted.txt

৬.৩ Pipe (|)

Bash
ls -l | less
cat file.txt | grep "Linux"
  • Pipe দিয়ে এক কমান্ডের output আরেক কমান্ডের input হিসেবে পাঠানো যায়।

৭. File Searching

৭.১ find command

Bash
find /home/hasnat -name "*.txt"        # নাম অনুযায়ী খুঁজে বের করা
find /var -type f -size +1M           # size >1MB

৭.২ locate command

Bash
locate file.txt
  • এটি database ব্যবহার করে fast search করে
  • আগে sudo updatedb দিয়ে database update করতে হয়

৭.৩ grep command

Bash
grep "hello" file.txt
grep -r "main" /home/hasnat/          # recursive search
grep -i "linux" file.txt               # case-insensitive

৮. File Permissions & Ownership

Linux এ প্রতিটি ফাইল/ডিরেক্টরি owner & permission থাকে:

  • Permissions: read (r), write (w), execute (x)
  • Ownership: user & group

Check permissions:

Bash
ls -l

Change permissions:

Bash
chmod 644 file.txt    # rw-r--r--
chmod +x script.sh    # execute permission add

Change owner:

Bash
chown user:group file.txt

Summary

  • Navigationpwd, cd, ls
  • File Handlingtouch, mkdir, cp, mv, rm
  • View Filescat, less, more, head, tail
  • Search Filesfind, locate, grep
  • Pattern Matching → wildcards (*, ?, [a-z])
  • Redirect & Pipe>, >>, <, |
  • Permissions & Ownershipchmod, chown

Topics

©2025 Linux Bangla | Developed & Maintaind by Linux Bangla.