Some very useful tips when working with IP addresses on the Internet.

Get the IPv6 address of a website very easily with this simple one-liner. jason@. PWD: ~. -bash. 3.2.57. 29 $> host ipv6.google.com | awk ‘FNR==2 {print $5}’ 2404:6800:4006:811::200ejason@. PWD: ~. -bash. 3.2.57. 29 $> host ipv6.google.com | awk ‘FNR==2 {print $5}’ 2404:6800:4006:811::200e This works just fine to get the required information. I am not sure … Read more

Setting up your BASH prompt. How to get the most out of the BASH shell.

Setting up your BASH prompt. A nice BASH shell prompt. This shows the current time and the current folder you are in as well as a full directory path if you are in a subfolder. PS1="-\t– \u@\h [\w]\$ "PS1="-\t– \u@\h [\w]\$ " How to set the contents of the Xterm title bar. Using the PROMPT_COMMAND … Read more

Very interesting Bash shell script for creating a Webm clip from a movie.

This is a very useful Bash shell script, this will create a Webm clip from a movie. This shows how to get parameters in a Bash script easily. #!/bin/bash   while [[ "$#" -gt 0 ]]; do case $1 in -f|–filename) filename="$2"; shift ;; -t|–timestamp) timestamp="$2"; shift ;; -o|–outfile) outfile="$2"; shift ;; *) echo "Unknown … Read more

How to create a new user on Linux with the command line.

This simple command-line will create a new user on Linux named test5. ┌──[[email protected]]─[~] └──╼ ╼ $ sudo useradd test5 -m -K PASS_MAX_DAYS=5 -K PASS_WARN_AGE=3 -K LOGIN_RETRIES=1┌──[[email protected]]─[~] └──╼ ╼ $ sudo useradd test5 -m -K PASS_MAX_DAYS=5 -K PASS_WARN_AGE=3 -K LOGIN_RETRIES=1 Then set a password for the new user. ┌──[[email protected]]─[~] └──╼ ╼ $ sudo passwd test5 New … Read more

Another example of a command that you should never run on Linux.

An obfuscated command like this is an example of one that you should never run. ┌──[[email protected]]─[~] └──╼ ╼ $ echo "ZWNobyBIYWhhaGFoYWhhaGFoYWhhaGFoYWhhaGFoYWhhaGFoYWhhaGFoYWhhaGFodG91Y2ggLS1mdWNreW91ISA+PiAtZnVja3UhCg==" | base64 -d | sh -s┌──[[email protected]]─[~] └──╼ ╼ $ echo "ZWNobyBIYWhhaGFoYWhhaGFoYWhhaGFoYWhhaGFoYWhhaGFoYWhhaGFoYWhhaGFodG91Y2ggLS1mdWNreW91ISA+PiAtZnVja3UhCg==" | base64 -d | sh -s This is the actual command it will run, this creates a file named “-fucku!”. But this can … Read more

How to print out all available terminal colors. And other useful Linux tricks.

How to best view all available terminal colours This one-liner will print out all available terminal colours for your chosen Linux terminal application. This is very useful for creating a colourful bash prompt and the user wishes to know which colour codes will work and look good in the terminal. for x in {0..8}; do … Read more

Get weather information from the command line in Linux.

Printing information about the weather on the command line is quite easy on Linux. One way is using the finger(1) command to retrieve a forecast for a certain city. ┌──(john㉿DESKTOP-PF01IEE)-[~] └─$ finger [email protected] -= Meteogram for Sydney, New South Wales, Australia =- ‘C Rain (mm) 25 24 23 ^^^ 22 ===^^^^^^ ===^^^ 21=== ^^^=–=–=–=–=– 20 … 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

Convert your IP address to binary easily with this command.

This one-liner will take your IP address and convert it into binary. This is very useful and fun to do. ┌──[[email protected]]─[~/Videos] └──╼ ╼ $ ipcalc `ip a | awk ‘/inet / { print $2 }’ | sed -n 2p | cut -d "/" -f1` | awk ‘/Address/ {print $3,$4}’ 11000000.10101000.00000001. 00000010┌──[[email protected]]─[~/Videos] └──╼ ╼ $ ipcalc … Read more

How to search for a folder and then switch to it in Linux.

This simple command will search for a folder named xray* and then switch to it. ┌──[[email protected]]─[~/Documents] └──╼ ╼ $ cd $(find . -type d -name "xray*")┌──[[email protected]]─[~/Documents] └──╼ ╼ $ cd $(find . -type d -name "xray*") After running this command, it has found a folder that matches the wildcard and then switched to it. ┌──[[email protected]]─[~/Documents/xray-16] … Read more

Very useful Linux tips for getting information on current logins.

There are many ways to get detailed information on known users on your Linux system. The lslogins command is therefore very useful for listing all usable login accounts. The below example will list all user accounts including the root account. This might be disabled on an Ubuntu system, but it is worth listing it anyway. … Read more

Some very useful Linux bash functions.

Show a preview of a directory as you cd into it. c() { cd "$@" ls_truncate=20 files=$(ls -F -C –color=always) files_num=$(echo "$files" | wc -l) echo "$files" | head -n $ls_truncate [ $(echo "$files" | wc -l) -gt "$ls_truncate" ] && echo "(Ommited $((files_num-$ls_truncate)) files/directories)" }c() { cd "$@" ls_truncate=20 files=$(ls -F -C –color=always) files_num=$(echo … Read more

How to use the Linux command line to generate an absurdly complicated password.

Generating a password with the Linux command line is very easy with data from /dev/urandom. This allows a user to retrieve random data easily. The example below shows a password being generated only using letters and numbers. ┌──[[email protected]]─[~] └──╼ ╼ $ tr -dc "0-9A-Za-z" < /dev/urandom | head -c 96 ; echo gOApOMzRqqbmvUjxT7esfJcKW58PxxXqYDwCVvd628OsEa1yyfLADADJQ8YBZFdWZQkCXCRDKCPncSsC20OOjHxklnaxEbJF┌──[[email protected]]─[~] └──╼ ╼ … Read more