Questions tagged [portability]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
8 views

Keeping display contiguration (with panning) after disconnecting external monitor from laptop

Setup Laptop: Lenovo Legion 5 15ACH6 (with Nvidia GeForce RTX 3050) eDP-2 External monitor: Asus ZenScreen MB16AH Monitor 15.6" FHD (connected via USB C) DP-1-2 Other Info The external monitor ...
Dimitrios T. Tanis's user avatar
1 vote
1 answer
57 views

How do I adapt a .img clone of my hard disk (1 partition with openSUSE) to another computer?

I have used the dd command to backup my Linux partition (openSUSE Tumbleweed) into a .img file that I saved on an external hard drive. However, I guess dd-ing it on another computer may cause problems,...
Ul Tome's user avatar
  • 117
0 votes
0 answers
192 views

Custom icons for folders inside drives, should be supported on both Windows and Linux?

I know how to change the icon of a file/folder on Linux (using Dolphin in my case). I know also how to change the icon of a file/folder on Windows 11, both directly in the parameters and using a ...
Ul Tome's user avatar
  • 117
-1 votes
1 answer
55 views

What is the most portable way to skip arguments for shell scripts?

For portable wrapper scripts intended to run on UNIX systems (not necessarily Linux), should the shift command be preferred over array syntax? #!/bin/sh exec command ${1+"$@"} Compared with:...
ideasman42's user avatar
  • 1,211
-1 votes
1 answer
212 views

Can a bash script add to the context of zsh?

I have recently migrated from bash to zsh. I used to use the following token_refresh.sh script to ssh-add my private key to the session: #!/usr/bin/env bash echo "configuring ssh access.." ...
StuperUser's user avatar
1 vote
1 answer
160 views

Is POSIX 1e Capabilities widely implemented?

Do somebody know what are the Operating Systems that implemented capabilities (i.e. Posix 1e)? are they compatible? will capabilities reduce portability to Linux only?
user3435121's user avatar
0 votes
0 answers
46 views

I have a linux installation on an external drive. How can I plug it into a desktop and have it boot?

Hardware: Laptop [ Daily driver ] Desktop [ Server - Normally has Windows installed ] USB Thumb Drive [ Linux Installation Medium ] External Drive [ Linux Installation Destination ] Situation: ...
Jannies - They do it for free's user avatar
1 vote
0 answers
23 views

How to capture and port precise audio configuration/driver/package setup from one Linux distro to another?

I decided to switch to Linux, so I installed Arch (with xfce4). Neither speakers, nor mic worked out of the box. I installed sof-firmware and was able to make speakers work, but not the mic. Meanwhile,...
InfiniteLoop's user avatar
3 votes
1 answer
315 views

Are VirtualBox guest additions host-independent?

I want to use VirtualBox to set up a stable software environment, which I may then export to other systems running VirtualBox. I also want to install guest additions. Are guest additions host system ...
abukaj's user avatar
  • 165
1 vote
1 answer
437 views

How does nodejs achieve seemingly binary compatibility between different linux distros

If you go to the download site of nodejs you can select Linux Binaries (x64) which is a tar archive that (among other files) contains a bin/ folder with a binary called nodejs. How is nodejs able to ...
Marco's user avatar
  • 158
2 votes
1 answer
1k views

Is it safe to snprintf with output to NULL and size 0?

Is it safe to call snprintf(NULL, 0, "…", …)? I can also ask in other way: Does snprintf write the NUL char if size is 0? The example in Linux man-pages manpage printf(3) provides an example ...
jiwopene's user avatar
  • 1,071
0 votes
1 answer
177 views

How to hibernate Linux To Go to disk and restore it on a different device?

I have my Linux installed on a portable SSD, so I can switch devices (laptop at home, desktop in office) easily and don't need to consider any syncronization problems. This is called Linux To Go. It's ...
Lingfeng Fu's user avatar
3 votes
1 answer
2k views

Portable Linux emulator on Windows?

In a Windows computer where you don't have permission to install software, does Windows Linux subsystem, cygwin or any complete or partial Linux shell, utility or API emulator have portable versions? ...
Tim's user avatar
  • 102k
17 votes
6 answers
3k views

What's the best way to trace all the changes I've made to my system files over the years?

As I imagine a lot of Linux users do, over the years I've followed the advice of countless different threads, blogposts, videos etc. and made various changes to system files in order to improve my ...
Dimitris's user avatar
  • 187
1 vote
1 answer
328 views

terminfo/termcap `tput bold`/`tput md`: portability of bold text

Suppose I have the following color support in one of my portable shell scripts: #!/bin/sh set -o nounset tput_init_linux () { set_fg_color='tput setaf'; reset_color=$(tput sgr0 2>/dev/null); } ...
Vlastimil Burián's user avatar
5 votes
1 answer
691 views

Difference between posix_fadvise and readahead

As per manpage, readahead is Linux specific: CONFORMING TO The readahead() system call is Linux-specific, and its use should be avoided in portable applications. and posix_fadvise is portable: ...
arunanshub's user avatar
9 votes
1 answer
697 views

On what UNIX-like system / filesystem is the st_blocks field returned by stat() not a number of 512-byte units?

I always assumed the st_blocks field returned by stat()/lstat()... system calls and which du uses to get the disk usage of files was expressed in 512 bytes units. Checking the POSIX specification, I ...
Stéphane Chazelas's user avatar
2 votes
0 answers
49 views

Does POSIX specify sed -E? [duplicate]

sed uses basic regular expressions (BRE) by default. Some implementations offer an option to switch to extended regular expressions instead. GNU sed introduced the -r option to do so in version 3.01 ...
Socowi's user avatar
  • 635
0 votes
1 answer
2k views

Kali Linux on portable SSD with data persistence

I need to setup a portable kali-linux environment that I can boot on any available computer. I don't want to use a virtual environment because I would need to download VMware on the host computer, ...
mossonzdod's user avatar
8 votes
3 answers
3k views

Who is responsible for providing `set -o pipefail`

I want strict mode in my scripts. I would also appreciate portability. set -o pipefail seems compulsory. Yet shellcheck(a static linter) is unhappy that "In POSIX sh, set option pipefail is ...
Vorac's user avatar
  • 3,077
1 vote
2 answers
153 views

Portable name of C++ compiler (and linker)

cc is the POSIX name of the C compiler. Is there a general name of the C++ compiler (and linker). Notice that g++ also adds some libraries, that will not be included when using plain gcc or ld.
user877329's user avatar
2 votes
0 answers
125 views

Is there any difference between Ubuntu and Centos 7 when running su -c “my command” “someuser” ?

I tried below command in both Ubuntu and Centos 7: su -c "./bin/server" swrun and I found it's started process by root in Ubuntu, but started process by swrun in Centos 7. I used service ...
user470706's user avatar
-2 votes
1 answer
684 views

Is there any guide how to write bash scripts compatible with both CentOS and Ubuntu

I am simplifying my scenario here. I've built a series of bash scripts and tested them under Ubuntu. I want to make sure my scripts (bash syntax) work the same under CentOs. Is there any guide how to ...
Allan Xu's user avatar
2 votes
1 answer
251 views

Why is not 'test -z =' an error after all?

I have a book that stated: "....For example, if the shell variable symbol contains an equal sign, look at what happens if you try to test it for zero length: $ echo $symbol = $ test -z "$...
Jacky's user avatar
  • 161
1 vote
0 answers
181 views

Why do BSD and GNU grep give different results here?

I distribute a slightly modified version of a public CSV file. To generate the modified CSV file I use a short one-line grep command: grep -Ev '^([A-Za-zA-Za-z]|[0-90-9]*),' input.csv Actual project ...
polm23's user avatar
  • 171
0 votes
0 answers
230 views

making sqlcmd self-contained so it would be possible to run without installation, for CentOs

I am trying to make a bash script to connect to remote SQL server with sqlcmd in the devp machine, as I have admin privileges, runs smoothly but I NEED (and capitals because it is imperative) to build ...
CarlsWhishde's user avatar
0 votes
3 answers
663 views

sed portability: extended regex vs. backslash

We can write the next command in two ways: # using extended regex $ echo foobar | sed -E 's/(foo)(bar)/\2\1/' barfoo And: # using backslashes $ echo foobar | sed 's/\(foo\)\(bar\)/\2\1/' barfoo ...
schrodingerscatcuriosity's user avatar
6 votes
0 answers
2k views

Portable way to set custom URL scheme handler for all users

I already know how to create a custom URL scheme and set its handler using xdg-utils: xdg-settings set default-url-scheme-handler name handler.desktop However, the command affects only the current ...
trungnt2910's user avatar
13 votes
2 answers
4k views

How portable is a gzip file over 4 GB in size?

To backup a snapshot of my work, I run a command like tar -czf work.tgz work to create a gzipped tar file, which I can then drop in cloud storage. However, I have just noticed that gzip has a 4 GB ...
Peter B's user avatar
  • 233
1 vote
1 answer
399 views

Are octal escape sequences more portable than hex ones for shell scripts

As part of a scheme for writing shell code that's capable of processing arbitrary data, I was looking for a way to convert null bytes to some other character. I found that tr requires arbitrary bytes ...
Melab's user avatar
  • 4,048
1 vote
1 answer
946 views

How to make a shell script as portable as possible (POSIX and non-POSIX)

Situation: Writing a shell script to do some stuff across multiple shells Problem: While Bourne-compatible shell scripts (bash, ksh, ash, zsh, etc) are easy to be made portable (just make sure the ...
Timothy Wong's user avatar
1 vote
1 answer
145 views

Is it safe to hardcode /etc/ path for configurations in an application I'm contributing to?

The application I'm contributing to requires configuration files as a part of its operation. This is currently placed within the root directory of the application. If I followed the FHS, the config ...
rsn's user avatar
  • 119
0 votes
0 answers
2k views

How to test a binary, to see if all shared library dependencies, are satisfied?

I have a program which I compiled on an earlier version of Fedora which suddenly broke after an upgrade. I was running an older version of Fedora at the time which had stopped receiving updates; so I ...
Zhro's user avatar
  • 2,669
-2 votes
1 answer
114 views

Linux off a Flash Drive

I want to run Linux off of a flash drive. I'm already dual booting Windows 10, and Ubuntu on my laptop, and have burnt the mint ISO onto a flash drive. Every time I load it live, it takes me to a ...
DS3a's user avatar
  • 1
2 votes
1 answer
249 views

process list with quoted arguments, portably

How can an original command issued at the command line be acquired without using proc or any other non standard tool? When printing a process list using ps, the arguments passed in to initiate the ...
Michael Marcus's user avatar
2 votes
0 answers
697 views

Portable way of finding files whose birth date is after a given timestamp

According to How to find creation date of file?, in Linux filesystems, such as ext4, Btrfs and JFS, that store the file creation time (aka birth time), it is possible to display the file birth time (...
Paulo Tomé's user avatar
  • 3,762
0 votes
1 answer
1k views

How to remap network interfaces on boot time?

It turns out that I'm trying to create a portable distro while getting prepared for any kind of hardware failure. I'm creating (or restoring) a Debian distro by multistrap (or from my backups) and ...
ceremcem's user avatar
  • 2,351
3 votes
4 answers
4k views

What is the most portable shell, and relevant best practices to follow? [closed]

I have been enthusiastic to shell scripting for some months, and found that the codes I write (in bash) do not work in some machines. This is very disappointing. I realize that I should have learned ...
Student's user avatar
  • 453
6 votes
2 answers
614 views

Does FreeBSD contain multiple variants of basic regex?

grep and sed are both described as using "basic regex" ("BRE") by default. BRE is well described here. But consider this output: # echo ' aaaaa ' | grep '\(aaaaa\|bbbbb\)' aaaaa # echo ' ...
Stilez's user avatar
  • 1,261
0 votes
1 answer
1k views

MX Linux Not giving me the USB option while trying to install on it

I have make bootable USB of MX Linux with the help of RUFUS software. Now when I am trying to install on USB it does not show me partition to install it while I am booting live setup . The choose the ...
Haziq's user avatar
  • 13
2 votes
2 answers
128 views

Why is the which command so hard to eradicate? [closed]

I'm coming from places like Why not use "which"? What to use then? and https://stackoverflow.com/questions/592620/how-to-check-if-a-program-exists-from-a-bash-script and am myself a long-...
tripleee's user avatar
  • 7,699
5 votes
0 answers
611 views

Convert an existing customised Debian 10 Installation to Live ISO

Can someone help please? I already did some research and found: Linux Respin completely messed up my system when trying to install dependencies (removed a lot of packages I needed) - at least I am ...
tuxbud's user avatar
  • 53
0 votes
0 answers
32 views

Is it possible to have bash but not awk? [duplicate]

Here on Stack Exchange we often see answers on bash questions, that use tools other than the bash language, such as awk, sed, grep, etc. These tools are specific in POSIX, so they should be ...
user000001's user avatar
  • 3,635
2 votes
1 answer
2k views

POSIX and Portability | shell scripts | grep -s, grep -q

I am all in for portability in regards to shell scripts. But I am unsure if I am overdoing it right now. In this example, we have a function called confirmation, which accepts the very first ...
Vlastimil Burián's user avatar
4 votes
1 answer
701 views

Does POSIX make not support globs in prerequisites?

I was reading the POSIX 7 Make definition, and I've noticed that prerequisites are almost always described as “files”: The make utility examines time relationships and shall update those derived ...
Ainar-G's user avatar
  • 347
1 vote
1 answer
689 views

Wildcards/Globbing: Are character ranges problematic?

In The Linux Command Line William Shotts claims that character ranges can be problematic. See the relevant excerpt below, emphasis is mine. Character Ranges If you are coming from another Unix-like ...
Git Gud's user avatar
  • 177
1 vote
1 answer
2k views

Portable way to run command without PATH from bash script

cron calls my bash script (it's a backup script) with a very sparse PATH of /usr/bin:/usr. As a result, while a line like lvcreate --size 1G --snapshot ... works just fine when I run the script from ...
Andreas K's user avatar
3 votes
2 answers
683 views

Recommended way of checking only one running service?

I am writing a shell script to check if mongod server is running and if not, to start it. To acheive that I am using the below command: systemctl is-active --quiet mongod This does the job as ...
TheLittleNaruto's user avatar
29 votes
3 answers
4k views

Porting Linux to another platform requirements [closed]

I know that Linux is available and has been ported for many different platforms such as for X86, ARM, PowerPC etc. However, in terms of porting, what is required exactly? My understanding is that ...
Engineer999's user avatar
  • 1,151
8 votes
1 answer
5k views

How does glibc within a Docker image survive different container host kernels?

Docker containers share the kernel of the host, but they do include their own applications and libraries. Is it correct that glibc is one of these libraries? If so, how come there is no problem of ...
Overv's user avatar
  • 183