Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
3
votes
2
answers
873
views
How can I ascertain which kernel (not version; kernel) is in use?
I want to be able to ascertain what kernel is in use across modern, UNIX-derivative OSes. This appears feasible, considering that utilities like `uname` exist on multiple OSes with different kernels. However, if we consider the venerable `uname` to be a usable example, it soon fails at this: it prin...
I want to be able to ascertain what kernel is in use across modern, UNIX-derivative OSes.
This appears feasible, considering that utilities like
uname
exist on multiple OSes with different kernels. However, if we consider the venerable uname
to be a usable example, it soon fails at this: it prints “Darwin” on macOS, which isn't the name of the *kernel*. It's XNU. (macOS is, in effect, the DE running atop the Darwin OS). In contrast, uname
on cpe:/o:fedoraproject:fedora:42
prints “Linux”, which is the name of the kernel, rather than the base of the OS (GNU's CoreUtils). That kind of inconsistency renders it unreliable for this.
My goal might seem niche, because it is. However, if I've got a system running macOS, another running Hurd-based Debian , and another running Linux-based Fedora, what tool can I utilise to ascertain the kernel in use? (I suppose I could just look in /boot/efi
?)
RokeJulianLockhart
(541 rep)
Aug 3, 2025, 02:57 PM
• Last activity: Aug 4, 2025, 01:21 AM
0
votes
4
answers
9538
views
How to visualise eml files?
I have many email archived in `eml` format. The problem is that I can't view them without installing an email client and importing eml files, which is tedious and not what i want. Ideally, I would like to find something like a pdf viewer that opens when you click on the file. I currently use `munpac...
I have many email archived in
eml
format. The problem is that I can't view them without installing an email client and importing eml files, which is tedious and not what i want.
Ideally, I would like to find something like a pdf viewer that opens when you click on the file.
I currently use munpack -t
that extracts attachments and text in separate files. It kinda works but it's tedious.
As a reference, when I am on a Windows desktop, I use quicklook which opens the eml file like any other text or pdf file.
Any idea ?
GnuSam
(41 rep)
Oct 19, 2022, 08:29 AM
• Last activity: Jul 18, 2025, 01:40 AM
1
votes
1
answers
2956
views
how to run fio verify reliably in linux
I am using `fio` over disks exposed through iscsi. I am giving these params in `fio` ``` fio --name=randwrite --ioengine=libaio --iodepth=64 --rw=randrw --rwmixread=50 --bs=4k-2M --direct=1 -filename=data --numjobs=1 --runtime 36000 --verify=md5 --verify_async=4 --verify_backlog=100000 --verify_dump...
I am using
fio
over disks exposed through iscsi. I am giving these params in fio
fio --name=randwrite --ioengine=libaio --iodepth=64 --rw=randrw --rwmixread=50 --bs=4k-2M --direct=1 -filename=data --numjobs=1 --runtime 36000 --verify=md5 --verify_async=4 --verify_backlog=100000 --verify_dump=1 --verify_fatal=1 --time_based --group_reporting
With the above parameters can fio
send overlap concurrent writes of size more than page size.
If yes, then how does fio
verify the checksum because atomicity of io is not guaranteed across page size.
rishabh mittal
(31 rep)
Jul 27, 2019, 04:52 AM
• Last activity: Jun 5, 2025, 02:06 AM
87
votes
8
answers
21873
views
How to trick a command into thinking its output is going to a terminal
Given a command that changes its behaviour when its output is going to a terminal (e.g. produce coloured output), how can that output be redirected in a pipeline while preserving the changed behaviour? There must be a utility for that, which I am not aware of. Some commands, like `grep --color=alway...
Given a command that changes its behaviour when its output is going to a terminal (e.g. produce coloured output), how can that output be redirected in a pipeline while preserving the changed behaviour? There must be a utility for that, which I am not aware of.
Some commands, like
grep --color=always
, have option flags to force the behaviour, but the question is how to work around programs that rely solely on testing their output file descriptor.
If it matters, my shell is bash
on Linux.
Amir
(1891 rep)
Dec 16, 2015, 01:39 PM
• Last activity: Mar 25, 2025, 03:01 PM
0
votes
1
answers
22
views
What is "bcomps" used for?
Found this binary in my Fedora install while trying to autocomplte `bcompare`. Running it with `--help` doesn't even say what it does. https://linux.die.net/man/1/bcomps says "biconnected components filter for graphs". What do I need that for? Why is it bundled with Fedora? ```sh $ bcomps -? Usage:...
Found this binary in my Fedora install while trying to autocomplte
bcompare
. Running it with --help
doesn't even say what it does. https://linux.die.net/man/1/bcomps says "biconnected components filter for graphs". What do I need that for? Why is it bundled with Fedora?
$ bcomps -?
Usage: bcomps [-stvx?] [-o]
-o - output file template
-s - don't print components
-t - emit block-cutpoint tree
-v - verbose
-x - external
-? - print usage
If no files are specified, stdin is used
Mad respect for the developer having a [PhD in math](https://ieeexplore.ieee.org/author/37299368000) from MIT and being a cited author, but a 101 in usability wouldn't hurt.
Dan Dascalescu
(7827 rep)
Mar 18, 2025, 08:02 AM
• Last activity: Mar 18, 2025, 08:12 AM
0
votes
0
answers
14
views
Is there a canonical way to add a file to the "recently used" list from a shell script?
Well-behaved apps add the files they are saving to `.local/share/recently-used.xbel` so that they are easily retrieved when using another app (for instance, browser for upload). So, if a shell script produces a file, is there a utility that can be used to add it to `recently-used.xbel`?
Well-behaved apps add the files they are saving to
.local/share/recently-used.xbel
so that they are easily retrieved when using another app (for instance, browser for upload).
So, if a shell script produces a file, is there a utility that can be used to add it to recently-used.xbel
?
xenoid
(9288 rep)
Feb 14, 2025, 08:37 AM
3
votes
1
answers
462
views
Filter tasks scheduled for the future in Taskwarrior
My custom report in Taskwarrior is set to the following: report.custom.filter=status:pending I would like to change this so that tasks scheduled for the future are hidden until their start date. For example, instead of: username@hostname:~% task custom ID PROJECT TAGS DUE DESCRIPTION 9 Reading next...
My custom report in Taskwarrior is set to the following:
report.custom.filter=status:pending
I would like to change this so that tasks scheduled for the future are hidden until their start date. For example, instead of:
username@hostname:~% task custom
ID PROJECT TAGS DUE DESCRIPTION
9 Reading next Read Gödel, Escher, Bach
10 Social waiting 4mo Wish Alice a happy birthday
in which task 10 has the property
scheduled:2018-01-01
, I would like instead to see:
username@hostname:~% task custom
ID PROJECT TAGS DUE DESCRIPTION
9 Reading next Read Gödel, Escher, Bach
And then for task 10 to appear on 2018-01-01.
gmarmstrong
(1283 rep)
Nov 30, 2017, 07:14 PM
• Last activity: Feb 3, 2025, 01:51 PM
6
votes
1
answers
2977
views
Taskwarrior: Recurring tasks that are due relative to the day of recurence
I would like to create a task in taskwarrior that repeats every day and is due every day or the day after. Is that possible? Didn't find anything on the net or the documentation.
I would like to create a task in taskwarrior that repeats every day and is due every day or the day after. Is that possible?
Didn't find anything on the net or the documentation.
lukmi
(73 rep)
Jul 5, 2017, 05:05 AM
• Last activity: Feb 3, 2025, 01:51 PM
10
votes
2
answers
8600
views
Which linux command-line tool can view, search, add contacts to/from a .vcf file?
I've downloaded my contact list in `.vcf` format to my Linux machine. Now I would like to edit it locally (offline). The search feature is most important. I've got a script with grep and so on but I was hoping someone had already done the work to make things beautiful and readable.
I've downloaded my contact list in
.vcf
format to my Linux machine.
Now I would like to edit it locally (offline). The search feature is most important.
I've got a script with grep and so on but I was hoping someone had already done the work to make things beautiful and readable.
philou
(237 rep)
Mar 19, 2020, 10:20 AM
• Last activity: Jan 2, 2025, 12:09 AM
6
votes
3
answers
7244
views
Set alignment of numeric columns when columnating data
I use [`column -t`][1] to format data for easy viewing in the shell, but there seems to be no option to specify column alignment (e.g. align to the right). Any Bash one-liners to do it? I have arbitrary number of columns. [1]: https://unix.stackexchange.com/questions/17664/a-shell-tool-to-tablify-in...
I use
column -t
to format data for easy viewing in the shell, but there seems to be no option to specify column alignment (e.g. align to the right).
Any Bash one-liners to do it? I have arbitrary number of columns.
Alex B
(4598 rep)
Dec 12, 2011, 03:45 AM
• Last activity: Jan 1, 2025, 11:12 AM
462
votes
18
answers
643427
views
How can I use sed to replace a multi-line string?
I've noticed that, if I add `\n` to a pattern for substituting using `sed`, it does not match. Example: $ cat > alpha.txt This is a test Please do not be alarmed $ sed -i'.original' 's/a test\nPlease do not/not a test\nBe/' alpha.txt $ diff alpha.txt{,.original} $ # No differences printed out How ca...
I've noticed that, if I add
\n
to a pattern for substituting using sed
, it does not match. Example:
$ cat > alpha.txt
This is
a test
Please do not
be alarmed
$ sed -i'.original' 's/a test\nPlease do not/not a test\nBe/' alpha.txt
$ diff alpha.txt{,.original}
$ # No differences printed out
How can I get this to work?
Belmin Fernandez
(9877 rep)
Dec 7, 2011, 06:03 PM
• Last activity: Dec 24, 2024, 02:10 PM
0
votes
1
answers
55
views
Looking for slideshow utility with custom/configurable randomisation
I'm looking for a way to provide custom/configurable randomisation to a slideshow tool like `impressive` or `feh` (something lightweight I can run automatically at startup). Basically I need to weight certain directories according to how many photos there are in each. Like, if there are two director...
I'm looking for a way to provide custom/configurable randomisation to a slideshow tool like
impressive
or feh
(something lightweight I can run automatically at startup). Basically I need to weight certain directories according to how many photos there are in each.
Like, if there are two directories and one contains 90 photos and the other contains only 10, the time spent in each directory should depend not only on how many photos there are in total but also on how many directories there are, so somewhere between 10-50% of the time you might be looking at one from the 10 and the remaining 50-90% of the time you might be looking at one from the 90, according to some custom logic/math, rather than simply having a 10/90 split. Essentially I want to set a lower limit on the bias toward any given directory but still maintain some semblance of the relative proportions of each.
I might be able to do this in some jury-rigged way, but maybe someone knows of a way to do it out of the box. Is there anything like this or that might accomplish something similar? Thanks!
Edit:
Following the great advice below I set up the following randomisation function, adding bias toward directories with more photos by adding a coefficient which multiplies against the standing probability to determine how much of it is freed. Then, rather than redistribute probabilities according to fixed amounts, I chose to do so according to the existing 'stakes' on the rest of it. The resulting dynamics are such that those with biases toward losing less tend preferentially to receive the freed probability and are better able to maintain their supply, simply for having more and thus attracting more of what is freed elsewhere, but not in such a way that would never yield to the other directories, which every once in a while come due in accordance with their own, comparatively weaker biases. (The result of the bias calculation is proportional to the percent contribution of a directory to the total number of photos, but normalised around the value for an equal share that would be obtained when all directories contribute equally, such that those above this threshold are represented somewhat less than they would be otherwise, and those below somewhat more.)
To the more crucial point, as to how to leverage this functionality with respect to the image/slideshow utility: It interacts with the directory containing the photos being actively used (feh
, the only one I could figure out how to get to work (so not fbi
) and update its view of the directory as files change (so not impressive
)). There is an option to have a sequence of photos active at once, back from when I thought I'd be able to use impressive
and get transitions working, but that doesn't seem likely anymore. All the directory and photo selection and the redistribution of probability happens in this python script, once for every image change in the slideshow (and is self-correcting to the system clock, with the hope feh
doesn't lose or gain time somehow, so that the two won't eventually desync). I was hoping there might be a formal way to do this somehow, but I'm not sure there is. Anyway, it seems like it works. If anyone sees this and takes offence at the sight of my python or shell scripting don't hesitate to set me right, if you feel like it.
I have one more component I need to work out which is to have it execute automatically after startup and establishing a network connection, but that's not so relevant to the question I was asking. But at any rate here is everything so far:
# Slideshow
import os
from datetime import datetime, timedelta
from random import random
import shutil
import time
src_dir = './photos/src'
active_dir = './photos/active'
active_photo_interval = 24
valid_exts = ['.' + e for e in ['jpg', 'jpeg', 'png']]
photos = [[f.path for f in os.scandir(d.path) if f.is_file and os.path.splitext(f.path)[-1] in valid_exts] for d in os.scandir(src_dir) if d.is_dir()]
photos = [p for p in photos if len(p)]
total_members = len(photos)
total_photos = sum(len(p) for p in photos)
members = [
{
'prob': [
i/len(photos)
, (i + 1)/len(photos)
]
, 'bias': 1 - (len(photos[i])/total_photos - (len(photos[i])/total_photos - 1/total_members)*((total_members - 1)/total_members)**total_members)
, 'photos': [
{
'prob': [
k/len(photos[i])
, (k + 1)/len(photos[i])
]
, 'path': photos[i][k]
} for k in range(0, len(photos[i]))
]
} for i in range(0, len(photos))
]
def get_image():
mrand = random()
midx = next(i for i,m in enumerate(members) if m['prob'] 1:
freed_prob = (member'prob' - member['prob']) * member['bias']
total_standing_prob = sum(m'prob' - m['prob'] for i,m in enumerate(members) if i != midx)
for i,m in enumerate(members):
standing_prob = m'prob' - m['prob']
prob_stake = standing_prob/total_standing_prob
m['prob'] = 0 if i == 0 else members[i - 1]['prob'][1]
m'prob' = 1 if i + 1 == len(members) else m['prob'] + standing_prob + (freed_prob * prob_stake if i != midx else -freed_prob)
photos = member['photos']
prand = random()
pidx = next(i for i,p in enumerate(photos) if p['prob'] 1:
freed_prob = photo'prob' - photo['prob']
share_freed_prob = freed_prob/(len(photos) - 1)
for i,p in enumerate(photos):
standing_prob = p'prob' - p['prob']
p['prob'] = 0 if i == 0 else photos[i - 1]['prob'][1]
p'prob' = 1 if i + 1 == len(photos) else p['prob'] + standing_prob + (share_freed_prob if i != pidx else -freed_prob)
return photo['path']
active_photos_max = 1
active_photos = []
if os.path.isdir(active_dir):
active_photos = [f.path for f in os.scandir(active_dir) if f.is_file]
else:
os.mkdir(active_dir)
time_next = datetime.now()
while True:
time_next = time_next + timedelta(seconds=active_photo_interval)
active_photos.insert(0, get_image())
shutil.copy(active_photos, active_dir)
old_photos = [os.path.join(active_dir, p.split('/')[-1]) for p in active_photos[active_photos_max:]]
for p in old_photos: os.remove(p)
active_photos = active_photos[:active_photos_max]
while datetime.now() < time_next:
time.sleep(1)
#!/usr/bin/env bash
# Main
SYNC_INTERVAL=$(( 24 * 60 * 60 ))
while true
do
python ./slideshow.py &
sleep $SYNC_INTERVAL
kill $!
bash ./sync.sh
done
#!/usr/bin/env bash
# Entry/startup
. ./set_vars.sh
bash ./sync.sh
bash ./main.sh &
sleep 2
feh -R 24 -D 24 -Z -F -Y $ACTIVE_DIR
fjdksflds
(1 rep)
Dec 20, 2024, 02:26 PM
• Last activity: Dec 23, 2024, 05:39 AM
7
votes
1
answers
1745
views
How to override warning in Taskwarrior?
I have the following output whenever I issue `task`: TASKRC override: /path/taskrc TASKDATA override: /path/.task It's because I put the config and data files in non-default external location specified by `$TASKRC` and `$TASKDATA` environment variables of [Taskwarrior](https://taskwarrior.org/). How...
I have the following output whenever I issue
task
:
TASKRC override: /path/taskrc
TASKDATA override: /path/.task
It's because I put the config and data files in non-default external location specified by $TASKRC
and $TASKDATA
environment variables of [Taskwarrior](https://taskwarrior.org/) .
How could I make task
to be quiete and not warn me everytime.
I'd like to find the command line switch to make it quiet for the issueing time (once) and the also config file option to make it permanent, if any.
user86041
May 25, 2017, 10:39 AM
• Last activity: Nov 10, 2024, 05:56 AM
2
votes
1
answers
307
views
What does (or did) the name "feh" represent?
To me, the name of the [feh image viewer][1] is not memorable enough for me to recall it when I need it. I feel that if I had some context, I'd be able to remember it better. **What, if anything, does the name "feh" stand for?** [1]: https://linux.die.net/man/1/feh
To me, the name of the feh image viewer is not memorable enough for me to recall it when I need it. I feel that if I had some context, I'd be able to remember it better.
**What, if anything, does the name "feh" stand for?**
Steve V.
(1055 rep)
Jun 20, 2021, 07:41 PM
• Last activity: Oct 30, 2024, 10:04 AM
77
votes
4
answers
207982
views
How can I test the encoding of a text file... Is it valid, and what is it?
I have several `.htm` files which open in [Gedit][1] without any warning/error, but when I open these same files in `Jedit`, it warns me of invalid UTF-8 encoding... The HTML meta tag states "charset=ISO-8859-1". Jedit allows a *List of fallback encodings* and a *List of encoding auto-detectors* (cu...
I have several
.htm
files which open in Gedit without any warning/error, but when I open these same files in Jedit
, it warns me of invalid UTF-8 encoding...
The HTML meta tag states "charset=ISO-8859-1". Jedit allows a *List of fallback encodings* and a *List of encoding auto-detectors* (currently "BOM XML-PI"), so my immediate problem has been resolved. But this got me thinking about: What if the meta data wasn't there?
When the encoding information is just not available, is there a CLI program which can make a "best-guess" of which encodings may apply?
And, although it is a slightly different issue; is there a CLI program which tests the validity of a *known* encoding?
Peter.O
(33644 rep)
Apr 19, 2011, 07:16 AM
• Last activity: Oct 17, 2024, 08:43 PM
96
votes
13
answers
28474
views
Linux tools to treat files as sets and perform set operations on them
Does anyone know of any linux tool specifically designed to treat files as sets and perform set operations on them? Like difference, intersection, etc?
Does anyone know of any linux tool specifically designed to treat files as sets and perform set operations on them? Like difference, intersection, etc?
nilton
(1063 rep)
Apr 14, 2011, 09:19 PM
• Last activity: Sep 30, 2024, 07:46 AM
4
votes
1
answers
447
views
How can I verify integrity of the document types?
Are there any utilities to verify integrity of common document types used in the office environment (docx, pptx, xlsx, pdf, common image, audio and video files) without using the actual applications? Contents of some documents of ours proved to be damaged due to storage issues. So, I need to sweep a...
Are there any utilities to verify integrity of common document types used in the office environment (docx, pptx, xlsx, pdf, common image, audio and video files) without using the actual applications?
Contents of some documents of ours proved to be damaged due to storage issues. So, I need to sweep across the whole filesystem to verify all the files and report which of them are actually impacted.
The damaged content can be anywhere in the file, so just verifying file headers - like the *file* command does - or checking the file properties (length, dates), etc., won't be good enough. I need a tool which would open the files, verify integrity of their internal structures, and report the result either on stdout or through an exit code.
A solution which would do all the job and provide a final report would do as well, of course, if it already exists - it would save me a lot of scripting work. ;-)
I assume random technical issues, not a deliberate tampering - so I do not need to verify the actual contents of the documents. What I need is to identify the files which would probably fail to open in their respective apps.
Looking forward to receiving your suggestions.
Jasio
(634 rep)
Sep 12, 2024, 11:55 AM
• Last activity: Sep 12, 2024, 12:43 PM
0
votes
0
answers
33
views
Tools for examining usermode memory
What tools are available for examining detailed memory allocations in user mode processes? For example: - What are the flags at the virtual page level? - What are the physical addresses (and their flags) mapped to virtual pages? - List the pages that are swapped out (when the system is under memory...
What tools are available for examining detailed memory allocations in user mode processes? For example:
- What are the flags at the virtual page level?
- What are the physical addresses (and their flags) mapped to virtual pages?
- List the pages that are swapped out (when the system is under memory pressure)?
- Which pages are in a copy-on-write state vs. unallocated vs. allocated to a process?
- How do you test changes to the Linux Kernel memory manager?
In my experience, memory management (on live systems) is messy and nondeterministic. I’m curious if anyone knows about tools for testing/examining memory at a page level?
I feel like I’m missing something and there must be tools that help people with these sorts of questions.
I know the Kernel gives us a few windows into what it's doing:
-
/proc/self/maps
- /proc/self/pagemap
- /proc/iomem
- /proc/kpagecount
- /proc/kpageflags
... but I haven't found a tool that makes it easy to visualize this information.
Any feedback you can offer would be much appreciated and I sincerely appreciate your time.
Very Respectfully,
Mark Nelson
Mark Nelson
(1 rep)
Sep 6, 2024, 05:13 AM
4
votes
5
answers
2100
views
How to transpose a text file on character basis
There are some tools like `datamesh` to transpose a matrix in a `csv` file, but I want to exchange rows and columns character based. So a file abcde fghij klmn opqrs should become afko bglq chmq dinr ej s Note that as line 3 is shorter, a whitespace has to be inserted in the last row. Of source I co...
There are some tools like
datamesh
to transpose a matrix in a csv
file, but I want to exchange rows and columns character based. So a file
abcde
fghij
klmn
opqrs
should become
afko
bglq
chmq
dinr
ej s
Note that as line 3 is shorter, a whitespace has to be inserted in the last row.
Of source I could write some C program to do it, but I thought I once met a tool to do this, but my search engine doesn't help me find it.
Philippos
(13680 rep)
Aug 1, 2017, 01:54 PM
• Last activity: Aug 20, 2024, 03:22 AM
2
votes
3
answers
1001
views
Are they commands or utilities?
I'm trying to figure out the correct term(s) for Unix/Linux "commands." Specifically, I have always understood that technically *commands* (e.g., `cd`) are built into the shell, and that other "commands" (e.g., `rm`, `ls`, `mkdir`, `cp`, `mv`) are better termed *utilities*, as they are stand-alone p...
I'm trying to figure out the correct term(s) for Unix/Linux "commands." Specifically, I have always understood that technically *commands* (e.g.,
cd
) are built into the shell, and that other "commands" (e.g., rm
, ls
, mkdir
, cp
, mv
) are better termed *utilities*, as they are stand-alone programs. (As far as I can tell, rm
, etc. are all in /bin
.) Furthermore, one way to tell whether something is a command is to see if it has a man page: commands don't, but utilities do. However, all of the sources I've found via Google use "commands" exclusively. Can someone set me straight on this or point me towards an appropriate reference?
Since exit
doesn't have a man page and isn't in /bin
, is it, like cd
, a true command?
Mark Pauley
(61 rep)
May 26, 2022, 12:43 AM
• Last activity: Aug 14, 2024, 02:54 AM
Showing page 1 of 20 total questions