How do I use sudo to redirect output to a location I don't have permission to write to?

I've been given sudo access on one of our development RedHat linux boxes, and I seem to find myself quite often needing to redirect output to a location I don't normally have write access to. The...

Get the IP address of the machine

This Question is almost the same as the previously asked Get the IP Address of local computer-Question. However I need to find the IP address(es) of a Linux Machine. So: How do I -...

What killed my process and why?

My application runs as a background process on Linux. It is currently started at the command line in a Terminal window. Recently a user was executing the application for a while and it died...

Memory usage of current process in C

I need to get the memory usage of the current process in C. Can someone offer a code sample of how to do this on a Linux platform? I'm aware of the cat /proc/<your pid>/status method of getting...

What characters are forbidden in Windows and Linux directory names?

I know that / is illegal in Linux, and the following are illegal in Windows (I think) * . " / \ [ ] : ; | , What else am I missing? I need a comprehensive guide, however, and one that takes into...

How can I convert a file pointer ( FILE* fp ) to a file descriptor (int fd)?

I have a FILE *, returned by a call to fopen(). I need to get a file descriptor from it, to make calls like fsync(fd) on it. What's the function to get a file descriptor from a file pointer?

Detecting 64bit compile in C

is there a C macro or some kind of way that i can check if my c program was compiled as 64bit or 32bit at compile time in C? Compiler: GCC Operating systems that i need to do the checks on:...

How to extract duration time from ffmpeg output?

To get a lot of information about a media file one can do ffmpeg -i <filename> where it will output a lot of lines, one in particular Duration: 00:08:07.98, start: 0.000000, bitrate: 2080...

OS specific instructions in CMAKE: How to?

I am a beginner to CMAKE. Below is a simple cmake file which works well in mingw environment windows. The problem is clearly with target_link_libraries() function of CMAKE where I am linking...

Argument list too long error for rm, cp, mv commands

I have several hundred PDFs under a directory in UNIX. The names of the PDFs are really long (approx. 60 chars). When I try to delete all PDFs together using the following command: rm -f *.pdf I...

bash how to close /dev/tty?

I want my interactive bash to run a program that will ultimately do things like: echo Error: foobar >/dev/tty and in another(python) component tries to prompt for and read a password from...

bash script read pipe or argument

I want my script to read a string either from stdin , if it's piped, or from an argument. So first i want to check if some text is piped and if not it should use an argument as input. My code...

What is the time complexity of reading a file from a Linux filesystem?

Suppose I have a very large number of directories (say 100.000) in my filesystem and inside each directory there is a similar number of directories. Each directory can contain any number of files,...

Shell script to copy and prepend folder name to files from multiple subdirectories

I have several folders with different images sharing file names, with a folder structure like...

Non-Emulated Prepared Statement support from MS SQL Server through PHP on Linux

Summary I'm attempting to use prepared statements to stop SQL Injections, but am unable to find the support I need to guarantee it is working properly. Scenario I am hosting a site on Linux which...

Linux gretap - net/ipv4/ip_gre.c - how to set value of key->tun_flags

I'm trying to transport over a gretap tunnel between two Linux (Centos 6) hosts some cloned IP pkts in order to feed an IDS style device. Given that PMTU discovery will not work on the cloned pkts...

How to use local docker images with Minikube?

I have several docker images that I want to use with minikube. I don't want to first have to upload and then download the same image instead of just using the local image directly. How do I do...

How to stop backspace from appearing in nCurses using C?

I am currently writing an ncurses shell and in order to read input it is important to read it character by character and hence I am using the mvwgetch command. And incrementing a counter as it...

XDG Basedir directories for Windows

I have made a Racket library for convenience in accessing the XDG Basedir directories. As I want the library to be useable on Windows as well (for cross-platform programs), I have it use standard...

using pip3: module "importlib._bootstrap" has no attribute "SourceFileLoader"

I have installed pip for python 3.6 on Ubuntu 14. After I run sudo apt-get install python3-pip to install pip3, it works very well. However, after installation, when I am trying to run pip3...

How to get supervisorctl status of processes?

I have supervisorctl running with about 50 processes. Now I want to get the status of these processes on my website. My idea is to use on php exec(“sudo supervisorctl status”) and set the...

SessionNotCreatedException: Unable to create new service: GeckoDriverService

I'm using: Java 1.8 Selenium 3.5.0 Selenium Standalone Server 3.5.0 OS for selenium hub - RHEL 7 Geckodriver 18 Firefox 55 I have an error: org.openqa.selenium.SessionNotCreatedException:...

testing with xvfb virtual display starting from CRON - missing keyboard device

I am trying to run test software using CRON on a RHEL machine. The testing software requires display, so I think the only option is to use xvfb. So I am starting it using xvfb-run wrapper, which...

Change exit code on a single line using Bash?

I am using the savscan command but this returns 3 instead of 1 when a malware is detected, and I need to get 1 if a malware is detected, I tried the following: $ bash -c "savscan -f -archive...

Kubernetes Pods Terminated - Exit Code 137

I need some advise on an issue I am facing with k8s 1.14 and running gitlab pipelines on it. Many jobs are throwing up exit code 137 errors and I found that it means that the container is being...

how xdp ebpf change checksum tcphdr after update dest port

how xdp ebpf change checksum tcphdr after update dest port ? // Check tcp header size struct tcphdr *tcph = data + nh_off; nh_off += sizeof(struct tcphdr); if (data + nh_off > data_end) { ...

How do I deal with an internal compiler error (cc1plus: gimplify) when installing c based python libraries (OpenCV2) on a Raspberry PI?

I've been trying to install the OpenCV2 libraries for Python 3 on my Raspberry PI 3B. I started this process by installing Python 3 through apt and using pip3 to install OpenCV. However the...

systemd error with user having a dot (.) in name: Invalid user/group name or numeric ID

Linux Ubuntu 18. MariaDB 10.3. MariaDB service fails to start throwing a systemd error. The reason seems to be that the userid contains a dot (.). systemd[1]: Invalid user/group name or numeric...

Can't install python package on Alpine docker anymore

I have a problem that started very recently, Docker Alpine python library is not installable anymore: apk update && apk upgrade && apk add python fetch...

Cannot use Python 3.10 as interpreter on Pycharm

I have python3.10 installed but I cannot set it as an interpreter. The installation can be confirmed by calling python3.10 directly on the terminal, and with the command below: $ ls -ls...