Obscure Linux bash shell tricks and tips.

Some useful Bash shell tricks There are a lot of obscure Bash shell tricks for the Linux shell that is useful for showing off shell tricks and making your shell usage easier. For a first example, run this command. ubuntu ~ $ ls -hulaubuntu ~ $ ls -hula Then run…

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…

Read More

Very useful Linux bash shell tricks.

There are many very useful shell tricks when using the bash shell on Linux or UNIX. Print the last used command-line arguments with a keyboard shortcut. ESC-. This will print the last used command-line arguments to the prompt. Very useful if it is a very long one-liner. Print a listing…

Read More

Misc BASH shell tricks for the Linux user.

To recall the last entered command on the Linux console, press the Ctrl-P key shortcut. You may also press the up arrow to recall the command, but the Ctrl-P shortcut is another good way to perform this feat. The CTRL-A shortcut will jump to the beginning of the line you…

Read More

Search all processes for certain matches using wildcards.

The ps command lists all running processes on your Linux machine, this is how to fine-tune this and search for certain processes using wildcards. Use this example command line to find all Apache HTTP server instances. ps -ef | grep -i apache*ps -ef | grep -i apache* This is the…

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…

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…

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…

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…

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…

Read More