Thanks to antville.org
scrolling in screen

We can not scroll up or down while working in screen mode. Press Ctrl-a, Esc to enter copy mode, then use standard navigation keys. Adding the following to ~/.screenrc will solve this issue.
termcapinfo xterm|xterms|xs|rxvt ti@:te@

or add this to /etc/screenrc
defscrollback 1024

hardstatus on
hardstatus alwayslastline
hardstatus string "%{.bW}%-w%{.rW}%n %t%{-}%+w %=%{..G} %H %{..Y} %m/%d %C%a "

As a quick tip, name your screen windows using Ctrl-a A

... Link (0 comments) ... Comment


Curling PHP

CURL can be used very effectively using PHP. Here is an example.

cat curl.php

<?php
$ch = curl_init("www.google.com");
$fp = fopen("example.txt", "w");

curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);

curl_exec($ch);
curl_close($ch);
fclose($fp);
?>

... Link (0 comments) ... Comment


Counting file types

cat myawk.sh

!/bin/sh

list the type of files with count

find ${*-.} -type f -print | xargs file |
awk '{
$1=NULL;
t[$0]++;
}
END {
for (i in t) printf("%d\t%s\n", t[i], i);
}' | sort -nr

... Link (0 comments) ... Comment


Easy SSH

HashKnownHosts no
Add the above line in your ssh_config file that can be found here....
/etc/ssh/ssh_config

... Link (0 comments) ... Comment


Old date in Shell

If you need to know the 3 days old date, it easy in shell.

$ v_prev_date=date --date='3 days ago' +%Y%m%d

$ echo $v_prev_date
20090808

... Link (0 comments) ... Comment


Number all lines in a file

perl -pe '$ = "$. $"'

“-p” causes Perl to assume a loop around the program (specified by “-e”) that reads each line of input into the ” $ ” variable, executes the program and then prints the ” $ ” variable. In this one-liner I simply modify ” $_ ” and prepend the ” $. ” variable to it. The special variable ” $. ” contains the current line number of input.
The result is that each line gets its line number prepended.

... Link (0 comments) ... Comment


awk power

$ cat salaries
Yvette van der Hoff 100000
Sarack Abama 400000
Bernie Madoff 0
John Q. Public 20000

$ awk '{print $NF, $0}' salaries | sort -nr -k1,1 | cut -d" " -f2-
Sarack Abama 400000
Yvette van der Hoff 100000
John Q. Public 20000
Bernie Madoff 0

$ awk -F '\t' -v 'OFS=\t' '{print $4, $3, $5, $2, $1}' data.txt
POP. COUNTY GOVT. CITY STATE
123 Gila Mayor Ely AZ
345 Lolo Sheriff Alma CA
22 El Paso Bubba Leroy TX

... Link (0 comments) ... Comment


Declare your assets!

The declare command can be helpful in identifying variables, environmental or otherwise. This can be especially useful with arrays.

bash$ declare | grep HOME
/home/bozo

bash$ zzy=68
bash$ declare | grep zzy
zzy=68

bash$ Colors=([0]="purple" [1]="reddish-orange" [2]="light green")
bash$ echo ${Colors[@]}
purple reddish-orange light green
bash$ declare | grep Colors
Colors=([0]="purple" [1]="reddish-orange" [2]="light green")

... Link (0 comments) ... Comment


Online for 6728 days
Last modified: 12/21/20 8:13 AM
Status
Youre not logged in ... Login
Menu
... Home
... Tags

Search
Calendar
January 2021
SunMonTueWedThuFriSat
12
3456789
10111213141516
17181920212223
24252627282930
31
December
Recent updates
Preserve seeds 4
types of seeds to be preserved for next season. 1) Ramphal https://www.amazon.in/dp/B00KTG8KQ6/?coliid=I3GKU4J9VLPZ6O&colid=RHNWRLPIY54W&psc=1&ref_=lv_ov_lig_dp_it...
by shantanuo (12/21/20 8:13 AM)
Why do I care for
Linux? I don't care that much for other software. Linux...
by shantanuo (12/17/20 9:27 AM)
important leafy vegetables 1. Amaranthus
caudatus: rajgira. 2. Amaranthus tricolor: Math.  (Chhoti Chulai- Hindi, Cheera-...
by shantanuo (4/12/20 2:01 PM)
program creek program creek
seems to be a good site for handy references of python...
by shantanuo (4/11/20 11:24 AM)
Standard out to a file
This code will change the standard out to a file...
by shantanuo (4/11/20 11:18 AM)
Create config file for AWS
command line tool While creating amazon config file in a...
by shantanuo (2/20/20 6:00 AM)
setting colors in pandas This
is how to set the colors in pandas mapper =...
by shantanuo (2/20/20 5:53 AM)
log mysql output tee output.txt
show global variables; show engine innodb status\G show full processlist;...
by shantanuo (2/19/20 10:33 AM)
access AWS API gateway using
python Amazon API gateway allows us to host serverless API's...
by shantanuo (2/16/20 9:41 AM)
Using boto In the bad
old days, the glacier class used to have different layers....
by shantanuo (2/15/20 10:28 AM)
backup mysql users  3
steps to install percona utility... yum install perl-DBI perl-Data-Dumper perl-DBD-MySQL wget...
by shantanuo (2/13/20 1:49 PM)
Steps to be used for
generating AWS API gateway a) Method Execution - Get Method...
by shantanuo (2/13/20 1:30 PM)
apply colors to pandas Here
is how to change the color of negative values to...
by shantanuo (2/12/20 8:57 AM)
Holidays in India These are
the common holidays celebrated in India (Mumbai) during 2016 -...
by shantanuo (2/11/20 1:53 PM)
change log file size in
MySQL Here are the steps to be followed while changing...
by shantanuo (2/11/20 10:38 AM)
MySQL common error messages 1146
Table does not exist 1054 column does not exist 1062...
by shantanuo (2/11/20 10:13 AM)
ipython parallel demo First start
ipython in cluster mode ipcluster start -n 4 from IPython.parallel...
by shantanuo (2/9/20 9:02 AM)
djanog settings You may see
this message if you have DEBUG = True in your...
by shantanuo (2/9/20 4:07 AM)
clear tmp folder Here is
following commands to clear unwanted stuff from the /tmp partition...
by shantanuo (2/8/20 2:41 PM)
change your server time to
IST If you need to change your server clock to...
by shantanuo (2/8/20 2:39 PM)
Transfer root emails to another
email address If you have root access to the server...
by shantanuo (2/8/20 2:32 PM)
special strings in cron Instead
of the first five fields, you can use any one...
by shantanuo (2/8/20 2:30 PM)
LibreOffice version conflict I am
not able to install latest version of Libre office. I...
by shantanuo (1/29/20 9:15 AM)
while loop This is
a sample shell script while loop while read mydb do echo...
by shantanuo (1/26/20 12:24 PM)
compare mysql schema And here
is poor man's schema compare using good old diff command......
by shantanuo (1/26/20 11:49 AM)

RSS feed

Made with Antville
Helma Object Publisher