Questions tagged [linux]

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

Filter by
Sorted by
Tagged with
12
votes
4answers
1k views

Light task-processing systems with zero dependency for Linux systems

I made a prototype for a task processing systems. Architecture Worker - is a entity that is processing one-by-one tasks for the same processor. Processor - (also: executable, app) executable file (...
2
votes
2answers
52 views

Bash script to calculate when I wake up

This script tries to determine the time when you woke up. Of course, it only applies if you turn your computer on not too long ago after getting out of bed. If not, it might still be useful as an ...
2
votes
2answers
57 views

Shared memory class

I wrote a class that opens a shared memory communication to use in my project, and would like a review. mylib_com.hpp ...
1
vote
2answers
76 views

Editing system files in Linux (as root) with GUI and CLI text editors #2 (final)

This is the second iteration of this question A note to start with: the first iteration of this question can be found here: Editing system files in Linux (as root) with GUI and CLI text editors As ...
10
votes
3answers
2k views

C program for 'Reverse DNS lookup'

I have written the following code for doing a reverse dns lookup. I'm not sure if there are any errors in it. Please have a look: ...
4
votes
1answer
68 views

Spawn a Linux subprocess without leaking FDs

I'm working on a library of shell utilities for Swift, and at the core of it is the need to spawn a subprocess. For Linux, I came up with the following function to do the low-level work. ...
2
votes
1answer
59 views

Ruby script for automating software install on a brand new Linux OS

I have some scripts to automate software install, apply some configurations and so on after installing a new system. I used to have them as bash scripts but it was generally a poor idea. I have ...
6
votes
1answer
76 views

A Backup Script for my Linux Server/NAS

This is my script. I want it to run on a weekly basis on my linux server on a Raspberry Pi 4, to back up all files that may have changed. On the GPIO are just LEDs. It requires a program called ...
2
votes
1answer
42 views

Log the diff of a Apache httpd config file and reload the service with Python and systemd

Using systemd's .path unit to run a Python script whenever a httpd config file is changed. The Python script creates a backup of ...
-4
votes
1answer
56 views

Defining constants in the original standard of C [closed]

I'm learning C using Mike McGraths 3rd edition. I know the book is old but I want to have a better appreciation for the changes made to C through its timeline. The compiler error is error: ‘SYSTEM’ ...
7
votes
3answers
103 views

Monitor progress of written lines of code

Not long ago, I was asked about how many lines of code I have written in C++ and could not answer that question. For this reason and to become more familiar with Bash shell scripting, I wrote a small ...
3
votes
1answer
42 views

Ubuntu 18.04.3 ASCII strings length with embedded VT100 control codes

As my applications rely on VT-100 emulation, I found that I had to do quite a few workarounds to determine the number of visible characters in a string with embedded VT-100 control codes. So that led ...
6
votes
1answer
74 views

Cat program in x64 FASM

I wrote cat program in x64 FASM and I would like to know if there is anything that can be improved. This implementation of cat supports: Reading from stdin. Multiple arguments. I checked few cases ...
6
votes
1answer
107 views

Cat program in x86 NASM

I wrote cat program in x86 NASM and I would like to know if there is anything that can be improved. This implementation of cat ...
7
votes
4answers
82 views

Ubuntu 18.04.3 LTS get terminal columns and rows NASM

As part of the prologue of all my console applications, I need to determine the extents of the current terminal so if there are less than 132 columns or 43 lines the user can be warned output may not ...
6
votes
5answers
172 views

Upgrade script for MediaWiki website with one external addon

I have a MediaWiki 1.33.0 website with only one external addon installed (external extension), which is ContactPage. I created the following script with that logic: if there is an upgrade to either ...
5
votes
1answer
61 views

Creating procfs entry on linux in Kernel Module

My Linux kernel version is Linux version 5.0.0-29-generic I'm currently learning how to write kernel modules for Linux and implemented this simple module which ...
4
votes
1answer
35 views

Bash script to reconfigure the screen orientation when entering or exiting tablet mode

I'm writing a bash script for my tablet laptop to flip the screen depending on a file in Manjaro Linux. My current script is the following: ...
9
votes
2answers
2k views

Linux Commands in Python

I've decided to write some Linux commands in Python. Below is a list, along with some constraints (if you're unfamiliar with Linux, the top of the program along has a description about each command ...
4
votes
0answers
122 views

Backup script for Linux (full and differential backups)

The backup script itself. Make it executable and place it somewhere in your path: ...
3
votes
0answers
30 views

NRPE script for monitoring filesystems usage

Next script returns NRPE friendly output. It checks percentage usage of all local filesystems. Desired output if everything is ok: OK | /=56;;;; /boot=20;;;; /opt=40;;;; /var=60;;;; (and ...
4
votes
2answers
68 views

Automatic CRL files converter

In my job we use our internal CA, which runs on a Windows server. When I want to use its CRL on a Linux machine I have to do these steps: download root CA and intermediate CAs covert them to x509 ...
3
votes
1answer
29 views

Running a shell command when a file is added to FTP on Linux Ubuntu

I've recently set up a continuous integration pipeline to deploy a .NET Core application to my Linux machine living on the cloud. My CI pipeline publishes my application, (specifically a .NET web ...
1
vote
2answers
60 views

Creating a backup of a website directory inside the Web Application Root directory in *nix

In CentOS I have a Web Application Root on which I have a website directory. I would like to make an immediate backup of that website's directory by using the zip ...
1
vote
1answer
49 views

NRPE script for monitoring memory usage

This script based on previous NRPE script for monitoring load average. Same purpouse - get NRPE friendly output with minimal usage of non built in commands. In this case wasn't need to count with ...
7
votes
3answers
244 views

NRPE script for monitoring load average

This script converts a server load value into percentage, compares it with non desired state ($warning and $critical) and returns all information in NRPE (Nagios Remote Plugin Executor) friendly ...
1
vote
3answers
51 views

Python startswith and then look a word in a conditional block

I have below working code which works fine, but just looking way around if there is an another elegant way of doing this, because here i'm using else condition to print the last line or dataBlock to ...
2
votes
1answer
53 views

Upgrade Firefox Quantum with logging and version check

This is the updated version of the script first posted here. Specifically, I first wanted to save the logs to a log file at "$HOME/.logs/ffupgrade.log", but I'm ...
2
votes
0answers
64 views

Apache reverse proxy security configuration

Could someone share some light and check if this is okay for apache httpd security/good standards? I'm using apache httpd to call my Node.js app that is running with Express and also configuring SSL. ...
1
vote
1answer
72 views

Serial port library for unix systems in C using callback model

I wrote a blocking serial port library, Blocking serial port C library, but prefer non-blocking so wrote this library where user can specify callbacks. So it is event driven. The code assumes C99 or ...
1
vote
0answers
102 views

C++ - simulating Windows' IO completion ports in Linux

This is a simple implementation of IO completion ports in user mode for Linux. In Windows IO completion ports work like this: There is a global queue for issuing IO requests. Some worker kernel ...
1
vote
1answer
42 views

Remap ls to honor .hidden files

I wrote this code in my .bashrc to remap ls to honor .hidden files. I'm pretty new to shell/bash scripting, so I feel like this is not the most performant way to handle this, and it has some ...
2
votes
0answers
21 views

Cycle through filenames in vim

So I have a list of files which names are something like this ...
3
votes
1answer
36 views

Syncing GitHub repositories local, remote and forks

It's a simple bash script but I'm hoping for feedback, advice and examples on how to improve the script and code. Can you guide me how to put more checks in the code and more if possible? This code: ...
2
votes
0answers
43 views

Blocking serial port C library

I am planning to write a reasonably feature rich serial library but wanted to cut my teeth on something fairly basic. This serial library is fairly simple. It is a thin wrapper on the UNIX open, ...
2
votes
0answers
42 views

Code to backup the history file in Linux

How is the logic, efficiency and can it be improved? This is a snippet from my .bashrc file; I just wrote it and I've tested it and it almost works. This was the ...
1
vote
1answer
76 views

Bash Code to backup the history file in Linux [closed]

How is the logic, efficiency and can it be improved? This is a snippet from my .bashrc file, I just wrote it. The code is supposed to do this: Backup my ...
18
votes
7answers
5k views

Tic-Tac-Toe for the terminal

I recently started learning C, and this is my first fairly large (to me) program. It's a basic Tic Tac Toe game for the console. There's no AI, it's just a 2-player game. Is there anything I can ...
4
votes
1answer
65 views

Shell script to calculate the total space consumed by a user by file-size

I'm working with a small bash code which is working fine but i'm just looking if there is better way to formulate this, In this code i'm looking for the Files between year 2002 and 2018 on the 7th ...
4
votes
1answer
78 views

Bash script to setup new Debian installs - follow-up

I have this bash script I've been working on and I have updated it. I was hoping for some advice and/or input on the code. This script is run directly after a fresh install of ...
2
votes
1answer
92 views

Editing system files in Linux (as root) with GUI and CLI text editors

My intention is to POSIX-ly write one generalized function for running various text editors I use for different purposes through sudoedit, i.e. editing files as ...
1
vote
0answers
117 views

Implementing std::filesystem::remove_all() for Android

I needed to use some c++ code on both standard Linux and the Android variant, and the code will use filesystem library but it isn't yet in the ndk. So I'm making a one to use on Android It will be ...
3
votes
1answer
24 views

Is device mounted? Both UUID and device names accepted

I am trying to write is_device_mounted script, which in turn will serve a greater purpose in my home Linux system. It does not even have an error reporting ...
2
votes
1answer
71 views

Multithreaded local server

I'm writing several local servers which have almost the same code in main.cpp. Appreciate your comments, improvement suggestions and especially notes on potential ...
7
votes
2answers
110 views

Color ASCII drawing class

I am working on a pseudo graphical interface for a Chess engine I wrote. I want to draw a colored Chess board with ASCII pieces. To abstract the pure ...
4
votes
2answers
56 views

Append a note to one of three files based on user choice

The user selects one of the three categories then makes a note on that selection. Then the note is appended and saved to the appropriate list. It took me four hours to write this. I'm trying to learn ...
2
votes
0answers
125 views

Simple Go Linux daemon to send/receive gob-encoded data on a socket

I'm currently working on a linux daemon and would like some feedback. The program is a simple unix socket server that sends around gob encoded messages. I'm still getting the hang of concurrency in go ...
5
votes
1answer
141 views

sed to fix a messy nginx.conf

I have a few servers to fix that repeatedly get their nginx.conf file messed up due to a rogue deploy script. These are the three sed commands I'm using to fix at present: ...
9
votes
2answers
563 views

Bash script to truncate subject line of incoming email

I'm going to put this script into production in a mail server /etc/aliases file: we have a system that receives email but the subject line must be limited to a certain size. The proposed usage in the ...

1 2 3 4 5 9