Questions tagged [linux]

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

Filter by
Sorted by
Tagged with
7
votes
1answer
66 views

Prompt user to choose from menu

The following code simply prompts the user to choose from a menu, and then it displays the choice made by that user. It only accepts input consisting of a single digit between 1 and 6, inclusive. ...
0
votes
0answers
24 views

Compare script using awk and bash

I try to create compare script using awk and another command and running successful. But I think the script I create it's to long. Is there anyone can shorten my script below ? After plan A ...
2
votes
0answers
24 views

*nix, *bsd, etc basic `tput` color setup

My goal with the below piece of POSIX shell code was to address the more platforms the better with shell tput colors. With this code, I now start all of my scripts, ...
5
votes
0answers
28 views

Utility to edit config files globally

I wrote a small utility in bash that allows me to edit config files anywhere. So, whenever I want to edit a config file, I don't have to type its full path or have to remember where it is. First, I ...
2
votes
1answer
35 views

List files based on changes

I am new to programming and need input on how I could've written something better. Not coding on daily basis. The task was to write a script in python, bash or anything. So I mixed python with bash ...
2
votes
0answers
39 views

Ansible to automate dev environment setup

This is a follow-up to Bash script to automate dev environment setup. In that question I'd thrown together a (sloppy) shell script to automatically setup my development environment. One of the answers ...
2
votes
1answer
33 views

Compile a string into a callable object in C++: a simple JIT based on system, dlopen and dlsym

Today I discovered that it is possible to dynamically load code at runtime via dlopen and dlsym (and similar utilities on ...
8
votes
2answers
418 views

Bash script to automate dev environment setup

After blowing up my environment again messing around with installing random programs and packages I decided to write a bash script I can clone from github and use to reinstall everything like I had ...
2
votes
2answers
75 views

Exponentiation by squaring in x64 Linux Assembly

I am learning some assembly for a compiler project I am working on and I have come across the Exponentiation by Squaring algorithm when it came to calculating x ^ n. To get a grasp on how the ...
3
votes
1answer
28 views

Linux: Raku script to open files from terminal and ask for deletion

Raku script to open files from terminal with xdg-open and, with del option, asks for deletion. Happy to receive Raku syntax improvements. Thanks! ...
3
votes
1answer
26 views

Bash script for automating HPC calculations

I'm a chemistry student working on a simple bash script to automate HPC density functional theory calculations using Quantum Espresso (pw.x). I am very much a novice at shell scripting and would ...
3
votes
1answer
51 views

Simple input and output in assembly x86_64

I am new assembly programming in Linux (x86_64) and I want to make sure that I am programing in a correct way. I wrote a program that just takes an input from the user and then writes his input to ...
5
votes
2answers
211 views

c++ shell for linux

...
2
votes
1answer
34 views

Bash script wallpaper randomizer

I thought it would be fun to write a simple and small bash script which randomly chooses a wallpaper from a given directory of a set of wallpaper images. The code is as follows. ...
1
vote
1answer
86 views

Getting 6000+ substrings from large a large string

I have a class that opens a text file and reads out its content. This class has a member function that will extract a substring between two given delimiters. My application needs to extract between ...
5
votes
1answer
60 views

Powershell script to verify Linux-generated md5sum file

I'm moving some files from a Linux machine to a Windows machine over a low-speed, possibly buggy experimental communications channel that I want to test. One of the tests is to transfer large numbers ...
2
votes
1answer
28 views

Database playground

This is my very first interaction with databases. The goal is to setup a safe playground on an Arch box to create tables and make queries. I want to learn the basics without risking ...
5
votes
1answer
58 views

Bash Code optimization For ssh login on the remote device

I have below code which works fine as its written in bash, i am just posting it here to see if this can be better optimised as per the BASH way. I am have an ...
5
votes
1answer
206 views

Fishy password management

Problem When it comes to security I like to don a tin foil hat. As such I use the, off-line password manager, Keepass. Keepass allows you to to use multi-factor authentication via; a password, a ...
3
votes
0answers
33 views

Bash script to mirror XWindow to remote SSH host

The source code within this question aims to provide a short-cut for mirroring a local XWindow (or session) to a remote host via SSH port forwarding, such as: ...
1
vote
0answers
39 views

Analog Clock in AEC

I've made a simple terminal-based analog clock for Linux in AEC. Here we go: ...
0
votes
1answer
25 views

Split large log file like a dictionary [closed]

I have a large log file in the following format. Do note that this is already sorted alphabetically. I wish to split it into smaller pieces, and with file names reflecting the content of the file (...
4
votes
2answers
460 views

Implementation of portscanner for a host

I have tried to check whether the ports of a host from port 0 to port 1023 is open or not. Could someone please review this code and provide feedback. ...
3
votes
1answer
67 views

Finding the class to which the IP address belongs

I have tried the code for finding the class of the IP address the user inputs, and printing the network and the host bits in the IP address. Could someone please review this approach and provide ...
1
vote
1answer
25 views

Further optimization of file transfer over FIFO on linux?

For learning purposes I'm writing a very simple mqueue based file transfer server. Below is a thread function that takes care of an incoming request: ...
8
votes
4answers
103 views

Implementation of system() function in Linux using fork() , exec() and waitpid() system calls

I have written the code for implementation of system() function using fork(), exec() and waitpid(). Could someone please review this code and provide feedback. Thanks a lot. ...
4
votes
2answers
44 views

Implementation of cp program that prints the number of bytes copied

I have written the code for implementation of the cp program that prints the number of bytes copied when the user presses Ctrl-C. Could someone please review this code and provide feedback. Thanks a ...
2
votes
1answer
36 views

Reproduce the system() function of linux

My mentor says to reproduce the system() function of Linux exactly as given in the man pages. I have written the below code. Could someone review this code and provide me any suggestions for ...
1
vote
0answers
22 views

Simple header-only thread and mutex for both windows and linux in C

I wanted to get some thread support on windows with very simple headers for a library that I'm working on but it had to work on both Windows and Linux. Since C11 threads are not widely supported, this ...
0
votes
2answers
41 views

Bugs - Program that Creates a Directory in C

I have the following code that creates a directory in C. I tested it multiple times, reviewed it a few times and it looks fine at the moment. What I really wanna know is what bugs does it have and ...
2
votes
1answer
46 views

Reproduce Linux move command in C

I have the following code, made in C language, which reproduces the functionality of the mv (move) command from linux. The problem is that the code is very inefficient. How I can optimize or make the ...
3
votes
0answers
93 views

Linux System Monitor

I made a system monitor on Linux which gives you all this information: The full project can be found in my repo: https://github.com/sandro4912/System-Monitor In short it works as following: I read ...
2
votes
1answer
30 views

The code reads from a specified offset to the specified number of bytes in a file

The code reads the specified number of bytes from a specified offset in a file, I have handled the partial reads and bytes > buf_size conditions. Could anyone review the code? and say whether the ...
-2
votes
1answer
26 views

The code reads the file from the specified offset to the specified number of bytes. How to handle errors of partial reads in reading a file [closed]

I could like to read a file from a specified offset to a certain number of bytes in a file. I would pass the filename, the offset, the number of bytes as an argument. The constraint is should use only ...
8
votes
3answers
2k views

File Automation Using Python On Linux

A project to automate file organization in Linux using Python. I've always wanted to do this project way before I know how to code. Now that I did, I want to improve it even more. Used Language: ...
5
votes
1answer
94 views

An echo program, mostly in C and completely from scratch

This is an echo program with no runtime or standard library. It's meant to be compiled with -nostdlib on an amd64 Linux system. ...
3
votes
0answers
34 views

Merging multiple awk commands while retaining functionality

Turned in a project a few days ago, and I needed a way to filter and format values off a file. I decided to go for a bash script since it seemed like a good option, and I came up with the following: <...
2
votes
1answer
67 views

Parallel download of rpm packages

I use zypper to download and install for openSUSE Tumbleweed (much like everyone else of course). Unfortunately it downloads packages serially, and having about a thousand packages to update a week, ...
2
votes
2answers
269 views

Get pixel color from screen in C++ on Linux

For a long period of time I worked on this code, mostly trying to understand it. That is the main reason for needed review. Second reason is simply that I would like to optimize it in any way you can ...
0
votes
1answer
64 views

bad GNU libc argp code [closed]

In helpcovid git commit e27dd3b123c18300665 we have a stupid bug related to Linux GNU glibc argp program argument parsing. <...
4
votes
2answers
135 views

A PHP script used on my home server to download YouTube videos

I have a PHP page I used to download YouTube videos, hosted on my Pi 4. The site is only going to be used on my home network (so a dot local address), but it allows me to download videos on my phone ...
3
votes
1answer
82 views

bash script to bulk decode files

I have written script that does the following. It uses cbl-log program to decode several log files in binary format. cbl-log ...
6
votes
2answers
950 views

Test to see if installed and if not, install it

Okay all you Linux/shell folks out there. This is my first shell script (2nd if you count "Hello World") and would appreciate some feedback. Basically, I need to test whether ...
13
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 (...
3
votes
2answers
63 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
73 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
85 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
76 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
0answers
64 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 ...

1
2 3 4 5
10