Skip to main content
Filter by
Sorted by
Tagged with
339 votes
4 answers
193k views

Should or should I not wrap quotes around variables in a shell script? For example, is the following correct: xdg-open $URL [ $? -eq 2 ] or xdg-open "$URL" [ "$?" -eq "2"...
Cristian's user avatar
  • 7,227
76 votes
1 answer
20k views

int 0x80 on Linux always invokes the 32-bit ABI, regardless of what mode it's called from: args in ebx, ecx, ... and syscall numbers from /usr/include/asm/unistd_32.h. (Or crashes on 64-bit kernels ...
Peter Cordes's user avatar
52 votes
1 answer
22k views

64 bit Linux uses the small memory model by default, which puts all code and static data below the 2GB address limit. This makes sure that you can use 32-bit absolute addresses. Older versions of gcc ...
A Fog's user avatar
  • 4,674
462 votes
11 answers
554k views

I'm launching a subprocess with the following command: p = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True) However, when I try to kill using: p.terminate() or p.kill() The command keeps ...
user175259's user avatar
  • 4,999
106 votes
8 answers
54k views

Since printf is not reentrant, it's not supposed to be safe to use it in a signal handler. But I've seen lots of example codes that uses printf this way. So my question is: when do we need to avoid ...
Yu Hao's user avatar
  • 123k
2199 votes
19 answers
3.0m views

How do I iterate through each line of a text file with Bash? With this script: echo "Start!" for p in (peptides.txt) do echo "${p}" done I get this output on the screen: Start! ./runPep.sh: ...
Peter Mortensen's user avatar
144 votes
3 answers
101k views

Time and time again, I see Bash answers on Stack Overflow using eval and the answers get bashed, pun intended, for the use of such an "evil" construct. Why is eval so evil? If eval can't be used ...
Zenexer's user avatar
  • 19.8k
840 votes
33 answers
778k views

I'm trying to write a small script to change the current directory to my project directory: #!/bin/bash cd /home/tree/projects/java I saved this file as proj, added execute permission with chmod, and ...
ashokgelal's user avatar
  • 81.7k
14 votes
2 answers
4k views

When compiling below code: global main extern printf, scanf section .data msg: db "Enter a number: ",10,0 format:db "%d",0 section .bss number resb 4 section .text main: mov rdi, msg ...
user3057544's user avatar
219 votes
6 answers
114k views

For my application, the memory used by the Java process is much more than the heap size. The system where the containers are running starts to have memory problem because the container is taking much ...
Nicolas Henneaux's user avatar
14 votes
2 answers
18k views

Please see MSO question A long list of possible duplicates — C memory allocation and overrunning bounds for information about closely related questions. Developer environment: CentOS 4.7, Kdevelop 3.1....
HS.'s user avatar
  • 469
1112 votes
24 answers
2.2m views

On Linux, how can I add a directory to the $PATH so it remains persistent across different sessions? Background I'm trying to add a directory to my path so it will always be in my Linux path. I've ...
Ali's user avatar
  • 268k
8 votes
2 answers
13k views

The Python standard library's socket.create_connection()method has a source address option, for controlling which source IP a connection uses. How do I do the same thing with a Python ZeroMQ socket,...
ceridwen's user avatar
  • 560
400 votes
9 answers
424k views

I want to use subprocess.check_output() with ps -A | grep 'process_name'. I tried various solutions but so far nothing worked. Can someone guide me how to do it?
zuberuber's user avatar
  • 4,121
618 votes
7 answers
536k views

When I use any command with sudo the environment variables are not there. For example after setting HTTP_PROXY the command wget works fine without sudo. However if I type sudo wget it says it can't ...
Ahmed Aswani's user avatar
  • 8,747
244 votes
16 answers
151k views

It seems to me that Linux has it easy with /proc/self/exe. But I'd like to know if there is a convenient way to find the current application's directory in C/C++ with cross-platform interfaces. I've ...
Uros Dimitrijevic's user avatar
181 votes
2 answers
578k views

I am a little bit confused about reading and writing to a serial port. I have a USB device in Linux that uses the FTDI USB serial device converter driver. When I plug it in, it creates: /dev/ttyUSB1. ...
gnychis's user avatar
  • 7,605
378 votes
22 answers
1.7m views

I am having trouble compiling and running my Java code, intended to allow me to interface Java with a shared object for Vensim, a simulation modeling package. The following code compiles without ...
Dave's user avatar
  • 3,819
908 votes
33 answers
1.0m views

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 get ...
Vicky's user avatar
  • 17.5k
9 votes
2 answers
3k views

I frequently run a simple bash command: rpm -Uvh --define "_transaction_color 3" myPackage.rpm which works properly. But now I'm trying to script it into a bash file, and make it more flexible: #!/...
abelenky's user avatar
  • 65k
183 votes
15 answers
249k views

I'm trying to get cron to call in the correct PATHs. When I run a Python script from shell the script runs fine as it uses the PATHs set in bashrc but when I use cron all the PATHs are not used from ...
chrisg's user avatar
  • 41.8k
1147 votes
15 answers
366k views

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 ...
Jonathan's user avatar
  • 26.7k
540 votes
30 answers
1.1m views

I am trying to compile some sources using a makefile. In the makefile there is a bunch of commands that need to be ran as sudo. When I compile the sources from a terminal all goes fine and the make ...
feeling_lonely's user avatar
308 votes
18 answers
552k views

What is the maximum number of threads that can be created by a process under Linux? How (if possible) can this value be modified?
user avatar
547 votes
16 answers
994k views

I picked up the following demo off the web from https://computing.llnl.gov/tutorials/pthreads/ #include <pthread.h> #include <stdio.h> #define NUM_THREADS 5 void *PrintHello(void *...
Ralph's user avatar
  • 6,399

1
2 3 4 5
475