How to add a column heading with awk on Linux.

This very nice one-liner will print some information about your mounted drives on Linux and also print a column header to dress up the output. ┌──[[email protected]]─[~/Downloads] └──╼ ╼ $ df -Hla | grep "[0-9]% /" | awk -F, ‘NR==1 {print "Device","Capacity","Free","Usage","Percentage","Mount"} {gsub(/"/,""); print $1,$2,$4}’ | column -t Device Capacity Free Usage Percentage Mount dev 13G … Read more

A very cool Linux trick. Read the time in the terminal from an image.

This is a very cool Linux one-liner, this is using the Tesseract OCR engine to read an image generated by a script and then read the time from it. ┌──[[email protected]]─[~/Pictures/letter] └──╼ ╼ $ curl -s ‘https://securitronlinux.com/api/servers.php’ -o – | tesseract stdin stdout –dpi 150 | grep –color CDT 05:33:13pm Sun Aug 22, 2021 CDT┌──[[email protected]]─[~/Pictures/letter] └──╼ … Read more

Install Twin – a Textmode WINdow environment on Ubuntu and use multiple terminals in a Virtual Terminal session.

The Twin utility for Linux allows a user to open a text-mode environment and then use multiple terminal windows within this simple environment. This could be very useful indeed when working in a Virtual Terminal. This would allow a user to watch multiple terminal windows at once. Download the source code. ┌──[[email protected]]─[~/Documents/twin] └──╼ (master) ╼ … Read more

Use grep to search through source code trees fast and find what you are looking for.

Using the grep utility to search through source code can take a long time when you are searching for certain text. But this can be made easier if you use grep. The command below: grep -rn –include "*.*" "winlogon" .grep -rn –include "*.*" "winlogon" . Will search recursively through a source code tree and find … Read more

How to find matching files when using grep to search for files containing text.

The grep utility is very useful when searching for text in files. This can be used recursively to find matching files. This tip will return the full path to all files containing the text you are looking for. 4.4 Thu Apr 23 jason@Yog-Sothoth 1: $ grep -r -H "noclip"4.4 Thu Apr 23 jason@Yog-Sothoth 1: $ … Read more

Fun with sed on Linux.

The sed command can be used to reverse text. This is a very interesting feature. Provide a text string, and it will be reversed. jason@jason-Virtual-Machine:~$ sed ‘/\n/!G;s/\(.\)\(.*\n\)/&\2\1/;//D;s/./Hello. /’ <<< ‘This is a long sentence in reverse. This is a lot of fun.’ Hello. .nuf fo tol a si sihT .esrever ni ecnetnes gnol a si … Read more

How to search through textfiles in a folder when you are stuck on Windows.

Windows has quite a few useful utilities for searching text. The findstr utility allows searching through a folder full of text files for a certain string. Here is an example. >findstr /S /R "money_quest_update" *.*>findstr /S /R "money_quest_update" *.* And this is how to search for text strings in a folder. E:\shadowofchernobyl\gamedata>findstr /S /R "money_quest_update" … Read more

Search and replace text in a file with ed.

I have a text file containing this string. deusexmachina:Documents jason$ cat out Darwin deusexmachina.local 18.2.0 Darwin Kernel Version 18.2.0: Mon Nov 12 20:24:46 PST 2018; root:xnu-4903.231.4~2/RELEASE_X86_64 x86_64deusexmachina:Documents jason$ cat out Darwin deusexmachina.local 18.2.0 Darwin Kernel Version 18.2.0: Mon Nov 12 20:24:46 PST 2018; root:xnu-4903.231.4~2/RELEASE_X86_64 x86_64 And I want to replace one instance of the word … Read more