Questions tagged [linux]

NOTICE: All Linux questions must be related to programming; those that aren't will be closed. Use this tag only if your question relates to programming using Linux APIs or Linux-specific behavior, not just because you happen to run your code on Linux. If you need Linux support, you can try https://unix.stackexchange.com or the specific Linux distribution's Stack Exchange site like https://askubuntu.com or https://elementaryos.stackexchange.com/

linux
Filter by
Sorted by
Tagged with
1 vote
0 answers
98 views

How to store backslash+dollar-sign ("/$") in R?

I'm trying to generate a script using R. I want the script to include the following command: GPU0=$(nvidia-smi --query-gpu=utilization.gpu --format=csv,noheader,nounits | awk 'NR==1{print$1/100}') ...
clee165's user avatar
  • 39
0 votes
1 answer
468 views

Shell script to ls and execute command on ls result

I have a list of folders inside a folder in ubuntu. ie. Under /mnt/source/customcode/files/brands/ root@a919794ec280:/mnt/source/customcode/files/brands# ls -la total 236 drwxrwxrwx 19 1002 root ...
Sreekanth Sagar's user avatar
-1 votes
1 answer
46 views

What is the best ( ie fast and small ) was to atomic_fetch_ptr and atomic_set_ptr on GCC linux

there are a bunch of fast memory barrier atomic ops in GCC linux like __sync_fetch_and_and etc. I want to fetch and set a pointer value in memory so that it is guaranteed to be the value set when ...
peterk's user avatar
  • 5,312
16 votes
2 answers
12k views

Nasm - Symbol `printf' causes overflow in R_X86_64_PC32 relocation [duplicate]

I am trying to create a simple program in nasm that should display the letter a. however, It is giving me a Segfault and saying this: ./a.out: Symbol `printf' causes overflow in R_X86_64_PC32 ...
Unknown's user avatar
  • 181
1 vote
1 answer
49 views

Automagically detecting timezone from reliable system sources

I'm writing a CLI PHP script, and I want the log messages it'll display to contain the correct local time. This script will be being included in a small software release and run on different machines ...
i336_'s user avatar
  • 1,911
-1 votes
1 answer
31 views

Zipping the files

General Question . Example : In path: home/user/public_html/foldername foldername should be zipped . usually when we zip, zip file will be saved in the same path . Instead I want to zip to saved ...
Linux Geek's user avatar
0 votes
2 answers
1k views

Get Linux device IP address from com port using PowerShell

I am currently setting up a test ARM based board running Linux and I need to access it from a Windows machine. This test board is connected via the com port using a USB-to-Serial cable. I am using ...
Sudeep Mohanty's user avatar
0 votes
1 answer
150 views

[Linux | Cscore]avutil-55 DllNotFoundException

I am trying to run my application which uses cscore (https://github.com/filoe/cscore) and its sub namespace "CSCore.Ffmpeg" I've already tried what the author explained in "https://github.com/filoe/...
JKamsker's user avatar
  • 314
0 votes
1 answer
186 views

Cannot redirect python script output to infile

I am working on Debian Stable Linux which is otherwise working very well. I have following code in a python script file named "myrev" which works to reverse order of lines of given text file: #! /...
rnso's user avatar
  • 24.1k
-1 votes
1 answer
28 views

send the output of a file to a remote linux machine in one line

How can I send the output of this file to home directory of another Linux machine. Clearly, I want to send the output of this file: sed '/^\s*#/d;/^$/d' /etc/httpd/conf/httpd.conf To Home directory ...
Jones Doe's user avatar
1 vote
0 answers
238 views

Signal handler triggers on first time signal is raised, but not subsequent times

I'm fairly new to signals. It's an AF_INET socket, handling SIGIO. The first connection and packet are received and handled (displayed) properly, as far as I can tell. Subsequent sends are not, ...
user avatar
0 votes
2 answers
307 views

Terminal Linux - referencing executable file - No such file or directory

I'm not great in the terminal, and I can't figure out why its returning this. It's probably really obvious so apologies for asking, but the executable file I'm referencing is definitely in that file ...
BBKING's user avatar
  • 61
-1 votes
2 answers
331 views

Linux - How to add incremental numbers to the middle of a filename? [closed]

I've been seeing a ton of answers that show how to add to the beginning or end of a file, but I'm looking to replace numbers in the middle of a file. I have, for example: ShowName - S00E01 - Episode ...
user1324674's user avatar
1 vote
1 answer
3k views

Android SDK - aapt: error while loading shared libraries: libc++.so

I downloaded the sdk-tools linux-3859397.zip and extract it to /opt/android (which is my ANDROID_HOME) So, when I launch aapt it fail to load the libc++ shared library $ /opt/android/build-tools/27....
bioinfornatics's user avatar
0 votes
1 answer
1k views

Linux keyboard delay

So I want to build a kernel module (I suppose) which would insert little delay after a keyboard key is pressed (let's say 500ms). I managed to do this in Windows through hooks, but it seems to be ...
dclaudiud's user avatar
  • 324
6 votes
0 answers
902 views

Udev rule with ACTION=="add" not being triggered when device is already connected at boot

Here is my simple udev rule: ACTION=="add",SUBSYSTEM=="usb",DEVPATH=="/devices/pci0000:00/0000:00:14.0/usb3/3-13",RUN+="/opt/usb-libvirt-hotplug/usb-libvirt-hotplug.sh debian_testing" ACTION=="add",...
Vain's user avatar
  • 140
0 votes
0 answers
66 views

LAMP - PHP save files, but browser does not read

Images saved by PHP are linked to the www-data user, and therefore are not read by the browser unless I run it in ROOT mode. However, if I open a terminal and use CHOWN or CHMOD, I can solve this ...
Eibo - Sistemas Web's user avatar
1 vote
1 answer
3k views

Installation of DBI module in Perl facing issue

I have installed DBI module in Centos 7 server but whenever i am trying Connect to mysql through Perl script i am getting below ERROR as below please help on this install_driver(mysql) failed: Can't ...
BASAVARAJ JM's user avatar
1 vote
1 answer
4k views

cat html structure from .txt into <body> of .html file [duplicate]

I have looked across StackOverflow and haven't found an exact answer to my problem. I am no sed master so I would appreciate your help. I have 2 files: header.txt which contains the bootstrap ...
Matthew's user avatar
  • 129
0 votes
2 answers
524 views

How to edit and move a file from one directory to another in one line in Linux?

Happy new year. I have a question. I want to modify and move a file in /etc/ansible directory to my home directory in one shot. With sed command i removed the # and empty lines. Now I want to move ...
Jones Doe's user avatar
0 votes
1 answer
4k views

C fork and pipe multiple process

I'm trying to implement this command cat /etc/passwd | grep 1000 | cut -d: -f1 in C using system calls fork and pipe. When I use only two commands cmd1 | cmd2 so 1 fork it works fine but when I'm ...
taoufik A's user avatar
  • 1,469
0 votes
3 answers
86 views

giving a program the same input file 100 times

So I have this line-script: head -n5 numbers.txt | ./ex2-2 and I want ex2-2 to get as an input the first five lines of numbers.txt 100 times. ex2-2 is a program that gets as an input 1 2 3 4 5 1 2 ...
RedstoneHacker's user avatar
2 votes
2 answers
2k views

Finding a line that shows in a file only once

Assuming that I have files with 100 lines. There are a lot of lines that repeat themselves in the file, and only one line that does not. I want to find the line that shows only once. Is there a ...
דיויד דינסטון's user avatar
0 votes
0 answers
26 views

Linux script variable passing to next cronjob schedule

I wanted to know if there is possibility in Linux shell scripting where variable stored in first script execution ( cron job) can be passed to next cron job schedule For example : If my script store ...
Hari 's user avatar
0 votes
1 answer
995 views

The referenced column name has to be a primary key column on the target entity class

everyone. Happy new year! Today I am having problems trying to resolving this problem: Could not resolve type of column "id_usuario" of class "FacturadorVirtual\Modelos\Seguridad\Usuario" For some,...
manix's user avatar
  • 14.6k
0 votes
0 answers
654 views

semop stopped working, c, linux

I have a project called "a consumer and a producer". I need to use semaphores and shared memory to read signs (one by one) from the file and put them to shared memory (in producer.c) and after read ...
Zar's user avatar
  • 5
3 votes
1 answer
5k views

Understanding struct itimerval field tv_usec

Hi I'm studying this code: #include <signal.h> #include <stdio.h> #include <string.h> #include <sys/time.h> #include <unistd.h> #include <stdlib.h> #include <...
Zeno Raiser's user avatar
1 vote
1 answer
73 views

awk commands in file gives error when executed in loop

file_data.txt 73|8|42.320000|1559260800000|1|9667|0.00|42.320000||1485613678440| 153|8|35.680000|1559260800000|1|10899|0.00|35.680000||1482480306523| 2503|8|93.390000|1559260800000|1|6106|0.00|93....
Ashish's user avatar
  • 1,896
1 vote
0 answers
304 views

Can't pass out 3.5k req/s on AWS Varnish

I'm currently trying to deploy a Varnish on AWS. This varnish is intended to cache 1 file from S3 (only one file, less than 10kb), with a hit rate of 10k+ requests/s I've deployed my server on a m4....
Teddy Ferdinand's user avatar
1 vote
1 answer
231 views

Python/Pyglet on linux, script exits immediately

I am trying to start programming with pyglet on my lubuntu laptop. The script exits immediately. It shows a black window that disappears within 1 second. I don't see any errors. Am I doing anything ...
hennep's user avatar
  • 604
0 votes
1 answer
906 views

How might I implement Java like "interrupted exception" behaviour in C++11

In java calls that wait on things, time, IO, semphores, etc will throw an "InterruptedException" when the thread waiting for the operation to complete is "interrupted". Apparently the "SIGNAL"...
peterk's user avatar
  • 5,312
-1 votes
2 answers
3k views

Sending SIGINT to QProcess

I want to send SIGINT to a program started using QProcess. I am working on ubuntu. Source code of my process looks like this: #include <iostream> #include <csignal> #include <stdlib....
mkreddy's user avatar
  • 163
0 votes
1 answer
3k views

How to grep a string variable with spaces in a bash script [duplicate]

Solution: My date variables were in the wrong format (day number and day of the week were flipped). I changed this, then used the if statement proposed by @PesaThe below instead of my test. Original ...
Matt's user avatar
  • 9
0 votes
1 answer
459 views

linux python3 errors ; "OSError [Errno 98]" or "The kernel process exited. (0)"

I use python IDE named pyzo and using the miniconda interpreter. I imported flask_restful module. Imported modules are as below : from datetime import datetime import hashlib as hasher ...
Jay Cho's user avatar
  • 347
-3 votes
2 answers
44 views

What is the significance of this `java` command?

I have below command in one of my legacy script and I am struggling to understand it properly. Can anybody help me here? java -cp //applications/programs/myjar.jar:applications/programs/ojdbc14.zip ...
AbhiN's user avatar
  • 652
1 vote
2 answers
1k views

Starting a python shell with arguments

is it possible to pass arguments to the python in linux without having a file? I'm currently not able to create a file or change permissions and I don't want to write it inside my code like this: ...
Michael Koeppen's user avatar
0 votes
1 answer
278 views

Compare two files based on the condition using awk

I have two files: 1.txt: j_e_s_s_i_c_a_a_n_n [email protected] 61b8a203438ea1c56c1489ec7bea7a0e 9871951 [email protected] 671cb9239bf797a082f723a07a9c713f holliebrian [email protected] ...
Bhawan's user avatar
  • 2,471
2 votes
3 answers
1k views

Can we change SHELL env variable and interpreter after executing script

I have 2 questions: I have a script buildllt which uses #!/bin/sh. So, if I run the script using: /bin/bash buildllt. What shell interpreter will the OS use? sh or bash If after running the script ...
Haswell's user avatar
  • 1,602
0 votes
1 answer
1k views

Tools to test SSL performance

I'm trying to implement a TLS server with a custom engine (my server has a hardware accelerator). I want to test the performance of my server w/ wo the engine such as number of handshake per second, ...
DucTM31's user avatar
  • 89
0 votes
0 answers
676 views

C++ Socket (TCP) doesn't accept external connections on Windows but on Linux

i'm working on an simple network server example. It should accept TCP- and UDP-requests and answer with an asctime string. UDP is working whithout any issues. TCP makes some problems on windows. I ...
Ian's user avatar
  • 147
0 votes
2 answers
676 views

How to pass run time arguments to a function in c through a shell script

I have a shell script which has to take arguments from the command line and pass it to a function in C. I tried to search but didn't find understandable solutions. Kindly help me out. Should the ...
Apoorva R's user avatar
1 vote
2 answers
2k views

permission denied in apache configuration : [Errno 13] Permission denied [closed]

Im tring to host flask on apache2.4(ubuntu 16) using wsgi and but im facing 500 error in browser: Internal Server Error The server encountered an internal error or misconfiguration and was unable to ...
Kasra's user avatar
  • 796
0 votes
3 answers
2k views

Set an external variable in awk

I have written a script in which I want to count the number of columns in data.txt . My problem is I am unable to set the x in awk script. Any help would be highly appreciated. while read p; do x=1;...
Bhawan's user avatar
  • 2,471
1 vote
2 answers
7k views

How to reserve a tcp local port?

In my application, I bind a socket to the port 38614. While in test, I find sometime the port is used by another application. So I failed to bind on it and get the error, "Address already in use". ...
Forward's user avatar
  • 905
3 votes
1 answer
11k views

How to show python/openCV outcome images on ssh-client, not in ssh server?

I am connected to a ssh server using ssh -Y username@adress. On the server I run python2.7 using IDLE. If I use matplotlib I can see the outcome graphs on client. This suggests the graphical ...
user avatar
0 votes
0 answers
433 views

Unable to install mclust package in rstudio

I am having an issue when installing the "mclust" package on rstudio. Here is the warning message: >install.packages("mclust") trying URL 'https://cran.rstudio.com/src/contrib/mclust_5.4.tar.gz' ...
Apulu Ndotimi's user avatar
0 votes
0 answers
339 views

Bash shell script to add classpath if empty [duplicate]

I am new to Bash Scripting and would need help to make a simple script that I will run on my CentOS. I would like the script to check if classpath is empty like this: > [root@hdp ~]# echo $...
HumbleMan's user avatar
2 votes
1 answer
735 views

Can non-blocking system calls be interrupted?

I am reading The Linux Programming Interface which describes (in section 21.5) how a blocking system call can be interrupted by a signal. This seems to imply that a non-blocking system call cannot be ...
dippynark's user avatar
  • 2,913
0 votes
1 answer
47 views

Cron job unsuccessful

I am very new to Cron scheduling and Linux in general. I have created a Python code (Test_Analysis.py) that analyzes some data and generates an excel sheet which holds the results of the analysis. I ...
Anuj Nimkar's user avatar
0 votes
1 answer
3k views

Linux loading i2c drivers

I have linux 4.4 on my board. I also have two i2c devices with their driver. When I connect first device to board - i see in dmesg that _probe function called. When I don't connect any device to ...
user9161584's user avatar