Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [linux]

Linux is a free (libre), open source, Unix-like operating system.

2
votes
1answer
47 views

Block same instance of a program for running again

I am implementing a library (Linux) and I created some functions to block new instances of a running program and I was wonder if there are some better improvements for it. Here is a program which ...
2
votes
0answers
14 views

Serial copying from disk images to folder in Bash

This is a Bash script that copies files stored inside disk images to a directory, using a defined structure provided via a JSON file. I've included the external programs it requires and the test I ...
2
votes
0answers
19 views

Script to report disk usage

I am trying to see how I can speed up the below script that reports disk usage. The timed find command towards the end is the problematic line that I am trying to ...
2
votes
0answers
13 views

BASH Script to Configure Monitors on Linux via xRandR

My main computer is a laptop which I run i3wm atop Arch Linux. As such, my monitor situation sometimes changes, so I wanted to code a script to configure my monitors based on which ones are connected ...
1
vote
1answer
19 views

Detecting the total amount of RAM installed on a hardware from a Linux system using a POSIX shell script

Today, I gave myself a small task of detecting the total amount of RAM installed on a hardware from a Linux system using a POSIX shell script. I ended up using ...
1
vote
0answers
32 views

Interactive Linux upgrade script - Follow-up #1

One year ago I asked for a yearly revision of my Interactive Linux upgrade script. There is nothing new to the conditions, therefore please read the original question before you decide to comment and ...
1
vote
0answers
48 views

Script for checking to leak via /dev/hands

I wrote so code to check leak. Please check it. All correctly in this code, or maybe something to correct? ...
1
vote
1answer
82 views

SSMTP configuration in Ubuntu 18.04 with Bash in my own system (one user)

This is how I configure the utility SSMTP that allows me to send mail via smtp protocol through a Google-Gmail proxy instead I'll have to manually configure an "...
11
votes
2answers
997 views

malloc() and free() for Linux with system calls

I have written an implementation of malloc() and free() for Linux using the sbrk() system ...
3
votes
0answers
45 views

Cache line versus struct size testing

There's a mission-critical ring buffer in production on which I'm curious to test some optimizations. Specifically, I'm wondering how much of a performance difference struct size will make on issues ...
3
votes
1answer
29 views

Script to clean up old files that should only run one instance

I'm writing a bash script for deleting old files on a Linux server. Here are some relevant facts about this script: As currently written, it does work as expected. However, it's entirely possible ...
3
votes
3answers
253 views

Simple puts() function in x64 assembly

I'm trying to write as simple I/O library in x64 using linux syscalls ...
4
votes
1answer
36 views

Shell function to convert .png to .svg file

I needed to convert some custom icons that were in .png format to .svg format and did not want to use an online converter for it. I could not find an out-of-the-box solution online so I created my ...
3
votes
1answer
45 views

Bash program that sets up and configures the environment for new Debian installs

Here is my second version of a bash program I'm writing, as per @hjpotter92 I've updated and cleaned it since last: This script is run directly after a fresh install of Debian, to do: sets up ...
0
votes
0answers
34 views

Command line matrix effect in swift

I have modified a small swift package to reproduce the matrix effect on the command line, however I have been getting some weird characters. How do I limit the characters to be used in the effect? <...
0
votes
1answer
23 views

Shell POSIX OpenSSL file decryption script follow-up #3 (final)

From original very simplistic code: Shell POSIX OpenSSL file decryption script I learned a lot both from the first follow-up review, and the second one as well, many thanks! I just need one final ...
2
votes
0answers
18 views

Shutdown or reboot system from LAN

I've written a simple web service which allows a user to shutdown or reboot a system from the LAN. Although written to be used on an RPI which lacks a power or reset button, it can be used on any ...
2
votes
1answer
74 views

Password encrypting tool

I wrote a tool that takes a domain name and a password, concatenates them, hashes the result with sha512, and returns the result encoded in base64 truncated to 32 characters. The main idea behind this ...
0
votes
1answer
38 views

Shell POSIX OpenSSL file decryption script follow-up #2

This question is the second follow-up of: Shell POSIX OpenSSL file decryption script The first follow-up was: Shell POSIX OpenSSL file decryption script follow-up #1 Both of which have proven very ...
2
votes
2answers
114 views

Bash script to change network interface parameters/configuration and start virtual machines

On my Arch Linux system I have created a script that should do the following on system startup: detect all network interfaces check if physical interfaces are up check if bridge interfaces are up ...
2
votes
1answer
24 views

Ubuntu kernel update and removal automation script

This is my first bigger than a few lines bash script. It automates kernel updating and removing on Ubuntu through ukuu (Ubuntu kernel update utility). I'm not yet ...
1
vote
3answers
115 views

Convert integer to decimal string

I have a need to do some conversions in a loop to display the results using C++98 on Linux, which doesn't have any itoa() to complement ...
6
votes
1answer
65 views

Bash script to send notifications when low on ram

Backstory Recently, we've changed the PCs at my workplace to un Linux Mint. It works amazing, is blazing fast and the adjustment time was very short. However, I noticed my PC would freeze completely,...
1
vote
0answers
27 views

Reducing force unwraps in CLI utility

This is a CLI utility for managing the allocation of investment. It's an exercise, don't take it too seriously. So the utility asks the user a series of questions about it's finances and suggests a ...
8
votes
1answer
121 views

Systemd service configuration helper script

I've written a script that semi-automates the process of configuring/creating a new systemd service. The script is working perfectly well, however, I've had some trouble with the styling and ...
5
votes
1answer
101 views

Bash script to setup new Debian installs

This script is run directly after a fresh install of Debian, to do: sets up syntax highlighting in nano, sets up iptables, sets ...
10
votes
3answers
301 views

Implementation of Linux cp in modern C++

This is my simple implementation of the Unix cp command. It is a C++ program but makes use of some of the lower level C library I/O functions. Any suggestions for ...
3
votes
2answers
125 views

Find duplicate files in Linux

This code finds duplicate files in Linux. I assume that MD5 hash will return unique hash number. What can I improve in this code? ...
1
vote
2answers
43 views

Running shell script as root via external binary

I'm not an experienced Linux user and I wanted an easy way to run shell scripts as root from a PHP script, I came up with this: ...
2
votes
1answer
68 views

Sysinfo parser for a window manager status bar

The program is written mainly for the status bar in dwm (a window manager for Linux), but it can be used for any manager that takes input from the root window in X. It queries different resources in ...
6
votes
2answers
70 views

Interactive bash script to create new permanent swapfiles

I started self-learning Bash scripting yesterday, and I finished my first successful "advance" script. Goal To create an interactive step-by-step script to that allowed customizing various parts of ...
3
votes
1answer
91 views

Function for scanning /proc

I wrote a function, scan_ps(), for scanning /proc, to replace a combination of popen() and <...
2
votes
1answer
41 views

Making a disk usage breakdown

I'm looking for a better way of doing this code I made. I work for tech support and one of the biggest questions I am asked is: "Hey, how did my disk get so full in my VPS?" I am aiming for output ...
7
votes
1answer
197 views

Debian Firefox Quantum update script

I wrote a little script to automate upgrading Firefox to a new version under Debian, since I don't want to install it from unstable and the snap version has ...
1
vote
1answer
46 views

Haskell game server auth: cookie key generate&check

C++ code version (description copied from it) gameKeys id is authentication function of an MMO game server. When someone wants to play with friends, he sends ...
4
votes
2answers
78 views

Game server auth: cookie key generate&check

UPD: Haskell version, please check it too. gameKey(long id) is authentication function of an MMO game server. When someone wants to play with friends, he sends ...
5
votes
1answer
75 views

C application for capturing keyboard shortcuts

I'm writing an application for capturing keyboard shortcuts on Linux, but I don't have a lot of experience with C or the Linux API, so I'm wondering about problems with the code or maybe parts that ...
3
votes
1answer
52 views

Running xinput to change touchpad settings

I am looking for some feedback on the code below, mainly for efficiency or mechanism correctness (like eval vs. subprocess). I am also curious if ...
9
votes
2answers
150 views

Laptop battery level monitor for Linux

I come from a C background and am trying to learn Rust. I wrote my first Rust program, to check the battery level on my laptop and warn me if it's low/critical. It works fine, but I wrote it in a ...
1
vote
2answers
161 views

Long-term archiving + encrypting shell script

Yesterday, I very quickly, in an hour, wrote the very first version of my long-term archiving + encrypting shell script. I am aware it may have too many flaws, but none of them really prevent it from ...
4
votes
1answer
1k views

Python script for monitoring systemd services (cpu/memory usage)

This is a python (2.7.13 according to sys.version) script that reads systemd service names from a file and gets their CPU and Memory usage. It does that by first ...
1
vote
2answers
38 views

chmod all .htaccess files under all website dirs under public_html dir

This is my code to chmod all .htaccess files under all website dirs under public_html dir. The reason I use this code is to make sure WordPress plugins won't "...
1
vote
2answers
72 views

Portable (Linux, Cygwin,…) Makefile for my own Shell OpenSSL file en-/decryption scripts

Let it be clear that in this question I ask for further guidance with my current version of Makefile used for my own Shell OpenSSL file en-/decryption scripts, not ...
5
votes
1answer
893 views

File path unified in Windows/MacOS/Linux

We are all tremendously happy about back slashes in Windows file systems and do not think that their sole purpose is to make life complicated for smart people who are capable of using different OS. ...
3
votes
0answers
45 views

Print a list of disk blocks used by file(s) - Linux

This code takes a list of filenames as arguments or from stdin (or from a provided file) and dumps a list of disk blocks used by those files. An attempt is made to use the linux ...
-2
votes
1answer
49 views

7 pass file erasure [closed]

I am an aspiring C++ programmer and I have been programming for a few years off and on but I don't have much usable knowledge. Right now I am working on filesystem safety so I decided to write an ...
6
votes
2answers
103 views

Perl script to set IP settings

This is my first go at a Perl script to (semi-) automate setting the correct IP settings. I use it to configure a virtual machine after creation. It's also my first Perl script as a whole, so I'm ...
6
votes
1answer
473 views

Convert unsigned Integer to ASCII in x86 assembly

This is my best effort to code an x86 32 bits to get an unsigned int (4 bytes) and convert it into a string. My strategy was successively divide the number by ten and fulfill the remainder of the <...
7
votes
1answer
77 views

Squire for your recursive SSH adventures

One day I used to SSH to lots of machines to do some administrative tasks. I constantly used l to list directories just like I do on my own machines. Guess what, ...
7
votes
2answers
169 views

Copy files in parallel by reading what files to copy from few other files

I am working on a little complicated shell script for the first time and this is what it should do: During startup, it figures out what is my clientid by looking ...