50 Most Frequently Used UNIX / Linux Commands (With Examples)

Several pearl in 50 Most Frequently Used UNIX / Linux Commands (With Examples)

  • Add line number for all non-empty-lines in a file
    $ sed '/./=' thegeekstuff.txt | sed 'N; s/\n/ /'
  • Remove duplicate lines using awk
    $ awk '!($0 in array) { array[$0]; print }' temp
    

     

  • Print all lines from /etc/passwd that has the same uid and gid
    $awk -F ':' '$3==$4' passwd.txt
    
  • Go to the 143rd line of file
    $ vim +143 filename.txt
    

     

  • Go to the first match of the specified
    $ vim +/search-term filename.txt
    

Cert for both www and plain domain

Just a note for myself: renew Let’s Encrypt certificate to make it valid for both www and plain domain

You should be able to do that using the command you originally used to obtain the certificate. Add --force-renewal to force the client to get a new certificate even if the current one isn’t close to expiring. Based on your earlier post, this would be something like:

./letsencrypt-auto --apache -d example.me -d www.example.me -d mysql.example.me --force-renewal

Revocation isn’t needed – that’s something you only need to bother with if your private key is compromised.

Mathematical Annotation in R

Mathematical Annotation in R | Vistat

Want to write mathematical symbols and expressions in R graphics? You can use an R expression() instead of normal text, e.g. plot(1:10, main = expression(alpha + beta)). Below is a demo that shows you everything about plotting math in R (it was written by the R Core Team; see ?plotmath for details):

demo<span class="p">(</span>plotmath<span class="p">)</span> Continue reading