❌

Normal view

There are new articles available, click to refresh the page.
Before yesterdayMain stream

Kanchilug Monthly Meet – Oct ,13 2024

By: Hariharan
13 October 2024 at 16:30

Lightning Talk by Krishna

Topic : Desktop Customization : picom, pywal

Resource : Krishna S

SSD File System Comparison : https://www.linux.org/threads/comparison-of-file-systems-for-an-ssd.28780/

https://etherpad.wikimedia.org/p/KanchiLUGMMOct13

Notes on Choosing HDD to SSD Linux Installation migration

Chat GPT Prompt : how to backup current linux installation configuration files and packages list as a archive and apply on a new installation

Result

Backing up your current Linux installation’s configuration files and package lists is a great way to ensure you can easily restore or replicate your setup on a new installation. Here’s how you can do it:

Step 1: Backup Configuration Files

  1. Identify Configuration Files: Most configuration files are located in /etc. You may also have application-specific configurations in your home directory (like .bashrc, .vimrc, etc.).
  2. Create an Archive:
    You can create a compressed archive (like a tarball) of your configuration files. Run the following command:
   sudo tar -czvf config_backup.tar.gz /etc /home/your_username/.bashrc /home/your_username/.vimrc

Adjust the paths based on what configuration files you want to back up.

Step 2: Backup Installed Packages List

The method to back up the installed package list depends on your Linux distribution.

For Debian-based systems (like Ubuntu):

  1. Backup Installed Packages:
   dpkg --get-selections > package_list.txt
  1. Backup Sources List:
   sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup

For Red Hat-based systems (like Fedora, CentOS):

  1. Backup Installed Packages:
   rpm -qa > package_list.txt
  1. Backup Repositories:
   sudo cp -r /etc/yum.repos.d/ /path/to/backup/repo_backup/

Step 3: Create a Complete Backup Archive

Combine everything into one archive:

tar -czvf full_backup.tar.gz config_backup.tar.gz package_list.txt /etc/apt/sources.list.backup

Step 4: Restore on a New Installation

  1. Transfer the Backup: Copy the full_backup.tar.gz to your new installation.
  2. Extract the Backup:
   tar -xzvf full_backup.tar.gz
  1. Restore Configuration Files:
   sudo tar -xzvf config_backup.tar.gz -C /
  1. Restore Package List: For Debian-based systems:
   sudo dpkg --set-selections < package_list.txt
   sudo apt-get dselect-upgrade

#### For Red Hat-based systems:
You can reinstall packages from the list:

   xargs -a package_list.txt sudo dnf install -y
  1. Restore Sources List (Debian-based):
   sudo cp /etc/apt/sources.list.backup /etc/apt/sources.list
   sudo apt update

Step 5: Finalize and Reboot

After restoring everything, it’s a good idea to reboot your system to ensure all configurations take effect.

Notes:

  • Make sure to review any new configurations or installed packages after the restoration, as dependencies and versions may vary.
  • For user-specific configurations, you may want to back up the entire home directory or specific application directories.

This process should help you smoothly transition to a new Linux installation with your desired configurations and packages!

Chat GPT Prompt : I am in a plan of migrating linux os to a new file system which is xfs or zfs brtfs which on is good

Choosing between XFS, ZFS, and Btrfs depends on your specific needs and use cases. Here’s a breakdown of each file system’s strengths and considerations to help you decide:

XFS

Pros:

  • Performance: Excellent performance, especially for large files and high-performance workloads.
  • Scalability: Designed for scalability, making it suitable for high-capacity storage systems.
  • Mature: A well-established file system with a long history of stability.

Cons:

  • Features: Lacks some advanced features like snapshots and built-in RAID compared to ZFS and Btrfs.
  • Management: Does not have as many management tools as ZFS.

ZFS

Pros:

  • Data Integrity: Strong focus on data integrity with built-in checksumming.
  • Snapshots and Clones: Supports efficient snapshots and clones, allowing for easy backups and recovery.
  • Compression: Offers built-in compression options, which can save space.
  • RAID: Supports various RAID levels natively (ZRAID), enhancing redundancy.

Cons:

  • Memory Usage: Can require more RAM for optimal performance.
  • Complexity: More complex to set up and manage compared to traditional file systems.

Btrfs

Pros:

  • Snapshots and Subvolumes: Supports snapshots and subvolumes, making it flexible for backups and system management.
  • Built-in RAID: Offers support for multiple RAID levels.
  • Compression and Deduplication: Supports on-the-fly compression and deduplication.

Cons:

  • Stability: Still considered less mature than XFS and ZFS; while it has improved significantly, it may not be as stable for all workloads.
  • Performance: Can have variable performance depending on the workload and configuration.

Recommendations

  • For General Use: If you want stability and performance for general workloads, XFS is a great choice.
  • For Data Integrity and Advanced Features: If data integrity, snapshots, and advanced features are critical, ZFS is likely the best option.
  • For Flexibility and Modern Features: If you want modern features like snapshots and subvolumes with some flexibility, consider Btrfs.

Final Thoughts

Evaluate your specific use cases (e.g., data integrity, performance, ease of management) and the resources available on your system (e.g., RAM for ZFS). If possible, testing each file system in a non-production environment can also help you determine which one best meets your needs.

Learning Fundamentals of Linux from scratch day-3-6 : Basic shell commands

11 February 2024 at 22:38

Learning more terminal commands, on Kaniyam- https://kaniyam.com/linux-course-feb-2024/ 

uname prints system information

uname #gives system information
uname -a # all the information a- all
uname -s # only kernel information
uname -r # kernel release type

uptime

uptime #displays time up no of users, load
uptime -p #prettify

Directory commands

pwd #present working directory
mkdir dir1 #make directory directory name
mkdir testing2 testing3 #make multiple directories with name1, name2
mkdir -v folder1 folder3 #v indicates verbose
mkdir {foldr1,foldr2,foldr3} #creates 3 directories if folder already exists, returns message
mkdir -p -v parent/dad/mom #-p creates parent/child/child2 directories
rmdir #only removes only empty directories
cd #change directory
cd .. #go to parent directory
cd #go to home directory
locate filename.txt #returns file location if it exists
updatedb #updatedb utility

who

who #username, terminal, when logged in, ipaddress date tty7 direct, tty2 or 3 virtual terminal
who -r #run level 0-6 (how logged in)

Word count (wc)

wc # number of lines, number of words, number of bytes
wc -l #number of lines
wc -m # number of characters

copy command cp

cp filename1 newfilename #copies a file (creates a backup)
cp filename location #copies to location
cp filename1 filename2 location #
cp -r #perform copy recursively
cp -r foldername destination

Move command mv

mv oldname newname #rename a file
mv filename destination #cut and paste (move)

Piping

cat /filename | wc #pipes the output of  first command as input to second command
grep #pattern matching
cat /filename | grep word_to_search

vim text editor

vim filename.txt #opens a new file in the text editor mode
# i insert text into file, escape,wq! for save and exit
# escape q! quit without writing

find command

find . -name secret.txt #find the file name in this current location '.' indicates current location
find . -type d -name foldername #d indicates that you are finding a document

Environment (env)

env #environment variable
export name= kaniyam #assign value to name variable
printenv name #prints the value of env variable

Diskfree (df)

df # displays diskspace
df -h #human readable
df -h --total s

Less

less filename.txt #reads the file one screen at a time

Sort

sort filename #sort the content in alphabetical order
sort file1.txt > file2.txt #sort output in a new file
sort file1.txt file2.txt #multiple file sorting
sort -u file.txt #remove duplicates in the file

Unique

uniq file.txt #remove redundant string (careful about 'next line characters or whitespaces')
uniq -c file.txt #prints strings and counts

Cut command

cut -c1 file.txt #cut first character from every line
cut -c1-3 #first 3 chars from beginning of the line.

Format command

fmt fie.txt#collecting words and fill as a paragraph
fmt -u file.txt #remove additional whitespaces

Head and Tail commands

head file.txt #first 10 lines of a file
head -n 11 state.txt #-n specifies number of lines
tail file.txt # last 10 lines of a file
tail file.txt | sort
tail -f file.txt #real time log of last line

Numbering

nl sample.txt #number the lines and displays
nl -s ".." file.txt # adds a string after the numbering

Split

split file.txt #split larger file to smaller file
split fsfs.txt #by default it splits at 1k lines
split -l2 file.txt split2op #splits every two lines

last list of users who logged in

last #information about who logged in to the machine
last -5
last -f #list of users who logged out

tac command (opposite of cat)

tac #concatenate and print in reverse order
tac file.txt > file2.txt # reversed order stored in diff file

Translate command (tr)

tr [a-z] [A-Z] #translate from standard input and writes to output
tr [:lower:] [:upper:] < sample.txt > trans.txt #trans;ate from file sample.txt and stores output to trans.txt lower to upper translation

sed command (some simple use cases), there are others

sed 's/unix/linux' sample #filter and transform the text 'search for 'unix' in file and transform it to linux' only first instance
sed 's/unix/linux/g' sample #'g' indicates global
sed 's/unix/linux/gi' sample #'i' for ignore

Paste command

paste file.txt file.txt #joins the file horizontally default delimiter is tab character
paste -d '|' file.txt file.txt #joins with delimiter

❌
❌