How to strip all of the text out of a text file and leave only the numbers and formatting. And other sed tricks.

How to strip all numbers out of a text stream This is how to remove all text from the output of a file and only keep the other formatting. homer@deep-thought ~/Desktop/b $ fortune -l | sed s/[a-z]/\ /gi; : 3:15 . . – .   , ! — ’84homer@deep-thought ~/Desktop/b $ fortune -l | sed … Read more

Useful Linux shell tricks. Using Brace expansions to create folders.

The Linux command-line offers many useful methods of creating many folders on your computer at once.  This command will create a few folders on your system named one,two,three,four and create the folders five,six,seven,eight within each folder created. ~$ mkdir -p {one,two,three,four}/five/six/seven/eight~$ mkdir -p {one,two,three,four}/five/six/seven/eight This command will create four folders named one,two,three,four and put the … Read more

How to get exif information out of a photo with a simple utility.

Get exif information from your photos easily on Linux. The exif command for Linux allows a user to get exif information from a camera image. This example below shows the sample output from this interesting utility. Very good to manage the exif data in your photos. ─[user@parrot]─[~/Desktop] └──╼ $exif waterfall.jpg EXIF tags in ‘waterfall.jpg’ (’Intel’ … Read more

Updating the grub2 boot-loader menu & adding swap space to your computer.

How to update the GRUB bootloader menu on Linux To update the grub bootloader on your Linux box, this is another way to do this. grub-mkconfig > /boot/grub/grub.cfggrub-mkconfig > /boot/grub/grub.cfg This will update the grub2 bootloader and add any new kernels in /boot. Creating a new swapfile for your Linux system. Firstly we create a … Read more

Useful Linux commands for querying your computer for hardware information.

The iostatcommand is another good way to get information about the hardware in your computer. This command displays information about the average CPU usage as well as reads and writes to your hard disk partitions. To install this utility, run this command. ubuntu ~ $ sudo apt-get install sysstatubuntu ~ $ sudo apt-get install sysstat … Read more

How to list the installed files of a certain package and other useful tips.

To list all the files installed by a certain Debian package, use this command. dpkg -L [PACKAGENAME]. For example. ubuntu ~ $ dpkg -L vim /. /usr /usr/bin /usr/bin/vim.basic /usr/share /usr/share/lintian /usr/share/lintian/overrides /usr/share/lintian/overrides/vim /usr/share/bug /usr/share/bug/vim /usr/share/bug/vim/presubj /usr/share/bug/vim/script /usr/share/doc /usr/share/doc/vimubuntu ~ $ dpkg -L vim /. /usr /usr/bin /usr/bin/vim.basic /usr/share /usr/share/lintian /usr/share/lintian/overrides /usr/share/lintian/overrides/vim /usr/share/bug /usr/share/bug/vim /usr/share/bug/vim/presubj … Read more

How to install Powershell for Linux in Ubuntu 16.04.

Installing Powershell for Linux in Ubuntu 16.04 is very easy. I had problems with the packages, but I sorted it out very quickly. Firstly, download the Powershell Debian package. https://github.com/PowerShell/PowerShell/releases/download/v6.0.0-alpha.9/powershell_6.0.0-alpha.9-1ubuntu1.14.04.1_amd64.deb. Then the required libicu package. http://security.ubuntu.com/ubuntu/pool/main/i/icu/libicu52_52.1-3ubuntu0.4_amd64.deb. Then install the libicu package. jason$ sudo dpkg -i libicu52_52.1-3ubuntu0.4_amd64.deb Selecting previously unselected package libicu52:amd64. (Reading database … 490392 … Read more

Nice Linux prompts to liven up your terminal.

This is a nice script to build a custom PS1 that looks awesome and is simple too. export PROMPT_COMMAND=__prompt_command function __prompt_command() { local EXIT="$?"   local DEFAULT=’\[\e[0m\]’   local RED=’\[\e[0;31m\]’ local GREEN=’\[\e[0;32m\]’ local DARK_GRAY=’\[\e[0;90m\]’ local PURPLE=’\[\e[0;35m\]’ local YELLOW=’\[\e[0;33m\]’   PS1="\n${GREEN}\t${DEFAULT} "   if [ "$EXIT" != "0" ]; then PS1+="${RED}$EXIT${DEFAULT} " else PS1+="$EXIT${DEFAULT} " fi … Read more

Useful shell tips. How to search and replace characters or words with the bash shell.

Search and replace on the bash shell is very useful for various one-liner shell commands. The below example shows how to replace a # character with a * character. jason@DESKTOP-R72SPS3:/mnt/c/Users/johnc/Documents$ cat ip.c | sed ‘s/#/*/gi;’ *include <stdio.h>   int main() { printf(".");   return 0; }jason@DESKTOP-R72SPS3:/mnt/c/Users/johnc/Documents$ cat ip.c | sed ‘s/#/*/gi;’ *include <stdio.h> int main() … Read more