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

How to print information about Linux users with the shell.

To get information about Linux users with the shell, give these examples a go. Get a listing of all /home folders on Linux. jason@Yog-Sothoth:~/Documents$ sudo gawk -F: ‘{ print $6 }’ /etc/passwd | grep /home /home/syslog /home/jason /home/justin /home/danieljason@Yog-Sothoth:~/Documents$ sudo gawk -F: ‘{ print $6 }’ /etc/passwd | grep /home…

Read More

Very useful Linux files to setup your installation.

Linux configuration files Here are a few useful Linux configuration files to get your installation setup and working just fine. ~/.vimrc. This is to setup the VIM editor and make it easier to use for the average Linux user. " ~/.vimrc (configuration file for vim only) " skeletons function! SKEL_spec()…

Read More

Image manipulation with the Linux shell.

Emulate a Polaroid photo with the imagemagik package on Linux. convert lifeinCanberra_bg.jpg -polaroid 0 house.jpgconvert lifeinCanberra_bg.jpg -polaroid 0 house.jpg This is the original image. https://www.asis.gov.au/media/Images/Rebrand/lifeinCanberra_bg.jpg. And this is the image after manipulation. Double the size of an image, while retaining relatively good image quality. convert missile.jpg -magnify missilebig.jpgconvert missile.jpg -magnify…

Read More

Very useful Ubuntu tips and tricks.

How to change your Ubuntu password as a normal user. jason@Yog-Sothoth:~$ passwd Changing password for jason. (current) UNIX password: Enter new UNIX password:jason@Yog-Sothoth:~$ passwd Changing password for jason. (current) UNIX password: Enter new UNIX password: Just enter you current password and then enter a new one twice. It is that…

Read More

How to have a custom message appear each time sudo is used.

This is how to have a custom lecture appear each time a user executes the sudo command to remind them to be careful with it. Run the visudo command as root and add these lines to the /etc/sudoers file. Defaults lecture="always" Defaults lecture_file="/home/jason/lecture"Defaults lecture="always" Defaults lecture_file="/home/jason/lecture" Then create the /home/jason/lecture…

Read More

Why you need to secure your website against online attack.

Securing your website against online attacks is very important. There are many online tools and distributions like Backtrack and Kali that have mass-scanning tools to use against a website. Below is what a mass-scanning attack on a website looks like. This is searching for vulnerable scripts on an Apache website….

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

How to show a banner explaining terms of use for an SSH connection before login.

It is very simple to show a banner to your users, that explains the terms of use for an SSH connection upon the user reaching a login prompt. Firstly, create a file named info in the /etc/ssh directory. sudo touch /etc/ssh/infosudo touch /etc/ssh/info Then put this in it. *************************************************************************** NOTICE…

Read More

How to encode a section of a movie to a webm file with mpv.

To encode a section of a movie file to a high-quality webm file, use this simple addon for mpv. Firstly run this command to create a directory to put the lua script. mkdir -p ~/.config/mpv/scriptsmkdir -p ~/.config/mpv/scripts Then download the required script to the directory we created. This is located…

Read More

How to setup proper directory indexing in Apache.

To get proper directory indexing set up in a directory in your Apache webserver configuration, firstly, create a .htaccess file and paste the code below into it. Options +Indexes   HeaderName HEADER.html ReadmeName FOOTER.html   IndexIgnore .htaccess .??* *~ *# HEADER* FOOTER* README* RCS CVS *,v *,t *.incOptions +Indexes HeaderName…

Read More

Dump the contents of a virtual console with this command.

There is a simple way to dump the contents of a virtual console to a file, the screendump command is the best way to achieve this. ubuntu ~ $ sudo screendump Ubunt * Stopping System V runlevel compatibility [ OK ] u 14.0 * Starting execute cloud user/final scripts […

Read More

Manage your user settings easily on Linux Mint or Ubuntu.

Managing your user account on Ubuntu or Linux Mint is very easy with the GUI utilities provided. Under System->Administration->Users and Groups, you have the option to create new user accounts, or modify existing ones. This is the window above, it is ready for the creation of new user accounts. Click…

Read More

get comprehensive information about a hard disk with the Linux command line.

Getting a lot of useful information about a hard disk drive is easy with Linux. The smartmontools package contains utilities to retrieve a lot of very useful info. Firstly, install this package. jason@Yog-Sothoth:~$ sudo apt install smartmontoolsjason@Yog-Sothoth:~$ sudo apt install smartmontools Then run the command with sudo to get info…

Read More

How to have a nice text banner associated with your Linux user account.

Your Linux user account details may be seen with the finger command, i.e finger jason. But the user can add more information to this as well. Create a file in your home directory named .plan and put this into it. ***************************************************************************^M NOTICE TO USERS     This computer system is…

Read More