Skip to content

Tag: linux

Replacing line of text cointing using sed

I’m trying to replace document.querySelector(‘.popup’).classList.add(‘active’) by document.querySelector(‘.popup’).classList.add(‘noactive’) Answer You can use See the online demo. The regex is POSIX BRE compliant and matches (document.querySelector(&#8216…

How to create file with folders for all users in home directory

So for example we have 4 users in /home directory: What I am trying to achieve is that I create directories with files inside for all these users. For one user I can try something like: mkdir -p /home/user/dir/anotherdir && touch /home/user/dir/anotherdir/somefile. But I want a dynamic solution when I…

How to list all concurrent python processes in my CLI?

I have opened several terminals in parallel: And in two of those terminals, I have launched a python file, which includes iterations, to keep the process running. And I would like to have the list of all python processes running. When I type: $ ps -ef | grep python or $ps -elf | grep python I only get the cur…

Why cant I get mv to rename and copy file?

The last thing I want to do in this script is take the userinput to rename the corresponding files to include .bak extension rather then .txt which will copy into a backup directory. I keep receiving an error messaging saying e.g. The snippet in question (right at the bottom of full code): Full code: Answer T…