New answers tagged linux
Score of 0
0
votes
Split file into unequal chunks in Linux
A simple way:
Say you know the total size and want to split at a specific byte offset (N), giving part1 (0 to N-1) and part2 (N to end). Pure bash CLI:
FILE="input.bin"
SPLIT=12345678 # ...
Score of 0
0
votes
How can I find network interface name based on vid and pid of USB
Here's a short script using sysfs, which is typically mounted on /sys. You can ls /sys to see if anything's in there, and if not, mount -t sysfs sysfs /sys as root to make the filesystem available.
...
Score of 0
0
votes
How do I atomically create a locked file in Linux?
The best solution is probably to save files being downloaded separately.
Let's suppose we are downloading into cache key foo, a trivial
if open("foo.cache", O_RDONLY):
return fd, file is ...
Score of 0
0
votes
What are the differences between APT clean, remove, purge, etc. commands?
Basically, remove uninstalls a package, purge also removes its config files, autoremove removes unused dependencies, and clean clears APT's downloaded package cache. You usually don't need to run all ...
Score of 0
0
votes
Cron job script failing because of keyring interaction
This is most likely caused by the fact that the user crontab runs processes with a different set of environment variables than is typically loaded in your shell. (I'm assuming you are using the user's ...
Score of 0
0
votes
Best Way to Specify Linux Distribution Repo Version of Python Dependencies?
Have you perhaps explored using Red Hat Trusted Libaries? It's designed for the case where you need secure Python packages supported from Red Hat that aren't packaged via DNF. It seems like the best ...
Score of 2
2
votes
using argon2 from zig standard library (v0.16.0) verifyHash crashes with a padding error when writing to and reading from a file
I had overlooked the solution, because I thought I had already tested for it.
I needed to construct a slice of length of the file to contain the contents of the file that was read in the verify ...
Score of -1
-1
votes
How to work around Linux's lack of mandatory file locking?
If you need to be sure that the file is opened by only one application at a time, you can use flock() function.
int fd = open("somefile", O_RDWR | O_CLOEXEC);
if (flock(fd, LOCK_EX | ...
Score of 0
0
votes
How to specify file names to the multiple files we are downloading using wget -I command in linux?
If you have MULTIPLE URLs in a file urls.txt, and you need to save them in an orderly manner, such as 1.file, 2.file, 3.file, you can use this cmd template on Windows:
@echo off
setlocal ...
Score of 4
4
votes
Redirect stderr to both stderr and stdout
What do you need separate stderr output for?
Because a log of errors without the (audit) log of actions that led to the error is, generally, unhelpful. Unless the error message includes the complete ...
Score of 7
7
votes
Accepted
Redirect stderr to both stderr and stdout
Use a brace command grouping to apply a single redirect to your group and individual redirects to components inside.
Something along these lines:
{ cmd 2>&1 1>&3 3>&- | tee -a /...
Score of 0
0
votes
Redirect stderr to both stderr and stdout
We want to duplicate all stderr output onto file descriptor 1 as well as 2. Since this is Linux, we can use /dev/fd/ for this:
2> >(tee /dev/fd/2)
Worked demo:
$ ( exec_my_proc.sh 2> >(...
Score of 0
0
votes
Best Way to Specify Linux Distribution Repo Version of Python Dependencies?
Good question.
pyproject.toml does not allow multiple versions of a dependency to be specified
Not true. I think you might be mistaken on fundamentals of software versioning. Let me explain.
For a ...
Score of -2
-2
votes
Redirect stderr to both stderr and stdout
exec_my_proc.sh 2> >(tee stderr.log >&2) 1>&1 | tee txt.log
This works because the 2> >(tee stderr.log >&2) bit splits stderr in two before it ever reaches the ...
Score of -2
-2
votes
Best way to update a clock every second in Linux
Using the signal, alarm, time and ctime_r functions in C is the easiest way.
The following code raises SIGALRM every second in sys_init calling sys_sigalrm getting the accumulated frames and fetching ...
Score of 0
0
votes
Best Way to Specify Linux Distribution Repo Version of Python Dependencies?
If you know it’s specific to RHEL, why not just build an RPM package using the Python macros for EPEL? The Fedora documentation, even though it’s aimed at Fedora packagers, explains those macros very ...
Score of 0
0
votes
send sms from pc via android
There already is KDE Connect which probably does what you want.
There is also GSConnect for Gnome Shell, which I have not tried (I use KDE Connect in Ubuntu).
Score of 3
3
votes
Understanding the difference between using 'dotnet run' and the Debugger in VS Code
This looks like 2 seperate problems, but both probably come from the debugger starting the wrong project/output directory.
The fact that you see the default Identity Register page is a pretty good ...
Score of 1
1
vote
Bash script didn't recognize command result
When crond runs anything, it sets a comparatively bare $PATH. On my system, that is /usr/bin:/bin. Test it yourself: 37 13 * * * echo $PATH gets you the value once every afternoon.
Where does your ...
Score of 1
1
vote
Does running Docker inside a KVM VM inside Docker improve security isolation?
KVM requires /dev/kvm exposed to the container and /dev/kvm is powerful. and that is a very sensitive capability. A compromised container can potentially create vms ,etc . and I think exposing /dev/...
Score of 0
0
votes
My CPU usage is more than 100% showing in htop
as i can see it is using only the 0th core 100% , so it using your whole cpu at 53%
Score of 0
0
votes
How to setup Windows Subsystem Linux (WSL 2) with VSCodium on Windows 10
I was able to fix this by editing 'c:/users/{name}/appdata/local/programs/vscodium insiders/bin/codium-insiders'
change lines 50-55 from this:
if [ -n "$WSL_EXT_WLOC" ]; then
# ...
Score of 0
0
votes
Installing R from CRAN Ubuntu repository: No Public Key Error
As far as I can see, everything above that relies on apt-key will fail because apt-key was deprecated and removed from Ubuntu, I think around 2020. I have not yet worked out the correct way to get ...
Score of 0
0
votes
Reloading Flash 17 times causes error #2046 and requires a browser restart
had the same issue on windows when trying to open a specific file after a system crash, deleting all files on user\AppData\Roaming\Adobe\Flash Player\AssetCache solved the issue
Score of 0
0
votes
Sending data to stdin of another process through linux terminal
In my case this helped (I needed to send 'yes' to the terminal):
echo -e '\r\nyes\r\n' >> /proc/PID/fd/0
but note that this was a symlink to named pipe in /proc
/proc/PID/fd/0
Score of 0
0
votes
valgrind - Address ---- is 0 bytes after a block of size 8 alloc'd
I had the same message but it turns out it wasn't an error. I was calculating the padding for the string, something like this:
char *next = element_to_string(element->next);
int ...
Score of 0
0
votes
Retain owner and file permissions info when syncing to AWS S3 Bucket from Linux
s3cmd suggested by serge looks cool, but it seems to be lagging on maintenance (i.e there is an issue with a 5 month old promise to release a new version "this weekend"and last release was ...
Score of 0
0
votes
Install specific Ruby version
For those who want to install a version with the dev kit installer included, just check the official Ruby website archives and look for the specific version that suits your needs.
Here's the link: ...
Score of 0
0
votes
Architecture to retry as root on Linux in C
Upon successful completion, the return value is the return value of PROGRAM. If the calling process is not authorized or an authorization could not be obtained through authentication or an error ...
Top 50 recent answers are included
Related Tags
linux × 226980bash × 35017
c × 29924
shell × 23795
c++ × 17282
python × 16100
ubuntu × 12462
unix × 11500
java × 9082
linux-kernel × 8012
php × 7995
awk × 5767
windows × 5607
docker × 5512
sed × 5357
gcc × 5260
sockets × 4225
ssh × 4137
network-programming × 3735
terminal × 3636
grep × 3630
kernel × 3587
centos × 3453
apache × 3390
mysql × 3109