Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
3
votes
2
answers
3204
views
change linux text console scrolling speed - without rebooting
Is there any way to change to the text console scrolling speed without rebooting? Currently using Fedora, but non-distribution-specific answers appreciated. https://www.kernel.org/doc/Documentation/fb/vesafb.txt I'd like to use 'ywrap' in the above documented kernel parameters for vesafb without hav...
Is there any way to change to the text console scrolling speed without rebooting? Currently using Fedora, but non-distribution-specific answers appreciated.
https://www.kernel.org/doc/Documentation/fb/vesafb.txt
I'd like to use 'ywrap' in the above documented kernel parameters for vesafb without having to reboot the kernel to try it.
Juan
(914 rep)
Jan 24, 2015, 02:12 AM
• Last activity: Aug 5, 2025, 01:06 AM
0
votes
1
answers
40
views
remove diacritics in Polish characters
I have a downloaded ebook on my PC that's in Polish, problem is my mp3 that can also display ebooks doesn't have Polish characters so I need a way to edit all the ł, ń, ą, ó etc. into l, n, a, o etc. Is there a way to do this fast?
I have a downloaded ebook on my PC that's in Polish, problem is my mp3 that can also display ebooks doesn't have Polish characters so I need a way to edit all the ł, ń, ą, ó etc. into l, n, a, o etc.
Is there a way to do this fast?
Cairo
(11 rep)
Jun 25, 2025, 01:33 PM
• Last activity: Jun 25, 2025, 02:09 PM
1
votes
3
answers
326
views
Remove lines matching pattern, plus any lines following it matching a different pattern
Let me preface I am not sure if this question has been asked before, I have been Googling for answers but came up short. I want to use standard Linux/Unix commands (running this on FreeBSD) to exclude lines from a log file that match a pattern. The log file also includes "last message repeated x tim...
Let me preface I am not sure if this question has been asked before, I have been Googling for answers but came up short.
I want to use standard Linux/Unix commands (running this on FreeBSD) to exclude lines from a log file that match a pattern. The log file also includes "last message repeated x times" to condense log entries.
As an example, I want to take this:
May 27 2023 11:07 relevant information #1
May 27 2023 11:07 relevant information #2
May 27 2023 11:08 last message repeated 3 times
May 27 2023 11:08 useless information #1
May 27 2023 11:08 last message repeated 5 times
May 27 2023 11:09 last message repeated 8 times
May 27 2023 11:09 relevant information #3
May 27 2023 11:09 useless information #2
May 27 2023 11:10 useless information #3
May 27 2023 11:10 last message repeated 6 times
And get this output:
May 27 2023 11:07 relevant information #1
May 27 2023 11:07 relevant information #2
May 27 2023 11:08 last message repeated 3 times
May 27 2023 11:09 relevant information #3
I've gotten as far as using sed commands to do this, but I don't know enough about how it works to figure it out. I am especially lost when it comes to the log lines that have multiple "last message repeated" following it. Here's what I'm working with currently:
sed '/useless information/{d;N;/last message repeated/d;}' ./logfile.txt
The above first deletes matching lines containing "useless information", then adds the next line to the namespace with N
, and then is supposed to delete the resulting line if it contains "last message repeated". But it is only deleting the lines with "useless information".
ekrekeler
(13 rep)
May 27, 2023, 04:49 PM
• Last activity: Jun 15, 2025, 04:20 AM
2
votes
2
answers
8223
views
What's the best way to display tabs/spaces in my plain text files
I have a file that unfortunately contains both tabs and spaces. How do I display them so I know if a particular space is actually tab or space?
I have a file that unfortunately contains both tabs and spaces.
How do I display them so I know if a particular space is actually tab or space?
CuriousMind
(289 rep)
Oct 19, 2015, 04:15 PM
• Last activity: Jun 10, 2025, 06:20 AM
1
votes
2
answers
2119
views
Converting a TXT file to PDF from the command line using a custom font
I want to convert a UTF-8 txt file to PDF for printing with CUPS. The problem I'm facing is that all tools I've tried have either failed to format the PDF (resulting in a fully white document with no text) or ignored font options. I have also tried converting my text file to PostScript 1st (as sugge...
I want to convert a UTF-8 txt file to PDF for printing with CUPS. The problem I'm facing is that all tools I've tried have either failed to format the PDF (resulting in a fully white document with no text) or ignored font options. I have also tried converting my text file to PostScript 1st (as suggested in some previous answers to similar topics) but have faced issues with then printing the PostScript files with the added fonts.
What I have tried:
text2pdf (creates blank document when custom font specified)
unoconv (fails to run with network error)
LibreOffice CLI (no font parameters)
enscript (initial PostScript conversion works however when then printing that PS or converting it to PDF the font reverts to courier)
paps (PostScript conversion succeeds but font parameter seemingly ignored as file is the same regardless of what font you specify or whether or not it exists)
pandoc (font options ignored)
psvg200
(11 rep)
Jun 26, 2023, 08:02 PM
• Last activity: Jun 3, 2025, 02:04 AM
13
votes
5
answers
12976
views
display filename followed by content without interaction
My program writes it state to few files every 30 seconds or so (overwrites) and I would like to look at them with the filenames displayed like "more" does. Like: $ echo 1234 > test00 $ echo 5678 > test01 $ ls test00 test01 $ more * :::::::::::::: test00 :::::::::::::: 1234 :::::::::::::: test01 ::::...
My program writes it state to few files every 30 seconds or so (overwrites) and I would like to look at them with the filenames displayed like "more" does. Like:
$ echo 1234 > test00
$ echo 5678 > test01
$ ls
test00 test01
$ more *
::::::::::::::
test00
::::::::::::::
1234
::::::::::::::
test01
::::::::::::::
5678
For "more" you have to press space to get next file.
* What I want is the filenames before content in some way
* I tried "tail", but have to Ctrl+C,
Can write a small program but I’m wondering if any standard unix program can do this ( display name of file, followed by content of file ) without further user interaction as with "more"
AlfredoG
(133 rep)
Feb 16, 2015, 06:43 AM
• Last activity: May 28, 2025, 03:19 PM
0
votes
0
answers
29
views
Recover deleted txt file which was stored to btrfs right before another one that I still have
I used my terminal emulator to run a command and redirect output to a text file on my btrfs. Right after, I did the same with another command. I since deleted the first text file and not the second. I'd like to recover part of the first text: photorec seems overkill but I'm familiar with the tool, u...
I used my terminal emulator to run a command and redirect output to a text file on my btrfs. Right after, I did the same with another command. I since deleted the first text file and not the second. I'd like to recover part of the first text: photorec seems overkill but I'm familiar with the tool, using strings seems more suitable but I'm not familiar with this method. How about looking at the actual blocks on the fs: maybe the two files were written sequentially?
user324831
(113 rep)
May 20, 2025, 06:50 PM
• Last activity: May 20, 2025, 06:55 PM
0
votes
3
answers
1670
views
How to copy text from an image in a pdf file?
I can view a pdf image with text using the evince document viewer, however I cannot select the text in the image to copy and paste. How do I copy text from an image in a pdf file?
I can view a pdf image with text using the evince document viewer, however I cannot select the text in the image to copy and paste. How do I copy text from an image in a pdf file?
linuxfreebird
(131 rep)
Sep 19, 2014, 11:18 PM
• Last activity: May 16, 2025, 05:45 AM
7
votes
2
answers
2017
views
How to convert ęąśćżńł TXT to PDF with enscript?
I have problem converting a file to PDF. I create the file with echo ęąśćżńł > text and convert: enscript -O text -o - | ps2pdf - out.pdf However, `out.pdf` has an encoding problem: ![screenshot of corrupted pdf file][1] [1]: https://i.sstatic.net/ttQqp.png
I have problem converting a file to PDF. I create the file with
echo ęąśćżńł > text
and convert:
enscript -O text -o - | ps2pdf - out.pdf
However,
out.pdf
has an encoding problem:

Miko
(71 rep)
Apr 21, 2015, 01:34 PM
• Last activity: Feb 19, 2025, 01:40 PM
8
votes
4
answers
79378
views
Debian - How to change Terminal background colors
I am a Git Bash user who is now switching to Debian. Here was my Git Bash's look: [![enter image description here][1]][1] Here is my look on Debian: [![enter image description here][2]][2] - My .bashrc file is completely EMPTY. I have nothing in there currently. - I've been researching color in Linu...
I am a Git Bash user who is now switching to Debian. Here was my Git Bash's look:
Here is my look on Debian:
- My .bashrc file is completely EMPTY. I have nothing in there currently.
- I've been researching color in Linux for **hours**. Trust me, I've exhausted my options.
- I don't want to use a custom program, download packages, run a script, or use a wrapper for Terminal. I just want my terminal colored how it looks in the GitBash image OR how Command Prompt displays color.
- I don't want to change the text background, I want to change my *terminal* background. I personally would like Black, not grey.
Thank you.


Hatefiend
(183 rep)
Feb 11, 2016, 05:23 AM
• Last activity: Feb 2, 2025, 02:35 PM
35
votes
7
answers
27308
views
Is there something like a lorem ipsum generator?
Is there something like a '[lorem ipsum](http://en.wikipedia.org/wiki/Lorem_ipsum) generator'? I know it exists in Latex, and even in LibreOffice, but I'm looking for a terminal command. I would like to type something like `loremipsum 10 >> file1.txt` that would give me the first 10 paragraphs of lo...
Is there something like a '[lorem ipsum](http://en.wikipedia.org/wiki/Lorem_ipsum) generator'? I know it exists in Latex, and even in LibreOffice, but I'm looking for a terminal command. I would like to type something like
loremipsum 10 >> file1.txt
that would give me the first 10 paragraphs of lorem ipsum, each paragraph ended with one LF-character and 1 empty white line between each paragaph. And the output would be redirected to a file called file1.txt in the current directory.
Frank
(453 rep)
Oct 22, 2013, 09:33 PM
• Last activity: Jan 19, 2025, 01:57 PM
3
votes
2
answers
1583
views
Preventing mid-word line breaks in a2ps
So I understand that `a2ps` is mostly for converting ASCII code to postscript for printing, but occasionally I like to print a .txt or .md file for school. Often, an entire sentence (or even a paragraph) will be on one line, and `a2ps` will break the line at whatever character it needs to in order t...
So I understand that
a2ps
is mostly for converting ASCII code to postscript for printing, but occasionally I like to print a .txt or .md file for school. Often, an entire sentence (or even a paragraph) will be on one line, and a2ps
will break the line at whatever character it needs to in order to wrap correctly.
This often leaves either awkward half words on a line, or spaces immediately at the beginning of the line. I can't seem to find an option to prevent this hard wrapping in the middle of words (even with --pretty-print
).
Is there any option to do this, or am I using the incorrect tool for the task?
afischer
(33 rep)
Sep 21, 2014, 02:57 PM
• Last activity: Jan 3, 2025, 08:44 PM
56
votes
7
answers
44885
views
Is there some sort of PDF-to-text converter?
I need PDF files in text so I can search over them in bulk from commandline. Is there some converter for Ubuntu, OBSD or similar distro? Perhaps related post, OCR with Ubuntu [here][1]. [1]: https://askubuntu.com/questions/8792/optical-character-recognition-software-on-ubuntu
I need PDF files in text so I can search over them in bulk from commandline. Is there some converter for Ubuntu, OBSD or similar distro?
Perhaps related post, OCR with Ubuntu here .
otto
(661 rep)
Dec 11, 2010, 02:46 PM
• Last activity: Dec 30, 2024, 06:23 PM
10
votes
2
answers
4375
views
What does $0=$1 mean in awk?
Let's say, I have an input text file (sample_simple.txt) like this: 3 1 10 1 6 9 4 2 4 1 9 2 2 2 1 By using the command: `awk '$0=$1" "$1*$2" "$3*$4' sample_simple.txt`, I get the following output: 3 3 10 9 36 8 9 18 4 Then using the command: `awk '$1*$2" "$3*$4' sample_simple.txt`, nothing changes...
Let's say, I have an input text file (sample_simple.txt) like this:
3 1 10 1 6
9 4 2 4 1
9 2 2 2 1
By using the command:
awk '$0=$1" "$1*$2" "$3*$4' sample_simple.txt
, I get the following output:
3 3 10
9 36 8
9 18 4
Then using the command: awk '$1*$2" "$3*$4' sample_simple.txt
, nothing changes from the input file:
3 1 10 1 6
9 4 2 4 1
9 2 2 2 1
The only change between the commands is '$0=$1'
, Can anyone explain this?
ADNAN ZAMAN
(107 rep)
Mar 21, 2020, 07:18 PM
• Last activity: Dec 20, 2024, 08:04 PM
-1
votes
2
answers
156
views
POSIX definition of a text file seems to accept a file consisting of a single incomplete line as a text file - is this intentional?
POSIX defines a text file as "a file that contains characters organized into zero or more lines". However, according to POSIX definition of a line, there are two possible "kinds" of text files with zero lines: - an empty file - a non-empty file consisting solely of a single incomplete line (a line w...
POSIX defines a text file as "a file that contains characters organized into zero or more lines". However, according to POSIX definition of a line, there are two possible "kinds" of text files with zero lines:
- an empty file
- a non-empty file consisting solely of a single incomplete line (a line with at least one character and no
\n
).
Is the second case above really considered a text file? Intuitively it's not, as it seems to be nothing more but an edge case. Still, such a file certainly has no lines (as POSIX defines them) because it does not contain a newline character, so it seems to adhere to the current POSIX definition of a text file. The only issue open to interpretation here may be whether such files can be considered "organized into lines", but personally I see no reason against it - nothing in the POSIX definition forces me to treat them otherwise than empty files which, despite being empty (and thus trivially having zero lines), are considered "organized in lines". Perhaps I'm splitting hairs here, but I think the definition, as it currently stands, requires a slight augmentation in order to exclude this case (unless I'm wrong and such files are indeed supposed to match the POSIX definition of a text file).
In this thread:
https://unix.stackexchange.com/questions/446237/what-conditions-must-be-met-for-a-file-to-be-a-text-file-as-defined-by-posix
the OP had similar doubts. In one of replies to his questions someone claimed that "a text file shall not have incomplete lines". While this extra statement would indeed exclude the disputed case, such a restriction does not explicitly appear in the POSIX definition of a text file.
Peter
(115 rep)
Dec 17, 2024, 11:56 AM
• Last activity: Dec 18, 2024, 09:01 AM
4
votes
6
answers
10290
views
Use sed command to check if a particular line exists, if not, add it
I want to add more terminals to the file `/etc/securetty`. More specifically I would like to add `pts/n`, where `n` is in the range `0-9`, if it does not exist. Is this possible through `sed` command? The following is how the contents of my `/etc/securetty` are: # Local X displays (allows empty pass...
I want to add more terminals to the file
/etc/securetty
. More specifically I would like to add pts/n
, where n
is in the range 0-9
, if it does not exist. Is this possible through sed
command? The following is how the contents of my /etc/securetty
are:
# Local X displays (allows empty passwords with pam_unix's nullok_secure)
pts/0
pts/1
pts/2
pts/3
I tried some thing like:
sudo sed '+pts/3+a pts/4' /etc/securetty
which gives the following error:
sed: -e expression #1, char 3: extra characters after command
skrowten_hermit
(791 rep)
Apr 12, 2017, 11:06 AM
• Last activity: Nov 24, 2024, 04:55 AM
1
votes
1
answers
431
views
In Less, how to jump horizontally between search matches on the same line?
On pressing n , Less skips all the search matches in the current line and moves to the next *line* with a match (even if the lines are wrapped). How can I make it move the cursor to all the matches in each line?
On pressing n, Less skips all the search matches in the current line and moves to the next *line* with a match (even if the lines are wrapped). How can I make it move the cursor to all the matches in each line?
Arch Stanton
(355 rep)
Aug 4, 2021, 07:23 AM
• Last activity: Nov 23, 2024, 11:17 AM
60
votes
10
answers
58082
views
Finding all "Non-Binary" files
Is it possible to use the find command to find all the "non-binary" files in a directory? Here's the problem I'm trying to solve. I've received an archive of files from a windows user. This archive contains source code and image files. Our build system doesn't play nice with files that have windows...
Is it possible to use the
find
command to find all the "non-binary" files in a directory? Here's the problem I'm trying to solve.
I've received an archive of files from a windows user. This archive contains source code and image files. Our build system doesn't play nice with files that have windows line endings. I have a command line program (flip -u
) that will flip line endings between *nix and windows. So, I'd like to do something like this
find . -type f | xargs flip -u
However, if this command is run against an image file, or other binary media file, it will corrupt the file. I realize I could build a list of file extensions and filter with that, but I'd rather have something that's not reliant on me keeping that list up to date.
So, is there a way to find all the non-binary files in a directory tree? Or is there an alternate solution I should consider?
Alana Storm
(1483 rep)
Aug 24, 2012, 06:46 PM
• Last activity: Sep 13, 2024, 09:52 AM
7
votes
6
answers
781
views
Split column into lines using awk
I have a file that contains a long column and I want to split it into lines, each one with 5 values. E.g., Input file: 1 2 3 4 5 6 7 8 9 10 Output file: 1 2 3 4 5 6 7 8 9 10
I have a file that contains a long column
and I want to split it into lines, each one with 5 values.
E.g.,
Input file:
1
2
3
4
5
6
7
8
9
10
Output file:
1 2 3 4 5
6 7 8 9 10
Djabri Josef
(335 rep)
Aug 2, 2024, 11:27 PM
• Last activity: Aug 8, 2024, 10:32 PM
0
votes
1
answers
44
views
view a bunch of text files in the terminal
I've got a bunch of text files and pdfs in a directory. If I enter evince *.pdf ..all the pdfs open up in separate windows, I do this quite often. When I enter cat *.txt ..was pleasantly surprised to see it shows all the text files in the terminal. Problem is it has them all just laid end to end you...
I've got a bunch of text files and pdfs in a directory.
If I enter
evince *.pdf
..all the pdfs open up in separate windows, I do this quite often.
When I enter
cat *.txt
..was pleasantly surprised to see it shows all the text files in the terminal. Problem is it has them all just laid end to end you can't really tell where one ends and the next one begins or which one you're looking at as you scroll.
Is there an improvement to this
cat
command whereby it will give the name of the file in the terminal before dumping its contents? That's the main point, but perhaps a line or blank space after the text file ended so you would know it had ended would also be nice to have.
Otherwise, a better terminal command than cat
which accomplishes this.
cardamom
(662 rep)
Jul 3, 2024, 12:54 PM
• Last activity: Jul 3, 2024, 01:04 PM
Showing page 1 of 20 total questions