Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
9
votes
6
answers
32115
views
Progressbar in bash to visualize the time to wait
In a bash script sometimes you need the user to wait some seconds for a background process to finish. I usually use for example: sleep 10 How can I add a kind of progressbar to the script, so the user knows how long to wait? I installed the command `bar` but I don't understand the manual.
In a bash script sometimes you need the user to wait some seconds for a background process to finish.
I usually use for example:
sleep 10
How can I add a kind of progressbar to the script, so the user knows how long to wait?
I installed the command
bar
but I don't understand the manual.
rubo77
(30435 rep)
Sep 30, 2013, 04:25 AM
• Last activity: Jul 14, 2025, 07:27 PM
2
votes
2
answers
5754
views
How to generate thumbnails/previews for files?
I wrote an app for Windows and macOS and I am in the process of porting it to Linux. My app has a file browser implemented and can display thumbnails or document icons of files. On Windows I get access to the file thumbnails (or document icons if there is no thumbnail support) through the shell exte...
I wrote an app for Windows and macOS and I am in the process of porting it to Linux. My app has a file browser implemented and can display thumbnails or document icons of files.
On Windows I get access to the file thumbnails (or document icons if there is no thumbnail support) through the shell extensions.
On MacOS I can generate the thumbnails (or document icons) through QuickLook.
On Linux, what would be the way to go to...
1... generate a thumbnail e.g. for JPEGs, PNGs
2... fallback to extract document icons for the file if no thumbnail is available?
Thank you!
HelloWorld
(121 rep)
Jun 12, 2021, 01:04 PM
• Last activity: Nov 13, 2024, 07:40 PM
0
votes
1
answers
108
views
Keyboard buffer management
On Linux, when a shell is running a process it usually allows you to keep typing commands which will be processed when the process finishes. The same can be observed in other applications that behave *like* a "shell". For example, say we do this in `ipython`: ``` import time time.sleep(4) ``` While...
On Linux, when a shell is running a process it usually allows you to keep typing commands which will be processed when the process finishes. The same can be observed in other applications that behave *like* a "shell". For example, say we do this in
ipython
:
import time
time.sleep(4)
While "sleeping", we can still use the keyboard and anything put on the buffer will be delivered to the input of ipython
upon returning from the sleep
function.
However, while **some** processes are working, the keyboard is completely blocked. It is not only that the characters are not echoed on the terminal but they are not even available on the prompt when the process returns.
What is this difference due to? Is this something to do with the process itself? How can I replicate this characteristic? That is, what do I need to have in place in my programs so that when they run, the keyboard buffer is completely ignored?
A_A
(173 rep)
Jul 15, 2024, 09:11 AM
• Last activity: Jul 15, 2024, 10:08 AM
1
votes
0
answers
52
views
Running a program/script before a user logs in on RedHat Linux GUI
I am looking to run a script prior to a user being able to log in on the GUI. Its a basic script, do you accept Ts&Cs Y/N, enter user name, data is captured and stored. Then once complete takes them to the log in screen. My issue is I am unsure where or how this would run (being relatively new to Li...
I am looking to run a script prior to a user being able to log in on the GUI.
Its a basic script, do you accept Ts&Cs Y/N, enter user name, data is captured and stored. Then once complete takes them to the log in screen.
My issue is I am unsure where or how this would run (being relatively new to Linux and scripting). I have searched and played about with gdm in terms of just displaying a user agreement when logging in but I would like to create something the user has to interact with.
Any pointers on where and how to start would be appreciated.
K_Sparky1029
(11 rep)
Jun 26, 2024, 08:29 PM
0
votes
0
answers
132
views
How to "wake-up" user space threads from kernel?
Suppose you have a kernel device driver receiving data and a user space threads waiting for the data. You want to avoid wasted cycles by having the user space thread block and wake-up once the kernel driver has processed the data and put it in an appropriate buffer. What is the appropriate way to do...
Suppose you have a kernel device driver receiving data and a user space threads waiting for the data.
You want to avoid wasted cycles by having the user space thread block and wake-up once the kernel driver has processed the data and put it in an appropriate buffer.
What is the appropriate way to do this? I have read mixed thoughts on using signals.
FourierFlux
(183 rep)
Apr 1, 2024, 03:07 PM
0
votes
0
answers
124
views
Geany: Possible to automatically enable/disable line wrap dependent on file type?
In [Geany][1] text editor / IDE, is there a way to tell it to automatically enable **line wrapping** for certain file types, but not for others? For example, for `.txt` files, I would like it to always enable **line wrapping**, but for `.c` and `.asm` files, I do not want **line wrapping** enabled....
In Geany text editor / IDE, is there a way to tell it to automatically enable **line wrapping** for certain file types, but not for others?
For example, for
.txt
files, I would like it to always enable **line wrapping**, but for .c
and .asm
files, I do not want **line wrapping** enabled.
Amazon Dies In Darkness
(281 rep)
Feb 28, 2024, 03:01 AM
-4
votes
1
answers
86
views
Why build a .deb package vs simply including files?
I'm confused as to why you would create a .deb package vs simply putting your program in a folder + additional files and writing an install script. What are the value of packages?
I'm confused as to why you would create a .deb package vs simply putting your program in a folder + additional files and writing an install script.
What are the value of packages?
FourierFlux
(183 rep)
Jan 27, 2024, 06:59 PM
• Last activity: Jan 28, 2024, 09:36 AM
-1
votes
1
answers
63
views
Searching for an old laptop to learn linux
I have years of experience in programming algorithms and compiling statistics. Now I would like to develop my skills and immerse myself in the world of Linux in order to get more involved with the computer itself. That's why I wanted to get an old laptop at a reasonable price to learn Linux. A frien...
I have years of experience in programming algorithms and compiling statistics.
Now I would like to develop my skills and immerse myself in the world of Linux in order to get more involved with the computer itself.
That's why I wanted to get an old laptop at a reasonable price to learn Linux. A friend of mine made the following suggestions:
- Lenovo Thinkpad X220
- Macbook Pro 13 mid 2014 Retina
What would you suggest? Preferably cheap laptops that I can work on myself in case of problems so that I can also learn from them and that I can also work with them. It should also be possible to program.
PaiThon
(15 rep)
Jan 17, 2024, 08:15 AM
• Last activity: Jan 17, 2024, 08:52 AM
26
votes
8
answers
24299
views
How can I run BASIC code in a terminal?
I would like to run BASIC code, like you used to do on older computers, in Linux. (I am looking for a BASIC interpreter that can run OS functions natively) What options do I have? (Preferably for Debian-based and Arch-based)
I would like to run BASIC code, like you used to do on older computers, in Linux.
(I am looking for a BASIC interpreter that can run OS functions natively)
What options do I have? (Preferably for Debian-based and Arch-based)
DiamondCoderMan
(369 rep)
Apr 16, 2017, 02:02 PM
• Last activity: Nov 7, 2023, 08:27 PM
5
votes
4
answers
8866
views
How can I make my Linux server sleep and wake on LAN when not in use?
I have recently purchased myself an HP rack server for use as a personal fileserver. This server currently lives under my bed as I have nowhere else to put it. For those not aware (as I was not fully) this server is **VERY LOUD**. I need to be able to access my files a lot of the time during the day...
I have recently purchased myself an HP rack server for use as a personal fileserver. This server currently lives under my bed as I have nowhere else to put it. For those not aware (as I was not fully) this server is **VERY LOUD**.
I need to be able to access my files a lot of the time during the day, and due to the situation of my server, turning it off every night at the wall (it likes to suddenly spring into action for no apparent reason) isn't really an option. I would _really_ like if the server could remain powered on all the time, but when not in use enter a sleep state such that the fans turn off, if nothing else, over LAN. The server also runs Debian.
If this kind of setup can't happen for whatever reason, I could settle for the machine shutting down at a certain time of day (or night) and starting up again in the morning, or something to that effect.
I have very little idea about how to go about such a task, other than to use wake/sleep-on-LAN.
James Stone
(51 rep)
Jan 24, 2018, 05:25 PM
• Last activity: Oct 10, 2023, 04:07 PM
16
votes
2
answers
18415
views
Command-line diff tool
So we all have the `diff` command installed by default. I certainly don't know how to use it *well*. But I would expect some reasonable default usage. Yet when I type `diff file1 file2` I get ... a text ... which I have to parse in my head ... which is not helped by the fact that this is a weird com...
So we all have the
diff
command installed by default. I certainly don't know how to use it *well*. But I would expect some reasonable default usage. Yet when I type diff file1 file2
I get ... a text ... which I have to parse in my head ... which is not helped by the fact that this is a weird combination of two texts, which are in turn very complex themselves.
So I looked for a graphical solution, e.g. meld
. That works much much better out of the box.
Yet I would prefer to have the luxury of staying on the command line all the time. Is there a fairly standard command which:
- uses colour by default and can adopt syntax highlighting
- presents side-by-side diffs and does 3-way merges by default
- works on the command line, e.g. via libncurses
- depends on neither vim
, emacs
nor an IDE
- can modify edited files in place?
If not, why not? I looked into colordiff
but it doesn't quite cut it.
Vorac
(3197 rep)
Feb 5, 2019, 03:02 PM
• Last activity: Oct 10, 2023, 03:36 PM
0
votes
2
answers
369
views
What is lsh_ used for and/or what is it doing?
I am new to programming in Linux and I am quite confused. I notice the `lsh_` prefix is used for function names [here](https://brennan.io/2015/01/16/write-a-shell-in-c/). I'm not sure why. The only thing I can find on the internet is that `lsh` could possibly mean "limited shell". However, it is not...
I am new to programming in Linux and I am quite confused. I notice the
lsh_
prefix is used for function names [here](https://brennan.io/2015/01/16/write-a-shell-in-c/) . I'm not sure why.
The only thing I can find on the internet is that lsh
could possibly mean "limited shell". However, it is not clear. If that is what it means, what is a "limited shell" and how or why are we using it?
example: lsh_loop()
Tricepticon
(13 rep)
Oct 5, 2021, 06:49 PM
• Last activity: Jul 29, 2023, 11:55 AM
1
votes
2
answers
1439
views
Is there a way to do namespaces like in C for bash?
What I'm talking about is like in C, you get to use namespaces with the statement `using namespace blah blah blah`, can you do the same thing but in bash?
What I'm talking about is like in C, you get to use namespaces with the statement
using namespace blah blah blah
, can you do the same thing but in bash?
trent
(27 rep)
May 3, 2023, 01:10 AM
• Last activity: May 3, 2023, 11:04 PM
0
votes
1
answers
622
views
Are there Visual Studio -like tools for creating forms in Linux?
I want to create forms in Linux. I create Windows forms, but for example if I was to use Linux to develop is there any software I could use to create a form like you would in Visual Studio?
I want to create forms in Linux.
I create Windows forms, but for example if I was to use Linux to develop is there any software I could use to create a form like you would in Visual Studio?
gsmyth377
(3 rep)
Apr 4, 2023, 04:13 PM
• Last activity: Apr 4, 2023, 04:35 PM
1
votes
1
answers
225
views
Sending data with raw socket over gretap
I'm trying to write an IS-IS packet to gretap interface with ISO (0x00fe) protocol type. In this case there is no ethernet header so I'm using raw socket. The gretap always puts 0x6558 as the protocol type in the GRE header, is there a way I can make gretap use a different protocol type (ie 0x00fe)...
I'm trying to write an IS-IS packet to gretap interface with ISO (0x00fe) protocol type. In this case there is no ethernet header so I'm using raw socket. The gretap always puts 0x6558 as the protocol type in the GRE header, is there a way I can make gretap use a different protocol type (ie 0x00fe) so the receiver is expecting to see IS-IS packet immediately after the GRE header (ie no ethernet header first)?
Follow-up:
I think the protocol type is hard-coded, ie (from ip_gre.c in kernel):
761 static netdev_tx_t gre_tap_xmit(struct sk_buff *skb,
762 struct net_device *dev)
763 {
...
776
777 __gre_xmit(skb, dev, &tunnel->parms.iph, htons(ETH_P_TEB));
778 return NETDEV_TX_OK;
The symbol ETH_P_TEB is the transparent ethernet bridge type (0x6558), so there's no option to set this value. This is unfortunate because if using raw socket we might want to generate a different encapsulation over the GRE. I will try modding the kernel module.
Barry
(21 rep)
Mar 17, 2023, 05:28 PM
• Last activity: Mar 19, 2023, 06:14 AM
30
votes
3
answers
10954
views
Will my linux binary work on all distros?
I found a good replacement IDE for Delphi called Lazarus. But I don't have a question for programmers. Will the **statically linked** Linux binary work on all Linux distributions? I.e. it does not matter on what Linux distro I built it and it will work on Debian / ArchLinux / Ubuntu / OpenSUSE / ......
I found a good replacement IDE for Delphi called Lazarus. But I don't have a question for programmers.
Will the **statically linked** Linux binary work on all Linux distributions? I.e. it does not matter on what Linux distro I built it and it will work on Debian / ArchLinux / Ubuntu / OpenSUSE / ... whatever?
As a result of my findings, does really only matter 32bit vs 64bit? I want to be sure before I publish.
Will the **statically linked** Linux binary work on all Linux distributions? I.e. it does not matter on what Linux distro I built it and it will work on Debian / ArchLinux / Ubuntu / OpenSUSE / ... whatever?
As a result of my findings, does really only matter 32bit vs 64bit? I want to be sure before I publish.
Vlastimil Burián
(30505 rep)
Sep 6, 2015, 07:21 PM
• Last activity: Mar 8, 2023, 12:46 AM
0
votes
1
answers
41
views
How can I en- and decompress a bootable image?
I have a bootable kernel image, that I had created with MinGW Toolchain's that available for Microsoft Windows 11. The Project is in size tiny, but I would know: "How can I shrink the image, if it grow to pass it on a Floppy Disk." Thanks for Ideas. Edit: You can found a Example OS for this request...
I have a bootable kernel image, that I had created with MinGW Toolchain's that available for Microsoft Windows 11.
The Project is in size tiny, but I would know: "How can I shrink the image, if it grow to pass it on a Floppy Disk."
Thanks for Ideas.
Edit:
You can found a Example OS for this request at my git account: [**paule32**](https://github.com/paule32/JustFunOS_win32/releases/tag/Release)
Jens
(1 rep)
Dec 27, 2022, 08:48 PM
• Last activity: Feb 22, 2023, 11:20 PM
1
votes
2
answers
489
views
Linearizing a fasta file and removing special characters in
I linearized a fasta file using using ````awk```` on a remote computer. when I used ````nano```` to open it, it showed that the file had linearized. However when I downloaded the file to my local computer, and I viewd it using Notepad the file that I had generated is back to it's original wrapped fo...
I linearized a fasta file using using
awk
on a remote computer.
when I used nano
to open it, it showed that the file had linearized. However when I downloaded the file to my local computer, and I viewd it using Notepad the file that I had generated is back to it's original wrapped format. Could you please advise what could be the reason.
This is the sequence:
`
>P1
MPPRRSIVEVKVLDVQKRRVPNKHYVYIIRVTWSSGATEAIYRRYSKFFDLQMQMLDKFP
MEGGQKDPKQRIIPFLPGKILFRRSHIRDVAVKRLIPIDEYCKALIQLPPYISQCDEVLQ
FFETRPEDLNPPKEEHIGKKKSGNDPTSVDPMVLEQYVVVADYQKQESSEISLSVGQVVD
IIEKNESGWWFVSTAEEQGWVPATCLEGQDGVQDEFSLQPEEEEKYTVIYPYTARDQDEM
NLERGAVVEVVQKNLEGWWKIRYQGKEGWAPASYLKKNSGEPLPPKLGPSSPAHSGALDL
DGVSRHQNAMGREKELLNNQRDGRFEGRLVPDGDVKQRSPKMRQRPPPRRDMTIPRGLNL
>P2
MAEVRKFTKRLSKPGTAAELRQSVSEAVRGSVVLEKAKLVEPLDYENVITQRKTQIYSDP
LRDLLMFPMEDISISVIGRQRRTVQSTVPEDAEKRAQSLFVKECIKTYSTDWHVVNYKYE
DFSGDFRMLPCKSLRPEKIPNHVFEIDEDCEKDEDSSSLCSQKGGVIKQGWLHKANVNST
ITVTMKVFKRRYFYLTQLPDGSYILNSYKDEKNSKESKGCIYLDACIDVVQCPKMRRHAF
ELKMLDKYSHYLAAETEQEMEEWLIMLKKIIQINTDSLVQEKKDTVEAIQEEETSSQGKA
ENIMASLERSMHPELMKYGRETEQLNKLSRGDGRQNLFSFDSEVQRLDFSGIEPDVKPFE
EKCNKRFMVNCHDLTFNILGHIGDNAKGPPTNVEPFFINLALFDVKNNCKISADFHVDLN
PPSVREMLWGTSTQLSNDGNAKGFSPESLIHGIAESQLCYIKQGIFSVTNPHPEIFLVVR
`
Then I used awk
to linearize it as follows:
`
awk '/^>/ {printf("\n%s\n",$0);next; } { printf("%s",$0);} END {printf("\n");}' out3.fasta
`
The output was :
`
>P1
MPPRRSIVEVKVLDVQKRRVPNKHYVYIIRVTWSSGATEAIYRRYSKFFDLQMQMLDKFP^MMEGGQKDPKQRIIPFLPGKILFRRSHIRDVAVKRLIPIDEYCKALIQLPPYISQCDEVLQ^MFFETRPEDLNPPKEEHIGKKKSGNDPTSVDPM$
>P2
MAEVRKFTKRLSKPGTAAELRQSVSEAVRGSVVLEKAKLVEPLDYENVITQRKTQIYSDP^MLRDLLMFPMEDISISVIGRQRRTVQSTVPEDAEKRAQSLFVKECIKTYSTDWHVVNYKYE^MDFSGDFRMLPCKSLRPEKIPNHVFEIDEDCEK$
`
The problem now is that when I download it to my local computer and view it on Notepad (on my windows computer) or MEGA it goes back t the wrapped format. What could be the reason for this? Another issue I faced was that when I tried to remove the carets (^) in the sequences using sed 's/\^//g' out3.fasta>seq3.fasta
it did not remove them. The $ is the line break
thole
(33 rep)
Dec 30, 2022, 07:39 PM
• Last activity: Jan 19, 2023, 10:22 PM
4
votes
2
answers
12678
views
Creating a bash script to install packages
I'm quite a newbie when it comes to bash. I'm trying to create a script that checks whether a package is installed or not. If not it will install that package. Not sure what I'm doing tbh. ``` #! /bin/bash echo Installing/Checking packages from list declare -a PKGS=("libreoffice", "firefox", "virtua...
I'm quite a newbie when it comes to bash. I'm trying to create a script that checks whether a package is installed or not. If not it will install that package. Not sure what I'm doing tbh.
#! /bin/bash
echo Installing/Checking packages from list
declare -a PKGS=("libreoffice", "firefox", "virtualbox", "vlc")
PKG_OK=$(dpkg-i -W --showformat='${Status}\n' PKGS |grep "install ok installed")
for i in "${PKGS[@]}"
do
if [ "" = "$PKG_OK" ]; then
echo "No $PKGS, installing the package now"
sudo apt install $PKGS[@]
fi
done
Scriptkid_bash
(49 rep)
Sep 16, 2022, 02:31 AM
• Last activity: Dec 28, 2022, 04:19 PM
-1
votes
3
answers
4975
views
What does it mean to both append and prepend a value to a variable (in fish shell or in general)?
Per the [fish shell documentation for the `set` command][1]: > **append**: causes the values to be *appended* to the current set of values for the variable. This can be used with *--prepend* to both > append and prepend at the same time. > > **prepend**: causes the values to be *prepended* to the cu...
Per the fish shell documentation for the
set
command :
> **append**: causes the values to be *appended* to the current set of values for the variable. This can be used with *--prepend* to both
> append and prepend at the same time.
>
> **prepend**: causes the values to be *prepended* to the current set of values for the variable. This can be used with *--append* to both append
> and prepend at the same time.
In quotidian English, **append** means *to add*, and **prepend** means *to add at the beginning*. Clearly, these meanings don't apply to fish (or to computers in general?), for it's redundant to say that we can both *add x to y* while also *adding x to the beginning of y*. If we can do the latter, then we can do the former. That is to say, by doing the latter, we do the former. If it's senseless to say that I am both running a race from the starting line and also running a race, then it's senseless to say that I am both prepending some data and also appending that data.
So, what do these terms mean to fish (or in the world of software development)? What are the implications for doing one over the other? And what does it mean to explicitly do both?
Pound Hash
(327 rep)
Dec 2, 2021, 10:48 PM
• Last activity: Oct 12, 2022, 09:09 PM
Showing page 1 of 20 total questions