linuxfreelancer.com Open in urlscan Pro
162.247.78.1  Public Scan

Submitted URL: http://linuxfreelancer.com/
Effective URL: https://linuxfreelancer.com/
Submission: On March 02 via api from GB — Scanned from GB

Form analysis 1 forms found in the DOM

GET /index.php

<form id="searchform" method="get" action="/index.php">
  <input type="text" value="To search, type and hit enter" name="s" id="s" onfocus="if (this.value == 'To search, type and hit enter') {this.value = '';}" onblur="if (this.value == '') {this.value = 'To search, type and hit enter';}">
</form>

Text Content

LINUX FREELANCER

Linux tips and tricks, IT news, cloud, virtualization, music

 * Home
 * 
 * Linux
 * C programming
 * How tos
 * Internet Policy
 * Music
 * All Posts
 * Personal Finance
 * About

Listen Music




LINUX / BASH – GENERATE A SEQUENCE OF NUMBERS

Posted by daniel

Apr 10

--------------------------------------------------------------------------------


HOW TO GENERATE A SEQUENCE OF NUMBERS IN BASH SCRIPTING

 * Use Bash 4’s brace expansion

1
2
3
4
5
$ echo {1..10}
1 2 3 4 5 6 7 8 9 10
 
$ echo {1..10..2}
1 3 5 7 9

 * Use “seq” command

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
$ seq 1 10
1
2
3
4
5
6
7
8
9
10
 
$ seq 1 2 10
1
3
5
7
9
 
$ echo $(seq 1 10)
1 2 3 4 5 6 7 8 9 10

0 Comments Filed under: How tos, Linux, Scripting




HOW TO VIEW CHANGELOG OF DEBIAN OR UBUNTU PACKAGE

Posted by daniel

Apr 10

--------------------------------------------------------------------------------


SHOW THE CHANGELOG OF PACKAGE WITH APT-GET

--------------------------------------------------------------------------------

In Ubuntu, the command “dpkg” is a tool to install, build, remove and manage
Debian packages. And aptitude(“apt”) is commonly used a frontend for dpkg. For
instance, to install a package most users would use “apt-get install package”.



The “changelog” sub-command for apt-get can be used to download and display the
changelog for the given package.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
$ apt-get changelog dnsutils
 
bind9 (1:9.16.1-0ubuntu2.7) focal; urgency=medium
 
  * Fix a race between deactivating socket handle and processing
    async callbacks, which can lead to sockets not being closed
    properly, exhausting TCP connection limits. (LP: #1909950) 
    - d/p/lp-1909950-fix-race-between-deactivating-handle-async-callback.patch
 
 -- Matthew Ruffell &lt;matthew.ruffell@canonical.com>  Thu, 18 Feb 2021 16:28:44 +1300
 
bind9 (1:9.16.1-0ubuntu2.6) focal-security; urgency=medium
 
  * SECURITY UPDATE: off-by-one bug in ISC SPNEGO implementation
    - debian/patches/CVE-2020-8625.patch: properly calculate length in
      lib/dns/spnego.c.
    - CVE-2020-8625
  * This update does _not_ contain the changes from 1:9.16.1-0ubuntu2.5 in
    focal-proposed.
 
 -- Marc Deslauriers &lt;marc.deslauriers@ubuntu.com>  Tue, 16 Feb 2021 15:08:33 -0500
 
....

Note: this will download the changelog for the package to the most recent
version of the package, not just the installed version. You can view the
installed version and candidate version with below command –

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
$ apt-cache policy dnsutils
dnsutils:
  Installed: 1:9.16.1-0ubuntu2.3
  Candidate: 1:9.16.1-0ubuntu2.7
  Version table:
     1:9.16.1-0ubuntu2.7 500
        500 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages
        500 http://archive.ubuntu.com/ubuntu focal-updates/universe i386 Packages
     1:9.16.1-0ubuntu2.6 500
        500 http://security.ubuntu.com/ubuntu focal-security/universe amd64 Packages
        500 http://security.ubuntu.com/ubuntu focal-security/universe i386 Packages
 *** 1:9.16.1-0ubuntu2.3 100
        100 /var/lib/dpkg/status
     1:9.16.1-0ubuntu2 500
        500 http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages
        500 http://archive.ubuntu.com/ubuntu focal/universe i386 Packages

--------------------------------------------------------------------------------

REFERENCES

--------------------------------------------------------------------------------

 1. https://linux.die.net/man/8/apt-get
 2. 
 3. https://linux.die.net/man/1/dpkg


0 Comments Filed under: How tos, Linux, Miscellaneous





LINUX – VIEW DNS CACHE CONTENTS

Posted by daniel

Oct 30

Every visit to a site such as google.com starts with resolving the domain name
or FQDN to an IP address. And this resolution is done by a dns service. The
domain name to IP address(A record in dns terminology) mapping is cached by both
dns servers and client as most domain names do not change IPs that often.

Sometimes though you might know that the A record or IP address of a domain has
changed and yet your local cache is holding the old IP. Before clearing the
cache, you can view the contents of the dns cache by sending a USR1 signal to
systemd-resolved

1
sudo killall -USR1 systemd-resolved

This will dump the contents of dns cache and name servers to systemd log, which
you can view with journalctl command –

1
sudo journalctl -u systemd-resolved

As the bottom of the log, you should see the CACHE entries –

1
2
3
4
5
6
7
Oct 30 22:53:04 hidmo systemd-resolved[23811]: CACHE:
Oct 30 22:53:04 hidmo systemd-resolved[23811]:         csi.gstatic.com IN A 209.85.202.120
Oct 30 22:53:04 hidmo systemd-resolved[23811]:         csi.gstatic.com IN A 209.85.202.94
Oct 30 22:53:04 hidmo systemd-resolved[23811]:         connectivity-check.ubuntu.com IN A 35.222.85.5
Oct 30 22:53:04 hidmo systemd-resolved[23811]:         connectivity-check.ubuntu.com IN A 35.224.99.156
 
....



0 Comments Filed under: How tos, Linux





LINUX – FLUSH DNS WITH SYSTEMD

Posted by daniel

Oct 30

TLTR; systemd-resolve –flush-caches

systemd-resolve is a CLI tool for resolving domain names, IPv4 and IPv6
addresses, DNS records and services.

It also provides dns resolution statistics, settings and ability to flush cache.
Before flushing cache, check the cache size and hit/miss statistics. Additional
information such as transactions count is also reported.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
$ sudo systemd-resolve --statistics
DNSSEC supported by current servers: no
 
Transactions                
Current Transactions: 0     
  Total Transactions: 105240
                             
Cache                       
  Current Cache Size: 15     
          Cache Hits: 50425 
        Cache Misses: 66235 
                             
DNSSEC Verdicts             
              Secure: 0     
            Insecure: 0     
               Bogus: 0     
       Indeterminate: 0     

As you can see above, the cache size is 15. In order to clear or flush the dns
cache, run below command –

1
systemd-resolve --flush-caches

Running systemd-resolve --statistics should show a current cache size of 0.


0 Comments Filed under: How tos, Linux





GET HTTP HEADERS

Posted by daniel

Aug 2


LINUX – VIEW HTTP HEADER RESPONSE USING CURL, HTTPIE, GET, NMAP

--------------------------------------------------------------------------------

Most users are interested in the content they receive when they visit a web
site. There is an extra information web clients and servers exchange – HTTP
headers. HTTP headers let the client and the server pass additional information
with an HTTP request or response.

So how do we view the HTTP response from a remove web server? There are several
tools for these

1. CURL : USE ‘-I’ FLAG

1
2
3
-I, --head
       (HTTP FTP FILE) Fetch the headers only! HTTP-servers feature the command
HEAD which this uses to get nothing but  the  header  of  a
       document. When used on an FTP or FILE file, curl displays the file size
and last modification time only.

1
2
3
4
5
6
7
8
9
10
11
$ curl -I google.com
HTTP/1.1 301 Moved Permanently
Location: http://www.google.com/
Content-Type: text/html; charset=UTF-8
Date: Sun, 02 Aug 2020 13:48:01 GMT
Expires: Tue, 01 Sep 2020 13:48:01 GMT
Cache-Control: public, max-age=2592000
Server: gws
Content-Length: 219
X-XSS-Protection: 0
X-Frame-Options: SAMEORIGIN

2. HTTPIE : USE ‘-H H’ FLAG

1
2
3
4
5
6
--print WHAT, -p WHAT
       String specifying what the output should contain:
      'H' request headers
      'B' request body
      'h' response headers
      'b' response body

1
2
3
4
5
6
7
8
9
10
11
12
13
14
$ http www.google.com --print h
 HTTP/1.1 200 OK
 Cache-Control: private, max-age=0
 Content-Encoding: gzip
 Content-Length: 5256
 Content-Type: text/html; charset=ISO-8859-1
 Date: Sun, 02 Aug 2020 13:50:50 GMT
 Expires: -1
 P3P: CP="This is not a P3P policy! See g.co/p3phelp for more info."
 Server: gws
 Set-Cookie: 1P_JAR=2020-08-02-13; expires=Tue, 01-Sep-2020 13:50:50 GMT; path=/; domain=.google.com; Secure
 Set-Cookie: NID=TRUNCATED; expires=Mon, 01-Feb-2021 13:50:50 GMT; path=/; domain=.google.com; HttpOnly
 X-Frame-Options: SAMEORIGIN
 X-XSS-Protection: 0


3. GET – LWP-REQUEST : ‘ED’ FLAG

In many Linux distros, GET is an alias for lwp-request. It gives way more
detailed information in the response header, including SSL parameters.

1
2
3
-E  Print response status chain with full response headers.
 
-d  Do not print the content of the response.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
$ GET linux.com -Ed
GET http://linux.com
User-Agent: lwp-request/6.31 libwww-perl/6.31
 
301 Moved Permanently
Cache-Control: public, max-age=86400
Connection: close
Date: Sun, 02 Aug 2020 13:56:35 GMT
Via: 1.1 varnish
Accept-Ranges: bytes
Age: 43368
Location: https://linux.com/
Server: nginx
Vary: Cookie, Cookie
Content-Length: 162
Content-Type: text/html
Client-Date: Sun, 02 Aug 2020 13:56:35 GMT
Client-Peer: REDACTED
Client-Response-Num: 1
Title: 301 Moved Permanently
X-Cache: HIT, HIT
X-Cache-Hits: 1, 1
X-Pantheon-Styx-Hostname: styx-fe3-a-745747b57-x7rhq
X-Served-By: cache-mdw17324-MDW, cache-fty21379-FTY
X-Styx-Req-Id: 01697a62-d463-11ea-a64f-aabcb0e0cfdc
X-Timer: S1596376596.936127,VS0,VE1
 
GET https://linux.com/
User-Agent: lwp-request/6.31 libwww-perl/6.31
 
301 Moved Permanently
Cache-Control: public, max-age=86400
Connection: close
Date: Sun, 02 Aug 2020 13:56:36 GMT
Via: 1.1 varnish
Accept-Ranges: bytes
Age: 43368
Location: https://www.linux.com/
Server: nginx
Vary: Cookie, Cookie
Content-Length: 0
Content-Type: text/html; charset=UTF-8
Client-Date: Sun, 02 Aug 2020 13:56:36 GMT
Client-Peer: REDACTED
Client-Response-Num: 1
Client-SSL-Cert-Issuer: /C=US/O=Let's Encrypt/CN=Let's Encrypt Authority X3
Client-SSL-Cert-Subject: /CN=linux.com
Client-SSL-Cipher: ECDHE-RSA-AES128-GCM-SHA256
Client-SSL-Socket-Class: IO::Socket::SSL
Strict-Transport-Security: max-age=300
X-Cache: HIT, HIT
X-Cache-Hits: 1, 1
X-Pantheon-Styx-Hostname: styx-fe3-b-64d9844f89-tc7zl
X-Served-By: cache-mdw17340-MDW, cache-pdk17820-PDK
X-Styx-Req-Id: 01bf3709-d463-11ea-baef-1ede833e594e
X-Timer: S1596376596.065153,VS0,VE1
 
GET https://www.linux.com/
User-Agent: lwp-request/6.31 libwww-perl/6.31
 
200 OK
Cache-Control: public, max-age=1800
Connection: close
Date: Sun, 02 Aug 2020 13:56:36 GMT
Via: 1.1 varnish
Accept-Ranges: bytes
Age: 1659
Server: nginx
Vary: Accept-Encoding, Cookie, Cookie
Content-Length: 126289
Content-Type: text/html; charset=UTF-8
Client-Date: Sun, 02 Aug 2020 13:56:36 GMT
Client-Peer: REDACTED
Client-Response-Num: 1
Client-SSL-Cert-Issuer: /C=US/O=Let's Encrypt/CN=Let's Encrypt Authority X3
Client-SSL-Cert-Subject: /CN=linux.com
Client-SSL-Cipher: ECDHE-RSA-AES128-GCM-SHA256
Client-SSL-Socket-Class: IO::Socket::SSL
Link: &lt;https://www.linux.com/wp-json/>; rel="https://api.w.org/"
Link: &lt;https://www.linux.com/>; rel=shortlink
Strict-Transport-Security: max-age=300
Title: Linux.com - News For Open Source Professionals
X-Cache: HIT, MISS
X-Cache-Hits: 5, 0
X-Meta-Charset: UTF-8
X-Meta-Description: Linux.com is the go-to resource for open source professionals to learn about the latest in Linux and open source technology, careers, best practices, and industry trends. Get news, information, and tutorials to help advance your next project or career – or just to simply stay informed.
X-Meta-Generator: WordPress 5.4.2
X-Meta-Twitter-Card: summary_large_image
X-Meta-Twitter-Description: Linux.com is the go-to resource for open source professionals to learn about the latest in Linux and open source technology, careers, best practices, and industry trends. Get news, information, and tutorials to help advance your next project or career – or just to simply stay informed.
X-Meta-Twitter-Image: https://www.linux.com/wp-content/uploads/2019/08/ldc_social.jpg
X-Meta-Twitter-Title: Linux.com - News For Open Source Professionals
X-Meta-Viewport: width=device-width, initial-scale=1.0
X-Pantheon-Styx-Hostname: styx-fe3-a-745747b57-mfmk7
X-Served-By: cache-mdw17340-MDW, cache-pdk17866-PDK
X-Styx-Req-Id: 1df2da1b-d4c4-11ea-84e9-925461917092
X-Timer: S1596376596.261327,VS0,VE18

NMAP : –SCRIPT=HTTP-HEADERS FLAG

Nmap is a network discovery tool but it can be used for scanning http headers as
well. The port number has to be specified, otherwise nmap will scan several
common ports.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
$ nmap --script=http-headers google.com -p 80
 
Starting Nmap 7.60 ( https://nmap.org ) at 2020-08-02 10:00 PDT
Nmap scan report for google.com (172.217.15.110)
Host is up (0.026s latency).
rDNS record for 172.217.15.110: iad30s21-in-f14.1e100.net
 
PORT   STATE SERVICE
80/tcp open  http
| http-headers: 
|   Location: http://www.google.com/
|   Content-Type: text/html; charset=UTF-8
|   Date: Sun, 02 Aug 2020 14:00:10 GMT
|   Expires: Tue, 01 Sep 2020 14:00:10 GMT
|   Cache-Control: public, max-age=2592000
|   Server: gws
|   Content-Length: 219
|   X-XSS-Protection: 0
|   X-Frame-Options: SAMEORIGIN
|   Connection: close
|   
|_  (Request type: GET)
 
Nmap done: 1 IP address (1 host up) scanned in 0.69 seconds
 
 
 
$ nmap --script=http-headers google.com -p 443
 
Starting Nmap 7.60 ( https://nmap.org ) at 2020-08-02 10:00 PDT
Nmap scan report for google.com (172.217.15.110)
Host is up (0.027s latency).
rDNS record for 172.217.15.110: iad30s21-in-f14.1e100.net
 
PORT    STATE SERVICE
443/tcp open  https
| http-headers: 
|   Location: https://www.google.com/
|   Content-Type: text/html; charset=UTF-8
|   Date: Sun, 02 Aug 2020 14:00:13 GMT
|   Expires: Tue, 01 Sep 2020 14:00:13 GMT
|   Cache-Control: public, max-age=2592000
|   Server: gws
|   Content-Length: 220
|   X-XSS-Protection: 0
|   X-Frame-Options: SAMEORIGIN
|   Alt-Svc: h3-29=":443"; ma=2592000,h3-27=":443"; ma=2592000,h3-T050=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
|   Connection: close
|   
|_  (Request type: GET)
 
Nmap done: 1 IP address (1 host up) scanned in 0.74 seconds



0 Comments Filed under: Computer Security, How tos, Linux, Miscellaneous,
Scripting




LINUX – HOW TO DELETE FILES WITH DASH OR DOUBLE DASH

Posted by daniel

May 25

--------------------------------------------------------------------------------

DELETING FILES WITH RM AND GETTING
RM: INVALID OPTION –TRY ‘RM –HELP’ FOR MORE INFORMATION.

In Linux, trying to delete a file its name starts with dash(‘-‘) or double
dashes(‘–‘) will fails, as dash or ‘-‘ is interpreted as an option by the rm and
most linux commands.

Here are two files with filenames starting with ‘-‘ and ‘–‘ and the typical rm
command deletion attempt fails with an error –

1
2
3
4
5
6
7
8
9
10
11
12
13
$ ls -1
-tempfile1
--tempfile2
 
$ rm -tempfile1
rm: invalid option -- 't'
Try 'rm ./-tempfile1' to remove the file '-tempfile1'.
Try 'rm --help' for more information.
 
$ rm --tempfile2
rm: unrecognized option '--tempfile2'
Try 'rm ./--tempfile2' to remove the file '--tempfile2'.
Try 'rm --help' for more information.

There are several ways of addressing this – you can precede the file name with
./ OR pass double dash after rm to end all option processing.

1
2
3
4
5
6
7
8
$ ls
-tempfile1  --tempfile2
 
$ rm -- -tempfile1
 
$ mv -- --tempfile2 tempfile2
 
$ rm ./-tempfile1

--------------------------------------------------------------------------------



References –

http://www.gnu.org/software/coreutils/faq/coreutils-faq.html#How-do-I-remove-files-that-start-with-a-dash_003f

0 Comments Filed under: How tos, Linux


View more posts »


LINUX FEEDS

 * Linux / Bash – generate a sequence of numbers April 10, 2021 daniel
 * How to view changelog of Debian or Ubuntu package April 10, 2021 daniel
 * Linux – view dns cache contents October 31, 2020 daniel
 * Linux – flush dns with systemd October 31, 2020 daniel
 * Get HTTP headers August 2, 2020 daniel
 * Linux – how to delete files with dash or double dash May 25, 2020 daniel




RECENT POSTS

 * Linux / Bash – generate a sequence of numbers
 * How to view changelog of Debian or Ubuntu package
 * Linux – view dns cache contents
 * Linux – flush dns with systemd
 * Get HTTP headers
 * Linux – how to delete files with dash or double dash
 * Terraform – show logging
 * Linux – how to create a file
 * Exclude files from Dockerfile
 * nslookup query a specific name server



CATEGORIES

 * Amazon web services(AWS)
 * c-programming
 * Computer Security
 * Containers
 * How tos
 * Internet policy
 * Linux
 * Miscellaneous
 * Personal Finance
 * Scripting
 * Stand-up comedy



ARCHIVES

 * April 2021
 * October 2020
 * August 2020
 * May 2020
 * March 2020
 * February 2020
 * December 2019
 * November 2019
 * October 2019
 * September 2019
 * May 2019
 * November 2018
 * August 2018
 * June 2018
 * May 2018
 * April 2018
 * March 2018
 * February 2018
 * January 2018
 * November 2017
 * September 2017
 * August 2017
 * July 2017
 * June 2017
 * May 2017
 * April 2017
 * March 2017
 * February 2017
 * January 2017
 * December 2016
 * December 2015
 * April 2015
 * November 2014
 * August 2014
 * July 2014
 * December 2013
 * August 2013
 * December 2012
 * November 2012
 * March 2012
 * December 2011
 * September 2011
 * August 2011
 * July 2011
 * May 2011
 * April 2011
 * December 2010
 * November 2010
 * August 2010
 * July 2010
 * May 2010
 * April 2010


LINKS

 * C programming site
 * Linux tutorial
 * TED – ideas worth spreading
 * opensource.com
 * Linux
 * Internet radios directory
 * gcplinux





META

 * Log in
 * Valid XHTML
 * XFN
 * WordPress




March 2022 M T W T F S S  123456 78910111213 14151617181920 21222324252627
28293031  

« Apr    

--------------------------------------------------------------------------------

Linux Freelancer is proudly powered by WordPress
Entries (RSS) and Comments (RSS). 43 queries. 0.325 seconds.