All Questions
60 questions
2
votes
1
answer
154
views
How to run python script on login
I am attempting to load a python script that launches a Firefox Geckodriver under Selenium whenever a specific kiosk user logs in to the GUI.
I've tried launching this via .profile, however ...
0
votes
0
answers
105
views
How to temporarily change locale for a gui-command?
If I try this suggestion with a gui-command like sudo LANG=en_US.UTF-8 partitionmanager, it's ends up with some confusing hints I can't get.
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/...
1
vote
1
answer
233
views
How do I move files to new folder based on timestamp dynamically without manually changing the script?
# Create a folder
mkdir archived_PA_2022-01_2022-06
# Move files to new folder
find ./ -newermt "2021-12-31" ! -newermt '2022-06-28' -exec mv /var/log/pentaho/PA –t archived_PA_2022-01_2022-...
2
votes
1
answer
920
views
How to resolve vulnerability CVE-2022-3715 for bash package in Debian 11.7?
I have built a Docker image with Debian 11.7, and I ran the Trivy Docker scanning tool. The report displayed a vulnerability, CVE-2022-3715, for the bash package.
As per this page, the issue is fixed ...
1
vote
1
answer
75
views
Script in /etc/profile.d/ is not being run on X login (debian)
The following script:
name='ILITEK ILITEK-TP'
echo 'running touchscreens' | systemd-cat
ids=$(xinput --list |awk -Fid= "/$name/"'{print $2+0}')
echo 'after xinput' | systemd-cat
for id in $...
1
vote
1
answer
49
views
file not found when executed but exec bit set and accessible by other commands
On my system I'm puzzled by a behaviour I cannot understand: Previously I did install an SDK in my user-local binary path and all the files are there. However bash returns "file not found" ...
2
votes
1
answer
230
views
Using HOME variable in crontab result in broken jobs
I have this crontab file with a lot (100+) of jobs that execute some commands in the same directory, suppose ~/Documents/. Instead of cd ~/Documents/ && <command> for every jobs, I can ...
0
votes
2
answers
1k
views
How to skip [sudo] password for USER?
I am having a random issue. I am having the same configuration for multiple servers, but only some of them are asking password from an excluded user:
Using username "a-u".
Authenticating ...
0
votes
1
answer
444
views
How can I make the git-prompt.sh's output (branch etc.) bold?
I use git-prompt.sh to customize bash's prompt with Git information, e.g. branch.
https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh
I want git-prompt.sh's output to be bold, ...
1
vote
1
answer
344
views
Check whether linux is utilizing service or systemctl with a shell script
friends!
I need a mechanism to verify if the linux virtual private server is utilizing systemctl or service.
The systemd application is installed on all of them.
Current Code.
if pgrep systemd-journal;...
1
vote
2
answers
2k
views
what are tty files for?
Can someone explain me what are the tty files?
I can't understand that, using the command : echo 1 > /dev/tty prints to my current terminal the output: 1, but if i try to use echo 1 > /dev/tty0 ...
4
votes
1
answer
889
views
How do I use the 'watch' command to enclose multiple commands that also have quotation marks(")? [duplicate]
I'd like to use the watch command to the following chain of commands:
journalctl | grep 'UFW BLOCK' | grep 'DST=192.168.0.2' | awk '{printf "%-4s%-3s%-10s%-1s%+16s\n", $1, $2, $3, $7, $11, $...
0
votes
1
answer
368
views
EtherCAT not found after full installation
I have been trying for the past few days to get the EtherCAT working with LinuxCNC, but my lack of knowledge about the Linux environment does not allow me to even start the project. I have all the ...
1
vote
1
answer
384
views
How can I get my script to work exactly like my terminal command?
tl;dr
The command git fetch origin [branch-name] is not working when invoked within a script, but works when invoked from shell.
Both script and terminal are working just fine on another box. The box ...
1
vote
2
answers
95
views
ping: ./ipsweep.sh.105: Name or service not known [closed]
#Code:
#!/bin/bash
for ip in `seq 100 110`; do
ping -c 1 $0.$ip | grep "64 bytes" | cut -d " " -f 4 | tr -d ":" &
done
#command:
./ipsweep.sh 192.168.0
#Result:
...
0
votes
2
answers
250
views
How to insert code before matched multi-line of code with sed?
I want to add this code
$cfg['Servers'][$i]['hide_db'] = '^(mysql|information_schema|performance_schema|phpmyadmin)$';
into phpMyAdmin's config.inc.php file before the line
/**
* End of servers ...
0
votes
1
answer
796
views
Problem is "too many arguments" [closed]
First of all, I will leave the code I wrote below, but I would like to tell you a problem I had before.
Problem 1 : I get the error "too many arguments" when I type any character and leave a ...
0
votes
0
answers
42
views
Whats the fasted bash alternate or implementation to generating random numbers by RANDOM? [duplicate]
Its looks like the follow RANDOM implementation are the fastest one:
my_random=RANDOM # 15 bit
echo $my_random
The follow other variants are know, but are much slower:
my_rnd=$((RANDOM<<15|...
0
votes
1
answer
587
views
Cannot make persistant Insertion of a kernel object (debian) using Insmod
I'm trying to insert the [.]Ko (Kernel Object) file for the on-board GPIO into my Linux kernel which succeeds using the command insmod < file-name.ko > But when the OS/Device Reboots, the kernel ...
10
votes
3
answers
5k
views
Strange empty bash_history-*.tmp files in my $HOME folder
There are exactly 169 empty .bash_history-*.tmp in my home folder that were created on the same day (April 16 2021) without my knowledge. Files have only read and write permission for the owner. I am ...
0
votes
2
answers
2k
views
How can I make registered extensions for `binfmt_misc` persist across reboots?
How can I make registered extensions for binfmt_misc persist across reboots?
Consider the following command, which performs a binfmt_misc registration:
echo ':golang:E::go::/tmp/test:OC' | sudo tee /...
0
votes
1
answer
135
views
emacs path replacement
I had a old version of emacs, I removed it and install a new one. For this new install I got a gz file, and compiled in my laptop. After a successful installation I got a small situation:
If I type: ...
3
votes
1
answer
373
views
How does `${!path//:/$'\n'}` perform parameter expansion to display $PATH with directories separated by newlines?
I have trouble understanding how ${!path//:/$'\n'} works in the shell function below.
I have looked in man bash and considered the use of ${parameter/pattern/string} to subsitute : with \n, but in ...
3
votes
3
answers
730
views
Is it possible to remotely clone a running/live OS?
I have an active OpenVPN/OpenSSH connection to a remote server. Is it possible to clone the remote OS, save it to a local file (e.g., with dd) and run it locally in VirtualBox or something similar?
9
votes
1
answer
9k
views
Create DNS query with Netcat or /dev/udp/
I'm trying to send a valid DNS request with either nc or bash and /dev/udp/.
I created a valid DNS packet to use as a template:
tcpdump -XX port 53
Then, in a new terminal made a request with curl:
...
1
vote
1
answer
308
views
Why isn't `inotifywatch --recursive /proc -v` able to see all created directories in `/proc`?
In one terminal I run the following command, which generates lots of directories in /proc over time:
$ while true; do /bin/echo helloworld | cat -; echo $$; sleep 3s; done
Then after several minutes, ...
0
votes
1
answer
223
views
Tmux: How can I use the identifiers in the paste buffer list to paste a specific buffer?
I use the C-b = command in Tmux to select a specific paste buffer from a list.
I wonder how I can use the identifiers (0),...,(9) and (M-a),...,(M-z) to directly paste specified buffer? Indeed, C-b ] ...
0
votes
1
answer
610
views
Why does storing a result from the pidof command result in 2 PID's but the command on its own results in the 1 PID?
This is on my Pi 4.
When I run the following:
#!/bin/bash
strScriptName=$(basename $BASH_SOURCE)
pidof -x "$strScriptName" | tr " " "\n"
pid=$(pidof -x "$strScriptName" | tr " " "\n")
echo $pid
...
1
vote
3
answers
184
views
Simple shell script unable to go through thousands of files; starts fine, but throws "unexpected EOF while looking for matching `"`" after some time
Shell Script in Question
Let me explain what I am trying to do by e.g. so you can understand better. Let's say I have 100 .torrent files in a directory. 2 of them will download xxx.epub and yyy.epub ...
1
vote
1
answer
600
views
how to query information from the /proc filesystem?
how would I begin to do this? I want to write a shell script file that would allow me to pull information from the proc filesystem. Information like PID, state of processes, etc...
a short code demo ...
0
votes
1
answer
780
views
Running a python script encapsulated in a bash function via cron
I have a python script that I've encapsulated in a bash function. I would like to be able to call this function as a cron job, but I cannot seem to get cron to execute it.
The function is as follows:
...
0
votes
1
answer
463
views
bash: cannot create temp file for here-document: No space left on device
While this may be the same question as others have asked with the same issue I am hoping someone can help me out regardless as I am out of my depth.
I have a Seedhost server with Swizzin installed ...
-2
votes
1
answer
2k
views
Is there a bash script to update the hosts file by retrieving a list from a website? [closed]
I'd like to use a bash script to automatically update my hosts file on Windows 10 using Windows Subsystem for Linux (Debian), by retrieving an online list (e.g. https://raw.githubusercontent.com/...
0
votes
0
answers
54
views
Why is "&" necessary to make a Unix fork bomb work? [duplicate]
Consider the canonical example of a Unix fork bomb:
DANGER: running the following command, might crash your system.
:(){ :|: & };:
I wonder why & (background) is needed in order to use up ...
1
vote
0
answers
73
views
Is it possible to ignore sub-directories and files when removing interactively using `rm -ri <dir>`?
Is it possible to ignore sub-directories and files when removing interactively using rm -ri <dir>?
I want to interactively remove directories/files specified on the command-line, especially ...
2
votes
1
answer
146
views
Various syntax errors when measuring the execution time of a script
Using Cygwin (W10) I've historically used this to measure the execution time within a script:
#!/bin/sh
(time {
sleep 1;
})
I've now moved to Debian (Windows Subsystem for Linux) and the same ...
1
vote
1
answer
2k
views
Bash replace special character '
All the questions and answers i already read are not my solution. So, all i want to do is to replace the special char ' in bash.
This works:
A="abc"
B="${A//[b]/x}"
But this does not work:
A="a'b"
...
2
votes
0
answers
71
views
bash script to output 15 lines or more of logs to a file if they occur in a 15 minute time frame
I am looking to create a script that will run daily via a cron job that:
output 15 lines or more of logs to a file if they occur in a 15 minute time frame and contain the keyword 'disconnects'
email ...
0
votes
1
answer
93
views
How can I copy a specific line to a specific folder? - Debian/Bash/Linux
I am trying to copy a specific line which is in a file, into a specific folder name.
And this folder must have the equal name than this line.
I have 3 folders :
/home/my_username/bin : which ...
0
votes
2
answers
320
views
Different command prompts for user and root
I'm using putty client in windows to connect to remote Debian 6 via SSH. If I login as root I have normal command prompt like root@ion:~# and command autocomplete works fine when press tab.
In case I ...
1
vote
1
answer
593
views
Autorestart program (script) when reconnecting to ppp0 with sakis3g, UMTSkeeper
I have a problem.
Hardware and software I'm using: Raspberry pi, 3G modem - Huawei e1550, sakis3g and UMTSkeeper to handle connection.
Also I'm using https://github.com/Lora-net/packet_forwarder for ...
4
votes
3
answers
2k
views
How do I work with "find" strings and special characters?
I am attempting to write some some bash shell script (for the first time) to perform a few sequential actions (some copy, encrypt, upload, and simple logic checks) and I am struggling to work with the ...
1
vote
2
answers
4k
views
Terminal keystroke / combination to skip just the current passage in a shell script execution
I often run bash scripts in debian and in general in linux.
We all know the CTRL + C key combination to break the current program and close the executable / script but this keystroke terminate the ...
2
votes
1
answer
1k
views
list files whose name meets 3 different criteria
Is it possible to achieve the following with a simple ls command using bash.
List all the files that begin with two letters, have an e in the name and end with 1 or more letter.
If so, what is the ...
3
votes
2
answers
1k
views
Is possible to overlay colored texts over the linux console like in this image? [closed]
I do a lot of bash scripts for various needs. Recently I started to feel the urge of implement various indicators on top of them.
Would be cool during an automated unattended installation script know ...
1
vote
3
answers
753
views
Get all files contains date value less than an input date
I have 1000's of files .txt files in a folder:
The ls output of the folder looks like:
2-20160329050200862185.instan-methodstack_2016-03-06-23.55.05.436-+0000_2016-09-07-05.31.47.105-+0000.txt
2-...
1
vote
2
answers
244
views
Script working manually but not in cron - not calculating var? [duplicate]
I am making a GFFS backup script for a school assignment but I've encountered some issues with it. It works like this:
/etc/backup/backup.sh PERIOD NUMBER
I have added the following lines in cron:
...
3
votes
2
answers
15k
views
Debian : Setting path for Node with root accessible globally
I have downloaded NodeJS setup and have it inside at /home/deploy/nodejs. I am trying to set its path, but it's not working out. I am logged in as root, and I would like to access nodejs and npm ...
2
votes
1
answer
164
views
Dropping a connection upon event
Is it possible to drop a number of connections when establishing new ones? For example, suppose we have a set of remote workstations with addresses {A, B, C} and another set with hosts {D, E}. We ...
8
votes
1
answer
270
views
How to best track adventures of a novice administrator
I have this user that has limited sudo privileges, yet he manages to screw up from time to time. I would like to keep an eye on his adventures, so that I can reverse any damage with less digging. ...