I’m very curious if most people are simply using Ubuntu for the majority of Linux flavors out there for their Docker images or if they’re using others. Can you tell me if you are using Ubuntu and if not why..and what else are you using? Is Ubuntu the defacto flavor just in general? Answer Many peo…
Tag: linux
Reading tabular data from a line in bash [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 7 years ago. Improve this question I need to check if the pin that user gives exists and if exists then display their names and…
Running a shell script for a certain duration
I want to be able to run a script on Linux shell (bash) for a certain duration and sleep for a different duration. I’ve written something like the following snippet. However, I see only the sleep happening correctly but the execution stops after first execution. The response I get is ./script.sh: line 3…
Parsing parameters with zparseopts, but from within a sourced script
I have a zsh script myscr.zsh, which sources another script zparse.zsh, like this: zparse.zsh expects a variable number of parameters, which do NOT need to be parsed using zparseopt, but zparse.zsh should – among other things – parse the positional parameters passed to mysrc.zsh. This is tricky, s…
Root autentication on a Python program
I have the root password saved in a variable. How I can give the root authorization at my program? This can be an example: Answer It is impossible to do it in the way you try. Your program is already started under some non-root user and you cannot change it inside this program. You can spawn other process whi…
zsh parameter expansion syntax: combining default value and conversion to upper case
In a zsh script, outputs the value of the variable X, or 4711 if there is none. outputs the value of the variable X, converted to upper case. I wonder, whether there is a way to combine the two, i.e. to have the effect of without introducing an auxiliary variable. Answer From man zshexpn: If a `${…}` ty…
SED : Remove last four characters from filename
I had list of files in the folder named test_images as below i want to rename all file by removing last four characters from each of them as How can i do it using sed ? Any suggestion will be appreciated. Thanks in advance 🙂 Answer if your file names don’t have spaces, you can: (under your test_images d…
Retrieving the memory map of its own process in QNX
In Linux if we look at the /proc/self/maps: I want information like pathname and starting address for Qnx. How can I get that information? My analysis says that there is not /proc/self/maps file in Qnx. Answer We have self file in QNX too !! The address space is represented by a binary file called “as&#…
Linux Command to list all users by uid
I am using RedHat Linux 6. I need redhat Linux terminal code to list all the users above uid=499? i already tried “cat /etc/passwd”. but it shows all users. how do i filter it? Answer You can use awk to parse the passwd database for the UIDs you want. To list all the users for UIDs strictly greate…
Remove folder structure (parents only) using ZIP command in PHP
I want to create a zip of all files in X folder with the name filename.zip using following command in php like: exec(zip -r “./Zips/filename.zip” “./Uploads/Data/X/”) but the created zip has the folder structure Uploads/Data/X. Please help me to get rid of these parent folders – …