Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
-3 votes
1 answer
78 views

script does not work

I can successfully execute this command from the terminal: sudo cp -R -u "/media/gabriela/Windows/Data/Untitled Folder" /media/gabriela/USB But the following script does not work, with the ...
Gabriela Remow's user avatar
-1 votes
0 answers
29 views

My clickable .sh shell script keeps opening in text editor and does not run the command when clicked [duplicate]

I am trying to write a script that when clicked runs commands. For example: "open browser and go to website" etc. etc. Here is what I have done: I have ran chmod +x test.sh on the file I ...
F41k0r's user avatar
  • 1
-1 votes
0 answers
31 views

Make shell script output correctly [duplicate]

I am trying to run a shell script to get the PID details and sort them based on memory, while executing in the server. I am getting correct output like this: [inda@jump-server ~]$ ps -eo pid,ppid,cmd,%...
Hari's user avatar
  • 1
-1 votes
0 answers
51 views

Top command - 100% cpu

I've been using a script to create a log based from information i can get in top and then report when my app is using too much resources, to retrieve the cpu usage i take the entire line %Cpu(s): 13.6 ...
Cesar Chavana's user avatar
6 votes
1 answer
707 views

Should I use the "time" keyword, the "/usr/bin/time" command or the "times" builtin to time the execution of commands in bash?

I have been delving into bash for the first time and want to try to test some code to compare different ways of achieving the same end. As part of this I have come across the time and times methods of ...
dmkonlinux's user avatar
0 votes
0 answers
47 views

Setting prompt using PS1 in a script puts cursor at beginning of line

I want to set the title and prompt in a command line window using the following command: PS1='\[\e]0;deploy\a\]\[\e[1;32m\]\u@\h\[\e[0m\]:\[\e[1;34m\]\w\[\e[0m\]\$ ' If it is entered interactively, ...
robin's user avatar
  • 1
-1 votes
1 answer
53 views

Re-write a zsh_lf snippet to work in zellij instead of tmux

I am trying to rewrite the code below (source): _zlf() { emulate -L zsh local d=$(mktemp -d) || return 1 { mkfifo -m 600 $d/fifo || return 1 tmux split -bf zsh -c "...
Muzzamil's user avatar
  • 101
0 votes
2 answers
89 views

How to execute scripts from a samba drive (cifs mounted)?

If I'm starting a shell script "test.sh" from a samba share, I've got an error: bash: ./test.sh: /bin/sh: Defekter Interpreter: Eingabe-/Ausgabefehler (bash: ./test.sh: /bin/sh: bad ...
dschoni's user avatar
  • 97
0 votes
1 answer
73 views

Bash script not launching correctly

Right now I am working on a project for which there is a custom conda environment. I created the environment and the project works, so I created a bash script to activate the conda environment, launch ...
Samuel Kostadinov's user avatar
-1 votes
2 answers
100 views

I in linux system I geting many same exported path variable

In my ubuntu system I getting same env variable many times This is the output of echo $PATH | tr ':' '\n' | less command in zsh shell /opt/some/bin <<< /Users/pritam/Developer/system_script /...
Pritam's user avatar
  • 1
3 votes
1 answer
336 views

Is there a way to know if a file was copied?

I'm using Ubuntu 22.04, and I'm making a bash program (script) to run scripts at startup, shutdown and/or reboot. These things are sensitive and, if poorly done, it could be dangerous for the user/pc, ...
Carlos González's user avatar
0 votes
1 answer
420 views

Getting Error in shell script "unexpected EOF while looking for matching `''"

I wrote a simple shell script in /bin/sh and getting the issue below. /tmp/a.sh: line 14: unexpected EOF while looking for matching `'' /tmp/a.sh: line 17: syntax error: unexpected end of file *******...
Atul Jain's user avatar
0 votes
0 answers
20 views

Shell script doesn't recognize Python even after setting its path [duplicate]

I'm having trouble calling Python code from a shell script on Ubuntu. First of all, I confirm that Python is installed: username@Ubuntu22:~/Documents/Script$ python Python 3.10.12 (main, Nov 20 2023, ...
Ogiad's user avatar
  • 1
2 votes
2 answers
583 views

How to replace a file path with whitespace using sed?

I have many different files with a string in them. I need to replace this string with a path, although the path contains whitespace. So far, I have this: for a in files_[a-z][a-z]_all\.conf ; do ...
Spaghetti's user avatar
0 votes
0 answers
74 views

set: pipefail failing on WSL windows

I cloned this repo on WSL2 https://github.com/apache/airflow/blob/main/dev/breeze/doc/01_installation.rst#docker-in-wsl-2 and tried to build a docker image that uses also this script https://github....
criss's user avatar
  • 1
0 votes
0 answers
109 views

How to start a named background process when using bash?

I have a script that looks like this: #!/bin/bash tsx watch services/$1/src/index.ts This will start tsc for the given service: script/start_service some-service If I add & the end it gets ...
Adam Arold's user avatar
0 votes
0 answers
77 views

How to find the Disconnected Xrdp sessions?

I'm using Ubuntu 22.04 with Xrdp enabled. I need a list of disconnected sessions (Users can often use the "X" to close the RDP session (therefore disconnect but not logout)). I went through ...
SIVA KUMAR KALLURI's user avatar
0 votes
0 answers
44 views

here file does not fill token

I use a certain command quite frequently, but the command prompts a few things so I wanted to auto-fill it with here file, but it seems that for some reason it can't provide last value to the prompt. ...
Bartosz Wichowski's user avatar
0 votes
2 answers
245 views

How to write a bash script from two commands (Find and replace a text string in all files recursively in current directory)

On Ubuntu Server, I use two different commands to find and replace a string in all files recursively in the current folder. The first command is: sudo find . -type f -print0 |\ xargs -0 -r sudo ...
DanRan's user avatar
  • 113
1 vote
0 answers
47 views

How to add my own shell script to be able to be autocompleted in terminal by Tab

I have bunch of shell script (.sh) command created in a folder ~/bin, I added this path to .bashrc so I can execute them wherever I like. i.e. a sample command to create git feature branch based off ...
Dreamer's user avatar
  • 111
0 votes
0 answers
100 views

How can I run different commands in separate terminals using a shell script?

I have access to an Azure VM where I intend to run three Hyperledger Besu nodes: one boot node and two validator nodes. To automate this setup, I've created a shell script. First, I checked the ...
Shalabh Negi's user avatar
0 votes
1 answer
88 views

Backporting: Does anyone have a function to mimic bash 4 associative array?

I need to make changes in my script that uses associative array, so that the script may be used in older versions (before v4.0) of bash which did not support associative array. Can someone suggest how ...
rusty's user avatar
  • 16.4k
1 vote
1 answer
204 views

Problem writing udev script to disable onboard network card

I'm trying to disable a faulty onboard network card with the solution suggested in this answer: https://unix.stackexchange.com/a/467085 . But for some reasons, the script/commands are unable to write ...
rusty's user avatar
  • 16.4k
0 votes
0 answers
20 views

Bash script for executing linux commands on remote machines using ssh key [duplicate]

I want to run a script to get details of hardwares and user details from multiple remote machines by login using ssh private key. this is my script #!/bin/bash # Check if the user provided a file if [...
Subash's user avatar
  • 66
0 votes
1 answer
128 views

sed mongodb connection string copying multiple times in env variable through github action

this is command which i run in github action its copying into .env.production file sed -i "s#DB_URI=.*$#DB_URI=mongodb+srv://xxxxxx:[email protected]....
DevOPs's user avatar
  • 11
0 votes
2 answers
303 views

Setting DEBIAN_FRONTEND remotely

Is there any way to set DEBIAN_FRONTEND=noninteractive when executing a script remotely via SSH? Doing so I get this error: sudo: sorry, you are not allowed to set the following environment variables: ...
Socrates's user avatar
  • 2,513
0 votes
2 answers
90 views

How to monitor particular command or add extra functions to it?

I am attempting to implement mobile push notifications (utilizing the Docker ntfy service) for scenarios such as automatic system updates and Timeshift snapshot creation. None of these commands are ...
zawier's user avatar
  • 13
0 votes
0 answers
151 views

How to run password with sudo command using php?

Below is the example, I was trying to execute the command using PHP function. Not getting any error or not happen anything after execute this code. $siteConfig = <<<EOL server { listen 80;...
Urvin Sanghavi's user avatar
0 votes
0 answers
147 views

I need to run a script during first boot and want the CLI to open for possible input

Edit: I need a bit more explaining here. This is a one time only run personalization script for the computers that I have set up that I would like to run only on the first boot. After tweaking the ...
BuddyBoy's user avatar
0 votes
0 answers
98 views

Ubuntu Core - Startup Interactive Script

I have a fully supported device which I boot using an Ubuntu 22 Desktop image and "Try" it. Then I run the xzcat / dd commands to flash Ubuntu Core 22 onto the disk. Then I restart the ...
Pasha Siraja's user avatar
1 vote
0 answers
2k views

How to reload .bashrc settings without logging out and back in again?

I created a script that add's the below commands to the .bashrc file. The purpose is I need to store the commands entered by the user into the .bash_history. The below commands are adding to .bashrc ...
SIVA KUMAR KALLURI's user avatar
0 votes
1 answer
259 views

How to make my script that has a timer to shutdown my machine work?

I have script to shutdown my computer after 2 minutes, and 1 minute before shutdown it sends a notification that says "It will shutdown after 1 minute". The script will be executed on click ...
Web Developer's user avatar
0 votes
0 answers
39 views

How to batch rename a bunch of files of same type inside folders to that the numbers in the name are inside brackets? via terminal

Ubuntu 20.04 I have files stored in the following fashion as a example: Uni - Biology - 01122023 Class 01 - subj dfsg.txt 02122023 Class 02 - subj eweg.txt 03122023 Class 03 - subj ewq.txt ...
Kaikidan's user avatar
-3 votes
1 answer
262 views

Auto Script Generator

I want to generate a script for hard disk partitions #!/bin/bash # Check if blkid is installed command -v blkid > /dev/null 2>&1 || { echo >&2 "blkid is required but not ...
Mohsin Rao's user avatar
1 vote
2 answers
384 views

How to make script work to set IP address of ethernet adapter?

On Ubuntu 22.04 I have the following script #!/bin/bash INTERFACE="enx00e04c681730" echo "Interface: $INTERFACE set to IP $1" ifconfig $INTERFACE down ifconfig $INTERFACE $1 ...
Alex's user avatar
  • 865
6 votes
2 answers
343 views

Find duplicate case insensitive filenames in all folders and sub-folders

I have about 250,000 files in several folders with sub-folders. Looking for a solution how to find duplicate filenames in all folders and their sub-folders. My OS is Ubuntu 22.04, using bash. I prefer ...
sotirov's user avatar
  • 3,663
1 vote
1 answer
81 views

Dolphin context menu exec command, cp will duplicate selected folder if already copied

So I'm trying to automate some tasks and I'm making some dolphin ServiceMenus. Exec=for file in %f; do new_path=$(echo "$file" | sed "s|^/home/$(whoami)||"); mkdir -p ~/Dropbox/....
mioufts's user avatar
  • 11
0 votes
1 answer
122 views

How can I create my own app package?

I will give an example: There is .deb, .appimage, flatpak, snap, AUR, etc, but I want to create my own (Example app.fictionalpackage) Maybe zipping a folder with files inside and renaming ".zip&...
Felipecconde's user avatar
1 vote
0 answers
64 views

Assigning a certain amount of CPU power to a script

I use the time command in a script to calculate the runtime. But sometimes gzip -4 file is done in less time than gzip -1 file Why is this happening؟ How can I make the CPU power level the same at ...
fsgdfgdfgd's user avatar
0 votes
0 answers
64 views

In xfce4, how do I change to a left-handed mouse on the command line?

I change mouse hands often. It's easy to swap the buttons through xfce4-mouse-settings, but I'd like to script it or set it from the command line. Something like: xfce4-mouse-settings --device=usb --...
John Lawrence Aspden's user avatar
-3 votes
1 answer
81 views

Want to execute a script irrespective of the directory where this script is present or html file is present

Actually my script is present under the path /home/user/bin/script.sh and when I run the above script named as script.sh, the script will show html file in Firefox web page. But the problem here is ...
Ashwini Gajarla's user avatar
0 votes
1 answer
92 views

Shell Script Producing Strange File Type with Interpunct [duplicate]

I am new to Linux - trying to run a set of commands using a shell script. The commands are from the Neper software package but I am pretty certain the issue is with permissions of my shell script. ...
foraps2's user avatar
0 votes
1 answer
117 views

Need help with beginner bash script

Im writing a script that prompts the user to pick one of three choices, depending on the choice the prompt should echo back a line. "!/bin/bash first=chocolate second=vanilla third=strawberry ...
Edward's user avatar
  • 1
-1 votes
2 answers
172 views

ask user to enter input such as their age and save it to a variable

Im trying to make a simple bash script work as a beginner exercise where im asking a user to enter their age and the script should echo depending on their input "You are old" or "you ...
Edward's user avatar
  • 1
1 vote
1 answer
150 views

Help needed for finding the script for moving and naming tv folders to tv folders compatible with emby

I need help I don't know how to do it at all. I have some older tv series which have mostly for each tv episode own folder and for some with the season folder. I will list the examples below. ...
Loop1's user avatar
  • 13
0 votes
2 answers
67 views

Bash function that checks if string argument is a name of existing (set) or not existing (unset) variable

I would like to write a bash function in Ubuntu 22.04 that works like that Var1=100 is_variable_set "Var1" //Returns 0 (variable exists ie is set) unset Var1 is_variable_set "Var1&...
keldorn's user avatar
  • 113
0 votes
1 answer
129 views

I have a simple script that ask for my pass when it shouldn't

I have this simple script /home/myuser/startup.sh #!/bin/bash # sin le pongo -x al final va tirando por pantalla todo lo que hace echo "Finding PIDs of mysql processes..." mysql_pid=$(sudo ...
elunicotomas's user avatar
0 votes
0 answers
92 views

How to copy an existing specific file in a directory into a newly created subdirectory from command prompt using shell script

I'm having a little issues trying to make a copy of a pre-existing file (specifically java) from the current directory to a subdirectory (and some copies to its subdirectory and so on depending on the ...
Casey Collins's user avatar
0 votes
1 answer
102 views

How to change directory to a filename with spaces within a loop

I'm not sure how to go about this, but I've been trying to loop through different directories to make a number of files. Example: In the current directory, there are 3 directories: Roman Empire Casa ...
Casey Collins's user avatar
0 votes
1 answer
345 views

How to use variable in Find and grep command?

find command to get files have part of their names as date ($Y variable that has date in the script) Y=(date -d "1 day ago" "+%Y-%m-%d") find /log/bssuser/CDR/Postpaid_CDR_Log/ -...
Amany Abd Elmnem's user avatar

1
2 3 4 5
55