r_bash – Telegram
Jesus i need help with this 4 year journey

Disclaimer: I do not have admin password, i cant enter bios, and i cant use certain process that require admin on cmd.



Background info: Norton family is a child monotoring software that i want to bypass, i have tried over, and over again, for 4 years, nothing has worked on the internet. Norton family has a range of things you can do in it, like set time limits on a user, and restrict websites (i've bypassed restricted websites with a vpn), norton can also monitor data and send it to my dad. There is also an application called norton 360 that is like an antivirus thing, and its so annoying because it will just remove applications even though its not even a virus. Time restrictions work like this: every 5 seconds there will be a pop up window saying "you have reached your time limit" or something like that and you will be logged out and have to enter your password and it repeats, so last night i was playing with task manager, and decided to end task on one of the norton family processes, and it worked! the pop up didnt happen.... But i realised it would make a new process of the one i ended and i would have to keep ending the task.



*What i need done (if you want to help)*:

Can someone make a software that will kill a proccess in my task manager called "Norton Family", the problem is:, When i do it manually i have to keep doing it every 5 seconds, so its kinda annoying.There are two proccess that are called norton family, the one i want to end the process with is the one without the drop down box (actually it might have a drop down box but we'll get to that later on). There should be a drop down box in the Norton Family process, and inside it there should be a gear icon that says "Norton Family", thats the process i dont want to end, but in the other process also called "Norton family" there should be no drop down box, thats the one i want to end, BUT i've noticed that the first time i end the Norton family application without the drop down box it will end for 5 seconds, before making a new process of itself and then i have a few seconds to end it before the pop up window.But when that new process is made again after i end the old one there is now a drop down box, and inside it theres a thing called "Norton family" (Again) that has a window icon, that thing inside the drop down box is just a window on my pc that says norton family needs a restart, i always click no, lol, so pretty harmless.

By the way, the reason i want to end a specific task of Norton family is because if i try to end the task with the drop down box that has a gear icon in it, it will just say you need admin privileges where as the other one wont say that.



If you have any questions feel free to ask, and i also have norton 360 on my laptop

https://redd.it/1dp844f
@r_bash
how do you put human format in command identify for file size?

Hi, I use the comand identify (from IamgeMagic version6, the old version built-in at Lubuntu OS).

I'd like to retrieve in Vim the output of this command with file size in Kb or Mb, like using the flag -h in ls -lh ...

the command that I use in Vim is this:

r !identify -format "\%f [\%m \%xx\%hPixels \%[size]ytes] \n" path/to/*

this comand only shows %[size]ytes like this 444323bytes

I'd like to see 444.323Mbytes

The command work well fine and I understand the command, I only need what letter should and where put it in the command.

help man identify in C L I and https://www.imagemagick.org/noscript/identify.php

Thank you so much and Regards!

https://redd.it/1dpgw7j
@r_bash
Is bash good for the task I need?

Hi everyone,
I need to parse a directory structure and store each symlink in an array as a "source destination" pair, so each entry in the array will look like this:

source-a.png dest-a.png, source-b.png dest-b.png, source-c.png dest-c.png, ... and so on 1000 more entries

Once I have this array, I need to create a second array but now instead of parsing a directory tree, read out similar source-destination pair information from a file instead. After both arrays are filled, I need to compare them to identify which elements are missing or have been added.

The idea is that if I remove a source-destination pair (source-a.png dest-a.png) from the file, the next time the noscript runs, it removes the source-destination symlink from the filesystem as well. So, the point is to keep the symlinks on the filesystem in sync with the information from the file. That's why I need two arrays.

Given that there might be 1000 entries in both arrays, is it practical to do this with Bash, or should I consider implementing it in Go, which is a language I'm more familiar with than Python? I heard that Bash is slow when it comes to comparing two arrays.

Any suggestions appreciated.

https://redd.it/1dpqa09
@r_bash
Where to Implement noscripts and how to manage them?

I have a noscript I made (my first), but want to know

1. Where to store it (I've read this is the best location: /usr/local/bin )
2. How to manage them with Github and across multiple machines

I'm looking into Ansible for automating my environment setup (current machine is dying plus I anticipate a new job soon). And I just figured out GNU Stow for dotfiles. So in writing my first noscript (well it was actually my second time writing it), as well as the fact that I'll likely have 2 new machines to setup soon, I need to understand properly managing noscripts & between machines.

My problems:

1.) if I put noscript files on Github I believe they must be in a directory (for example: noscripts ). The problem is I've read that user noscripts should be stored at /usr/local/bin not /usr/local/bin/noscripts for example.

2.). There is already a lot of crap in /usr/local/bin and I am wary of adding it all to Github/source control for fear of fouling something up.

I've already figured out:

1. How to get rid of my noscript's extension (.sh) by making this the first line: #!/bin/bash plus runningchmod +x
2. how to make it so that you don't need to whole file address by putting it in a directory that is known to my PATH.

I am sorry I if this is a dumb question - honestly I'm far enough in my career I should already know this but I went through a bootcamp and have some knowledge gaps like this I'm working to fill.


I realize I'm probably over-thinking this. And should just add my personal noscripts to /usr/local/bin/noscripts , add it to my path, and make the "noscripts" directory my git repo.

Any help appreciated. Will post to a few relevant communities.

In summary:

1. Where to store personal noscripts
2. How to manage them with Github and across multiple machines
3. Any thoughts on managing noscripts with Ansible or similar?

https://redd.it/1dq0obx
@r_bash
Will it work or not
https://redd.it/1dq43hf
@r_bash
Make my code even better; which tools are you using?

Hello everyone,

I spend most of my time coding with PHP and, from time to time, I create Bash noscripts that can be several thousand lines long (I have a main noscript and "helpers" that I load as external files).

I use /bin/bash -s mynoscript.sh to identify syntax errors, ShellCheck ( https://github.com/PeterDaveHello/docker-shellcheck) to identify certain errors and shfmt (https://github.com/PeterDaveHello/docker-shfmt) to force formatting of noscripts and I'm hard pressed to find any other tools.

I attach the greatest importance to the quality of my code, its readability, etc. so I'd be happy to read any ideas you have for tools I could use to analyse the quality of my code and make suggestions for improvements.

Thank you very much.

https://redd.it/1dqiq20
@r_bash
Get first output of continous command

Hello, I'd like to only have the first output of a continous command, like pactl subsribe or hyprland-workspaces ALL

https://redd.it/1dqjmig
@r_bash
Ssh into servers and show custom ps1prompt

I have a .bashrc file. Which has alias colors and custom ps1 prompt. In my job we ssh into a passwordless server and from that server we ssh into multiple servers(in those server we have to enter password).

Is there any way to use my local .bashrc file in those ssh servers without modifying the .bashrc file in those servers?

https://redd.it/1dqn22x
@r_bash
what are these things? do they have a name? like the "file permissions letter grid"?
https://redd.it/1dr4q04
@r_bash
portmanager: A Bash Function

## Sourcing the Function
You can obtain the function [here](
https://github.com/slyfox1186/noscript-repo/blob/main/Bash/Misc/Functions/portmanager.sh) on GitHub.

## How It Works

The function uses system commands like ss, iptables, ufw, and firewall-cmd to interact with the system's network configuration and firewall rules. It provides a unified interface to manage ports across different firewall systems, making it easier for system administrators to handle port management tasks.

## Features

1. Multi-firewall support: Works with iptables, UFW, and firewalld.
2. Comprehensive port listing: Shows both listening ports and firewall rules.
3. Port range support: Can open, close, or check ranges of ports.
4. Safety features: Includes confirmation prompts for potentially dangerous operations.
5. Logging: Keeps a log of all actions for auditing purposes.
6. Verbose mode: Provides detailed output for troubleshooting.

## Usage Examples

After sourcing the noscript or adding the function to your .bash_functions user noscript, you can use it as follows:

1. List all open ports and firewall rules:
   port_manager list


2. Check if a specific port is open:
   port_manager check 80


3. Open a port:
   port_manager open 8080


4. Close a port:
   port_manager close 8080


5. Check a range of ports:
   port_manager check 8000-8100


6. Open multiple ports:
   port_manager open 80,443,20000-20010


7. Use verbose mode:
   port_manager -v open 3000


8. Get help:
   port_manager --help


## Installation

1. Copy the entire port_manager function into your .bash_functions file.
2. If using a separate file like .bash_functions, source it in your .bashrc file like this:
   if [[ -f ~/.bash_functions ]]; then
. ~/.bash_functions
fi

3. Reload your .bashrc or restart your terminal.

https://redd.it/1drgck1
@r_bash
Does anyone know how to change dualsense led color

So I'm working on a noscript that allows you to change dualshock led colors I'm trying to implement a dualsense led changer so it's compatible with ps4/ps5 controllers but ran into multiple dead ends on Google if anyone has any idea on how to do this pls let me know

https://redd.it/1drj1s3
@r_bash
Beginner-friendly bash noscripting tutorial

There are plenty of excellent bash noscripting tutorial videos, so I thought one more is not going to hurt.

I've put together a beginner practical tutorial video, building a sample noscript and explaining the concepts along the way. https://www.youtube.com/watch?v=kFovBYgtEuI

The idea is to take you from 0 to 60 with creating your own noscripts. The video doesn't aim to explain all the concepts, but just enough of the important ones to get you started.

https://redd.it/1ds25n3
@r_bash
Share your $PS1 prompt config

Intrested how people use prompts to get most of it.

https://redd.it/1ds7dkv
@r_bash
New To Bash Scripting

I am an aspiring devOps Engineer and I have been using Linux for sometime now. I am currently in a BootCamp that just give tasks and asks students to go find solutions to it within a specific deadline.

I was tasked to write a bash noscript that does the following:

1. Creates Users and Groups of random users.

2. And also sets up home dirctories with appropriate permissions and ownership, generate random passwords for the users.

3. And also log all actions to the /var/log/user_management.log

4. And also store the generated passwords securely in /var/secure/user_passwords.txt

5. Ensure error handling for scenarios like existing users and provide clear documentation and comments within the noscript.

I am still new to this.

My question is do any one has any material or links to where I can learn quickly and do this task?

I can't find good materials or course within the short period given to me to submit the task.

https://redd.it/1dsk19t
@r_bash
VERY new to this, why is my directory '/' and not '~' when I run git bash?

As the noscript says, I am very new to this. I did a codecademy course learning the command line just yesterday, in that course, it says multiple times that in Git Bash, I would start in my '\~' (home) directory, but I actually start in the directory '/' (which is C:/Program Files/Git). I do however start in my home directory when I run Git Bash as an admin.

I'm a bit unsure as to why I start here,if it matters that I do start there, and how this effects my bash profile.

If someone could ELI5, that would be amazing.

https://redd.it/1dsvckd
@r_bash
Script Text Manipulation

I'm stumped on this one. I'm unsure how to approach taking the output from this command and put it into a list due to the formatting.

Command:
sudo so-elasticsearch-query _cat/shards | grep UN

Output:
.ds-metrics-elasticagent.filebeatinput-default-2024.06.27-000001 0 r UNASSIGNED                                 
.ds-metrics-windows.perfmon-default-2024.06.28-000002              0 r UNASSIGNED                                 
.ds-metrics-system.core-default-2024.06.27-000001                  0 r UNASSIGNED                                 
.ds-metrics-system.process-default-2024.06.27-000001               0 r UNASSIGNED                                 
.ds-metrics-system.fsstat-default-2024.06.27-000001                0 r UNASSIGNED                                 
.ds-metrics-system.memory-default-2024.06.27-000001                0 r UNASSIGNED                                 
.ds-metrics-elasticagent.filebeat-default-2024.06.27-000001       0 r UNASSIGNED                                 
.ds-metrics-system.network-default-2024.06.27-000001               0 r UNASSIGNED                                 
.ds-metrics-system.load-default-2024.06.27-000001                  0 r UNASSIGNED                                 
.ds-metrics-system.filesystem-default-2024.06.27-000001            0 r UNASSIGNED                                 
.ds-metrics-elastic
agent.elasticagent-default-2024.06.27-000001  0 r UNASSIGNED                                 
.ds-metrics-system.diskio-default-2024.06.27-000001                0 r UNASSIGNED                                 
.ds-metrics-windows.service-default-2024.06.27-000001              0 r UNASSIGNED                                 
.ds-metrics-system.uptime-default-2024.06.27-000001                0 r UNASSIGNED                                 
.ds-metrics-elastic
agent.metricbeat-default-2024.06.27-000001     0 r UNASSIGNED                                 
.ds-metrics-windows.perfmon-default-2024.06.27-000001              0 r UNASSIGNED                                 
.ds-metrics-system.process.summary-default-2024.06.27-000001       0 r UNASSIGNED                                 
.ds-metrics-system.cpu-default-2024.06.27-000001                   0 r UNASSIGNED                                 
.ds-metrics-elasticagent.osquerybeat-default-2024.06.27-000001    0 r UNASSIGNED                                 
.ds-metrics-system.socket
summary-default-2024.06.27-000001        0 r UNASSIGNED

As you can see, this is in an odd tabular output that makes it difficult to assign the filename to a variable (it can go to a file, too, I haven't decided yet).

Follow-up command uses the $index variable as a placeholder for the filenames. My goal is to automate this so that any of my techs can run this noscript without issue.

sudo so-elasticsearch-query $index/_settings -d '{"number_of_replicas":0}' -XPUT

How do I manipulate the output so I can use it?

https://redd.it/1dswlye
@r_bash
a Mathematics for Bash - and how that relates to AI, hopefully 🥸

TLDR: I have found a Mathematical way to build custom languages for AI applications using a mix of Bash and Python. below are examples, and here is the Mathematics: https://kamangir-public.s3.ca-central-1.amazonaws.com/giza-v1/giza.pdf this is very much a wip, \~6 years old, started on raspberry pi's. I think new Mathematical ways of making sense of AI are possible. this might be one step towards them.

---

here is an example,

vanwatch ingest help
vanwatch ingest area=vancouver,count=5,gif
@download open 2024-07-01-15-40-04-67778

https://preview.redd.it/cntempy9jz9d1.png?width=1946&format=png&auto=webp&s=c7df0769fac63ff8881391ac6610ecd480e2c7cc

https://i.redd.it/bcisse4plz9d1.gif

vanwatch lives in: https://github.com/kamangir/Vancouver-Watching and is (almost*) pip-installable: https://pypi.org/project/vancouver-watching/

* almost because this is wip, see my blog for the progress report and plans: https://arash-kamangir.medium.com/%EF%B8%8F-open-ai-experiments-121-298ff881cfa7

---

here is another example,

ukrainetimemap ingest help
ukraine
timemap ingest - - open

https://preview.redd.it/key6t9nwjz9d1.png?width=1946&format=png&auto=webp&s=8d971293312169c7a556b69881000208bf112c7c

ukraine_timemap lives in https://github.com/kamangir/blue-geo it ingests the latest data on civilian harm in Ukraine from Bellingcat: https://github.com/bellingcat/ukraine-timemap as well as other things and is pip-installable: https://pypi.org/project/blue-geo/

https://preview.redd.it/xyz1a64rjz9d1.png?width=1946&format=png&auto=webp&s=8a160cbba796a8a9e5830d99409802ad82fd1e75

https://preview.redd.it/4votxeusjz9d1.png?width=989&format=png&auto=webp&s=ef4168971bd2a68239718cffc46e9a62f4a0e414

https://preview.redd.it/zjpbjrn7nz9d1.png?width=2470&format=png&auto=webp&s=8438f6db51bb665ddc13632eb80e2ca5ad45a2b4

---

more here: https://github.com/kamangir

https://redd.it/1dt6wfz
@r_bash
Why is This If-Then Not Working as Expected?

I know that this is redundant, but it will be easier for me. Can someone tell me why the pattern match is not working correctly? I am trying to match against the EXACT pattern, but so long as there is AT LEAST the pattern in the argument, it evaluates matching.

eg... I am looking for EXACTLY 00:00, but if you put f00:00, that still qualifies as matching. How can I force the pattern to match EXACTLY as shown an NOTHING additional? I hope that makes sense.

#! /bin/bash

# ..........................
# noscript to call 'at' alarm
# ..........................

timePattern="0-90-9:0-90-9"
datePattern="0-90-9\.0-90-9\.0-90-90-90-9"
usage=0

if $# -eq 0
then usage=1
elif ! [ $1 =~ $timePattern ]
then
echo; echo "!! incorrect TIME format !!"
usage=1
elif ! [ $2 =~ $datePattern ]
then
echo; echo "!! incorrect DATE format !!"
usage=1
fi

if "$usage" = "1"
then
echo; echo "USAGE: setAlarm TIME DATE"
echo; echo "where TIME = hh:mm in 24-hour format"
echo " and DATE = dd.mm.yyyy"
echo
exit
fi

# echo DISPLAY=:0.0 vlc music/alarm.mp3 | at $1 $2

echo; echo "To show active alarms, use 'atq'"
echo "To remove active alarm, use 'atrm #', where # is shown using atq"
echo

https://redd.it/1dtax34
@r_bash
Quirk while getting pwd user info in prompt

Hey all, have had a setup in my PS1 which would display the current user and group owner of the current working directory, however when going in to get a list of my epubs found that if the pathname contains spaces it will break down. Stat sees the spaces as separation for different directories, attempted different ways of referencing the working directory to stat, have been trying different combinations of qoutes and backslashes at this bs, but hey probably some more clever people in this sub.

Just for context RANDPROMPTICON is an icon choosen randomly and dircol sets the color for the folder displaying before the current working directory.

# Fix for split name PS1="\${SEPDEND}${L_SEPERATOR}${SETDARK}  \u ${RANDPROMPTICON} \${SEPD2L}${R_SEPERATOR}${SETLIGHT}  \A ${SEPD2L}${L_SEPERATOR}\${SETDARK}󰒓 \j${SEPDEND}${R_SEPERATOR}\n\ ${SEPDEND}${L_SEPERATOR}${SETDARK}"'$(dircol)'" ${SETDARK}\w${SEPD2L}${R_SEPERATOR}\${SETLIGHT}"'$(stat -c "%U" .)'"${SEPL2D}${R_SEPERATOR}\${SETDARK}"'$(stat -c "%G" .)'"${SEPDEND}${R_SEPERATOR}${SETUNDO}\n\ ${SEPDEND}${L_SEPERATOR}${SETDARK} exec${SEPDEND}${R_SEPERATOR}${SETUNDO} "fi

https://redd.it/1du5adf
@r_bash
How to highlight my bash prompt, to colorize my terminal?

I'm trying to do customization to my terminal and I would like to use some power-fonts to do so, In order to get the desired affect I want the background of my bash prompt to be highlighted the same color as my terminal with black lettering--what would I set "PS1" to?

https://redd.it/1du572v
@r_bash