How to have a nice bash shell prompt that will print the current git branch on the prompt.

This interesting bash function will get the git branch of the current working directory and then print it in the shell prompt. This could be very useful for a programmer. git_branch() { git branch 2> /dev/null | sed -e ‘/^[^*]/d’ -e ‘s/* \(.*\)/(\1)/’ }   PS1=’┌──[\u@\h]─[\w]\n└──╼ $(git_branch) ╼ \$ ‘git_branch() { git branch 2> /dev/null … Read more

A much better way to save audio from Youtube with youtube-dl.

Saving music from Youtube is fun. I am going to show how to save in good quality using youtube-dl by itself. This command will do it in one go. youtube-dl -f 140 https://www.youtube.com/watch?v=eb-2ljQDYFU –embed-thumbnail –extract-audio –audio-format mp3youtube-dl -f 140 https://www.youtube.com/watch?v=eb-2ljQDYFU –embed-thumbnail –extract-audio –audio-format mp3 This is the command in action. This gets the music in … Read more

How to generate a very nice colored desktop background with the command line.

The Linux command line is very useful and it can even generate you a nice wallpaper image using just the shell and ImageMagick. The example below will generate a 3440×1440 pixels wallpaper image using just the random data from /dev/urandom. ┌─[jason@jason-desktop]─[~/Documents] └──╼ $mx=320;my=256;head -c "$((3*mx*my))" /dev/urandom | convert -depth 8 -size "${mx}x${my}" -resize 3440×1440\! -channel … Read more

Youtube-dl automatic update not working.

The updates for youtube-dl do not work anymore on Ubuntu, but it can be updated manually. Download the script here: https://youtube-dl.org/downloads/latest/youtube-dl. Then copy the script over the top of the existing one in /usr/bin and then make sure it has the executable flags 755. This is very easy. Download it very easily. ┌─[jason@jason-desktop]─[~/Downloads] └──╼ $wget … Read more

Youtube-dl to be removed from the Internet? Time to make a private repo.

The RIAA is arguing that youtube-dl is illegal because it’s a tool to download copyrighted content. They filed a complaint to Github which took several of its forks down immediately. This could mean it will disappear from the Internet. Time to make a local repo and share it on other channels. They are worried about … Read more

Some very useful Linux tips and tricks.

To read a file from the Internet using wget and print it in the terminal, use this command. ┌─[jason@jason-desktop]─[~/Documents] └──╼ $wget -qO – https://i.mjh.nz/au/Brisbane/raw-tv.m3u8┌─[jason@jason-desktop]─[~/Documents] └──╼ $wget -qO – https://i.mjh.nz/au/Brisbane/raw-tv.m3u8 View an image from the Internet with wget and the ImageMagik display utility. ┌─[jason@jason-desktop]─[~/Documents] └──╼ $wget -qO – https://i.4cdn.org/g/1603231784644.png | display┌─[jason@jason-desktop]─[~/Documents] └──╼ $wget -qO – https://i.4cdn.org/g/1603231784644.png … Read more

Create a tiled image with ImageMagick on Linux.

Creating a tiled image on Linux with the command line is very easy to do. This command will take the pyramid.bmp file and tile it as a 3440×1440 widescreen image. ┌─[jason@jason-desktop]─[~/Pictures/Windows/bitmaps] └──╼ $convert -size 3440×1440 tile:pyramid.bmp Tiles.jpg┌─[jason@jason-desktop]─[~/Pictures/Windows/bitmaps] └──╼ $convert -size 3440×1440 tile:pyramid.bmp Tiles.jpg This example will create a massive 7680×2160 pixel image. ┌─[jason@jason-desktop]─[~/Pictures/Windows/bitmaps] └──╼ $convert … Read more

How to download a Youtube video as an MP3 with Linux.

Saving a Youtube video as audio and not video is very easy. This command below will save Youtube audio as an MP3 file. You need youtube-dl as well. Then select a Youtube video and use this one-liner to download it as an MP3 audio file. jason@jason-Lenovo-H50-55:~/Videos$ youtube-dl -f 140 https://www.youtube.com/watch?v=neEXAoYfcRo -o – | ffmpeg -hide_banner … Read more

How to download a Youtube video thumbnail on Linux.

Downloading a thumbnail of a Youtube video on Linux is very easy. This can be done using the youtube-dl script. Use this youtube-dl command to list all thumbnails for this video. ┌─[jason@jason-desktop]─[~/Pictures] └──╼ $youtube-dl https://www.youtube.com/watch?v=0ttKUEI3rtM –list-thumbnails [youtube] 0ttKUEI3rtM: Downloading webpage [info] Thumbnails for 0ttKUEI3rtM: ID width height URL 0 168 94 https://i.ytimg.com/vi/0ttKUEI3rtM/hqdefault.jpg?sqp=-oaymwEYCKgBEF5IVfKriqkDCwgBFQAAiEIYAXAB&rs=AOn4CLCtzil9D33ps4rh6SWgoECSwl7PZg 1 196 110 … Read more

How to install a very useful virus scanner on Ubuntu and scan for malware.

The ClamAV virus scanner is very useful for scanning files for malicious code. This is good if you download files from the Internet that are going to be used on a Windows computer. This is very easy to install. ┌─[jason@jason-desktop]─[~/Downloads/Dark Path/S.T.A.L.K.E.R. – Dark Path] └──╼ $sudo apt install clamav┌─[jason@jason-desktop]─[~/Downloads/Dark Path/S.T.A.L.K.E.R. – Dark Path] └──╼ $sudo … Read more

Very useful Ubuntu tips.

To get a nice warm screen color instead of a glaring white screen at night, use this very useful program. Redshift will remove blue light from your computer screen and then this will help with sleep. ┌─[jason@jason-desktop]─[/] └──╼ $sudo apt install redshift-gtk┌─[jason@jason-desktop]─[/] └──╼ $sudo apt install redshift-gtk Start Redshift from the Applications-Accessories menu and then … Read more

How to create a fake webcam stream on Linux.

Creating a webcam stream of your desktop, instead of an actual webcam is very easy on Linux. The v412loopback package provides a kernel module that will emulate a webcam, using any video input you wish to give it. Install it like this. ┌──[[email protected]]─[~] └──╼ ╼ $ sudo apt install v4l2loopback-dkms┌──[[email protected]]─[~] └──╼ ╼ $ sudo apt … Read more

How to download a video blob easily from a website.

Downloading a video blob from a website can be very frustrating. This is easier with the Download Helper extension for Firefox. This can make this task very easy. When you are on a website that hasthe video you want, click the Download Helper icon and find the format and resolution you wish to download. Then … Read more

How to list previously installed packages from the apt history.

This is how to get information about recently installed packages on Ubuntu. This is looking at the lowlatency package I just installed. 4.4 Thu Jun 04 jason@Yog-Sothoth 0: $ grep "lowlatency" /var/log/apt/history.log | sed "s/ /\n/gi"; Commandline: apt install linux-image-5.3.0-24-lowlatency Install: linux-image-5.3.0-24-lowlatency:amd64 (5.3.0-24.26~18.04.2), linux-modules-5.3.0-24-lowlatency:amd64 (5.3.0-24.26~18.04.2, automatic) Commandline: apt-get install –reinstall linux-image-5.3.0-24-lowlatency Reinstall: linux-image-5.3.0-24-lowlatency:amd64 (5.3.0-24.26~18.04.2) Commandline: … Read more

Easily change files on your Linux system with a simple command.

This command will change the default port for the SSH server on your Linux machine. jason@jason-desktop:~$ perl -pi -e ‘s/^#?Port 22$/Port 443/’ /etc/ssh/sshd_configjason@jason-desktop:~$ perl -pi -e ‘s/^#?Port 22$/Port 443/’ /etc/ssh/sshd_config Then run this command to restart the SSH server. jason@jason-desktop:~$ sudo service ssh restartjason@jason-desktop:~$ sudo service ssh restart This will work very well. This is … Read more