Update Git

Refer: https://askubuntu.com/questions/579589/upgrade-git-version-on-ubuntu-14-04

$ sudo add-apt-repository ppa:git-core/ppa
$ sudo apt-get update
$ sudo apt-get install git
$ git --version

Grep with SubString

Refer: https://stackoverflow.com/questions/38270261/how-to-extract-a-string-from-between-two-patterns-in-bash

Looking for parameter between -Dappdynamics.agent.nodeName= and closing space

$ ps aux | grep -i appdynamics | grep -oP '(?<= -Dappdynamics.agent.nodeName=)[^ ]+'

$ grep -oP '(?<= -Dappdynamics.agent.nodeName=)[^ ]+' input.txt

-o tells grep to only output the matching part(s) of each line.

-P activates support for PCREs (Perl-compatible regular expressions), which support look-behind assertions such as (?<= inet:), which allow a sub-expression (inet:, in this case) to participate in matching, without being captured (returned) as part of the matched string. [^ ]+ then simply captures everything after inet: up to the first space char. (character set [^ ] matches any char. that is not (^) a space, and + matches this set 1 or more times).

Install Latest Version of youtube-dl

Try this instead because youtube-dl no longer seems to work as of September 22, 2024

sudo snap install video-downloader

Check your version with: youtube-dl --version

Try ppa:nilarimogard/webupd8. I do get upgrades every couple of days and I think, according to the message You get, that it should solve/answer Your question. If You did an upgrade from 13.04 to 13.10 You might have forgot (I guess) to update sources-list.d folder, for example, if You used WebUpd8 before.

$ sudo apt-add-repository ppa:nilarimogard/webupd8
$ sudo apt-get update
$ sudo apt-get install youtube-dl

Usage:

$ youtube-dl -f mp4 --output "yourfilename.%(ext)s" https://youtu.be/your-link-here
$ youtube-dl --extract-audio --audio-format mp3 --audio-quality 256 --output "yourfilename.%(ext)s" https://youtu.be/your-link-here

If you are getting a warning about avconv being out of date.

Refer: https://askubuntu.com/questions/563245/avconv-warning-while-downloading-youtube-video

before

$ avconv |& grep \ version | awk '{print $3}'
9.18-6:9.18-0ubuntu0.14.04.1,

$ sudo add-apt-repository ppa:heyarje/libav-11 && sudo apt-get update
$ sudo apt-get install libav-tools

after

$ avconv |& grep \ version | awk '{print $3}'

Issue now requires the enter key to be hit to finish the download

Getting Ubuntu to Update Behind Firewall

This worked

Sample Error:

Err:70 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages 503 Service Unavailable [IP: 91.189.88.161 80]

Refer: https://askubuntu.com/questions/26528/error-503-service-unavailable-when-using-apt-get-update-behind-proxy

$ sudo su -

$ echo 'Acquire { http::User-Agent "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36"; };' >> /etc/apt/apt.conf

You could also just update the apt.conf file in place instead of using the echo command.

update-ubuntu-user-agent.txt

In case you cannot update from a repository, you can select the best mirror possible.

Ideas to try:

  • Get keys manually - http://redcrackle.com/blog/how-add-ubuntu-apt-get-key-behind-firewall
  • Adding a repository to use port 80 - https://gist.github.com/maciakl/4531580

Ubuntu Command Line Short Cuts (CLI)

Some useful line editing key bindings provided by the Readline library:

  • Ctrl-A: go to the beginning of line
  • Ctrl-E: go to the end of line
  • Alt-B: skip one word backward
  • Alt-F: skip one word forward
  • Ctrl-U: delete to the beginning of line
  • Ctrl-K: delete to the end of line
  • Alt-D: delete to the end of word

Grep only certain files

$ grep -ir --include pom.xml "<java.version>"

Refer: https://stackoverflow.com/questions/12516937/grep-but-only-certain-file-extensions

$ grep -r -i --include \*.h --include \*.cpp CP_Image ~/path[12345] | mailx -s GREP email@domain.com

Sending email from command line on Linux

Refer: https://tecadmin.net/ways-to-send-email-from-linux-command-line/

$ mail -s "Test email" someone@hotmail.com < /dev/null

$ cat email.txt
<BOF>

Subject: Terminal email sent

line 1
line 2
<EOF>

$ mail -s "Test email" someone@hotmail.com < email.txt

Gnome getting window buttons back

It is not immediately obvious how to do this, with GNOME Tweak Tool having no easy-click option to move them, and many old forum answers no longer applying.

Install dconf-editor from the Software app and then navigate to org.gnome.desktop.wm.preferences.