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…

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…

Read More

Deleting a file named -f and other Linux tricks.

How to delete a file with a strange filename This can be an annoying trick to play on someone. Create a file named -f with this command: >-f and then ask them to delete it with the command line only. This can be frustrating exercise; you try to use rm…

Read More

How the bash shell works in Linux.

If you’ve ever piped the output of one command into the input of the other or joined simple commands together to do complex tasks, then you have a taste for the power of the shell. As you use the shell more and more you’ll discover how powerful it is and…

Read More

How the bash shell works in Linux.

If you’ve ever piped the output of one command into the input of the other or joined simple commands together to do complex tasks, then you have a taste for the power of the shell. As you use the shell more and more you’ll discover how powerful it is and…

Read More

Alternative ways of using the bash shell on Linux.

There are many ways to use the bash shell on Linux. It has different key binding options and the ability to navigate to a directory by typing the name alone. set -o vi bind -m vi-insert "\C-l":clear-screenset -o vi bind -m vi-insert "\C-l":clear-screen This will enable VIM styled keybindings for…

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…

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…

Read More

Good ways to find files in your home directory.

Finding files in your home directory is very easy. The command below will search inside all files in your home directory and find all files that contain the text “linux”. find . -type f -exec grep -niH linux ‘{}’ ‘;’find . -type f -exec grep -niH linux ‘{}’ ‘;’ This…

Read More