Skip to content

Instantly share code, notes, and snippets.

@adityaka
Last active October 27, 2024 16:44
Show Gist options
  • Save adityaka/c173d241f03d69853c47b2937fd310c6 to your computer and use it in GitHub Desktop.
Save adityaka/c173d241f03d69853c47b2937fd310c6 to your computer and use it in GitHub Desktop.
Get Latest linux kernel path from Kernel.org

How to get latest linux kernel using wget

Command

KERNEL_URI=$(wget http://kernel.org -O - | grep 'tar.xz' | head -1 | cut -d "=" -f2 | sed -e 's/\"//g' | sed -e 's/>.*//g')
KERNEL_FILE=KERNEL_FILE=$(echo $KERNEL_URI | sed -e 's/https.*\///g')
wget $KERNEL_URI -O $KERNEL_FILE

Output

"https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.9.5.tar.xz"><img src
[root@localhost grub.d]# wget http://kernel.org -O - | grep 'tar.xz' | head -1 | cut -d "=" -f2 | sed -e 's/\"//g' | sed -e 's/>.*//g'
--2017-01-22 18:46:41--  http://kernel.org/
Resolving kernel.org (kernel.org)... 149.20.4.69, 199.204.44.194, 198.145.20.140, ...
Connecting to kernel.org (kernel.org)|149.20.4.69|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://www.kernel.org/ [following]
--2017-01-22 18:46:41--  https://www.kernel.org/
Resolving www.kernel.org (www.kernel.org)... 199.204.44.194, 2001:4f8:1:10:0:1991:8:25, 2620:3:c000:a:0:1991:8:25
Connecting to www.kernel.org (www.kernel.org)|199.204.44.194|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 21644 (21K) [text/html]
Saving to: ‘STDOUT’

-                                     100%[======================================================================>]  21.14K  91.2KB/s    in 0.2s    

2017-01-22 18:46:43 (91.2 KB/s) - written to stdout [21644/21644]


**Download output**
[root@localhost grub.d]# wget $KERNEL_URI -O $KERNEL_FILE
--2017-01-22 18:56:54--  https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.9.5.tar.xz
Resolving cdn.kernel.org (cdn.kernel.org)... 151.101.8.69
Connecting to cdn.kernel.org (cdn.kernel.org)|151.101.8.69|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 93192920 (89M) [application/x-xz]
Saving to: ‘linux-4.9.5.tar.xz’

linux-4.9.5.tar.xz                    100%[======================================================================>]  88.88M  2.04MB/s    in 46s     


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment