How to show only whole words with grep on Linux when searching a file.

Some very useful grep tips for a UNIX or Linux user This is a very useful example, this is how to stop grep finding letters before the start of the search term “file*[s-t]”. The \b operator is an end of word marker. ┌──[[email protected]]─[~] └──╼ ╼ $ grep -n "\bfile*[s-t]\b" /usr/share/dict/words 46437:files 46438:filet 46439:filet’s┌──[[email protected]]─[~] └──╼ ╼ … Read more

Interesting and useful commands available using the BASH shell on Linux.

This is an interesting command to view your command history when you are using Bash. ┌──[[email protected]]─[~] └──╼ ╼ $ hash hits command 1 /usr/bin/gethostip 1 /usr/bin/sudo┌──[[email protected]]─[~] └──╼ ╼ $ hash hits command 1 /usr/bin/gethostip 1 /usr/bin/sudo This command is a Bash shell built-in command. If you are using the tcsh or zsh shells; this command … Read more

Some even more useful Linux commands and tricks for the Linux command-line user.

Some interesting and useful Linux shell commands Linux has some very useful and interesting commands available to the Linux desktop user to find out information about your computer system. Some of these hearken back to the days of the old Linux terminals; when you accessed your computer from a dumb terminal instead of a graphical … Read more

Interesting command line tricks on Windows.

There are quite a few interesting command-line tricks for Windows. Create a folder named CON. This is quite difficult to delete. echo "hello" > \\.\C:\Users\shawn\Documents\CONecho "hello" > \\.\C:\Users\shawn\Documents\CON Another interesting trick is one. C:\Users\Dyatlov\Downloads\testing>echo "" > ….::$INDEX_ALLOCATION The system cannot find the file specified.C:\Users\Dyatlov\Downloads\testing>echo "" > ….::$INDEX_ALLOCATION The system cannot find the file specified. This … Read more

Very cool Linux text processing tricks.

Align all text right on an 80 column width. jason@jason-Lenovo-H50-55:~/Documents$ ls -hula | sed -e :a -e ‘s/^.\{1,80\}$/ &/;ta’ total 872K drwxr-xr-x 2 jason jason 4.0K May 4 08:48 . drwxr-xr-x 23 jason jason 4.0K May 3 20:51 .. -rw-r–r– 1 jason jason 848K Apr 21 13:01 altis_insurgency_altis.pbo -rwxrwxr-x 1 jason jason 166 Apr 22 … Read more

Some very useful apt tips for Debian and Ubuntu.

There are some very useful tricks that can be used to get information about packages installed on a Debian or Ubuntu machine. Here are just a few. Get a graphical view of the actual dependencies of a package such as Firefox. Firstly, install the graphviz package. jason@Yog-Sothoth:~$ sudo apt install graphvizjason@Yog-Sothoth:~$ sudo apt install graphviz … Read more

Some awesome tricks with awk, grep and sed.

Reading a large text file and then finding all words that contain between 5 and 7 vowels. Notice I am not using cat. jason@Yog-Sothoth:~/Documents$ egrep ‘^([^aieou]*[aieou]){5,7}[^aieou]*$’ < pg768.txt | wc -l 284jason@Yog-Sothoth:~/Documents$ egrep ‘^([^aieou]*[aieou]){5,7}[^aieou]*$’ < pg768.txt | wc -l 284 Count the number of times a single word appears in a text file. jason@Yog-Sothoth:~/Documents$ egrep … Read more

Get a randomly generated bash shell prompt and some other tricks for the Linux shell.

A nice shell prompt that is randomly generated each time it appears. Working version. PS1="\[\e[1;31m\]$(shuf -n 1 /usr/share/dict/words)\[\e[m\]@\[\e[1;35m\]$(shuf -n 1 /usr/share/dict/words)\[\e[m\]\$ "PS1="\[\e[1;31m\]$(shuf -n 1 /usr/share/dict/words)\[\e[m\]@\[\e[1;35m\]$(shuf -n 1 /usr/share/dict/words)\[\e[m\]\$ " Select a random word from a textfile with bash. ubuntu ~ $ shuf -n 1 /usr/share/dict/words pluckedubuntu ~ $ shuf -n 1 /usr/share/dict/words plucked Select a … Read more

Some very useful Arch Linux tips and tricks.

Get a comprehensive listing of all Arch Linux pacman mirrors. curl -s -L "https://www.archlinux.org/mirrorlist/?country=all&protocol=https&use_mirror_status=on" 2>&1 | sed ‘s/^.//’ > mirrorlistcurl -s -L "https://www.archlinux.org/mirrorlist/?country=all&protocol=https&use_mirror_status=on" 2>&1 | sed ‘s/^.//’ > mirrorlist A simple script to update your mirror listing on your Arch Linux system. #!/bin/bash echo "Fetching new sorted mirrorlist…" curl -s -L "https://www.archlinux.org/mirrorlist/?country=all&protocol=https&use_mirror_status=on" 2>&1 | sed … Read more

Some very useful Powershell tricks.

Print the current date and time with Powershell. "{0:dddd – hh:mm:ss – d/M/yy}" -f (get-date)"{0:dddd – hh:mm:ss – d/M/yy}" -f (get-date) This is an example of what this will give you. PS C:\Users\jason> "{0:dddd – hh:mm:ss – d/M/yy}" -f (get-date) Tuesday – 08:42:05 – 30/1/18PS C:\Users\jason> "{0:dddd – hh:mm:ss – d/M/yy}" -f (get-date) Tuesday – … Read more