Line wrap text from a Ubuntu Linux terminal
You can use fold
:
fold -sw 60
You can now paste your texts. fold
will echo them back, word-wrapped after 60 columns. Exit with Ctrl+C
or Ctrl+D
.
You can also use files for input and output:
fold -sw 60 input.txt > output.txt
Related cards:
Dragging a file into your terminal pastes the file path
When you drag a file from a Nautilus window into a terminal window, the file's path will be pasted into the terminal. This also works with multiple files.
Linux: How to print PDF files from the command line
Sometimes you may want to print files from the command line, especially when you have lots of them.
You can use lp
for that.
To print a single example.pdf
file on your default printer, simply say:
lp example.pdf
lp
accepts multipl...
Ubuntu Mate: Get rid of F12 drop-down terminal
To get your F12
key back for other shortcuts, stop Tilda:
killall tilda
To prevent Tilda from starting on boot you can remove it
sudo apt-get remove tilda
or disable auto start:
- Go to Mate Control Center > Startup Applica...
Remove duplicate lines from a text file
You can use this shell command:
uniq -u input.txt output.txt
Grep the number of occurences in a file, counting multiple hits per line
Grep prints one line per match. To return the number if matches, use the -c
switch:
grep -c "something" filename
However, if a word appears more than once in a line, it is only counted once.
To count every match, you can use [sed
](http:...
Generate a strong secret from the shell
A good tool to generate strong passwords and secrets is "apg". You can get it with
sudo apt-get install apg
To create a strong secret for sessions, [hashed Paperclip paths](https://makandracards.com/makandra/734-deliver-paperclip-attachments...
How to send a test e-mail from shell
If you want to manually check if e-mail delivery works on a machine by sending an e-mail you can run the following:
mail -s Test someone@example.com < /dev/null
This will send an empty e-mail with "Test" as its subject to `someone@example.com...
Convert the colorspace of a PDF from RGB to CMYK under Ubuntu Linux
Note that converting from RGB to CMYK will usually degrade your colors because no exact mapping is possible. Anyway, this Stackoverflow post worked...
Linux: How to make a terminal window title reflect the current path
By default, your terminal emulator (Gnome Terminal, Terminator, etc.) sets some kind of window title to reflect the shell type you are running (e.g. /bin/bash
).
This is most often not too helpful, but you can change that from your shell.
To set...
CSS: Giving text lines a background-color (with configurable line padding and margin)
The gist is:
- wrap the text with a
span
- use
line-height
for the spacing between lines ("margin") - use
box-shadow
to control the line background size ("padding")
Example
![text_lines_with_background_color.png](https://makandraca...