Linux console üzerinden dış ip ve lokasyon bilgileri bulma komutu:
# curl ipinfo.io
Farklı bir ip nin lokasyon bilgisini almak için:
#curl ipinfo.io/88.x.x.x
sshpass -p ‘password’ ssh -o StrictHostKeyChecking=no [email protected] “bash -s” < ./disk_mem_cpu_load.sh
Belirli tarihten istenilen gün sayısı kadar sonrası: date -d '2016-10-31 + 26 days' +"%Y"-"%m"-"%d"
Daha fazla örnek:
To print the date of the day before yesterday.
$ date –date=’2 days ago’ To rename a file with the current date and time.
$ STAMPME=$HOME/sample_$(date +%Y%m%d-%H%M).txt $ mv $HOME/sample.txt $STAMPME To print the date of the day three months and one day hence.
$ date –date=’3 months 1 day’ To print the day of year of Christmas in the current year.
$ date –date=’25 Dec’ +%j To print the current full month name and the day of the month.
$ date ‘+%B %d’ To print a date without the leading zero for one-digit days of the month, you can use the (GNU extension) ‘-‘ modifier to suppress the padding altogether.
$ date -d=1may ‘+%B %-d’ To print the current date and time in the format required by many non-GNU versions of ‘date’ when setting the system clock.
$ date +%m%d%H%M%Y.%S To set the system date and time.
$ date –set=”2016-1-20 11:59 AM” To set the system clock forward by two minutes.
$ date –set=’+2 minutes’ To print the date in the format specified by RFC-822 (day month year hh:mm:ss zzz).
$ date –rfc To convert a date string to the number of seconds since the epoch 1970-01-01 00:00:00 GMT
$ date –date=’2000-01-01 00:00:01 UTC +5 hours’ +%s 946706400 To convert a date string to the number of seconds since the epoch 1970-01-01 00:00:00 local zone
$ date –date=’2000-01-01 00:00:01′ +%s 946684800 To convert a number of seconds back to a more readable date
$ date -d '1970-01-01 946684800 sec' +"%Y-%m-%d %T %z" 2000-01-01 00:00:00 +0000
let DIFF=(`date +%s -d 20170102`-`date +%s -d 20161031`)/86400 echo $DIFF
Dosyamız ismi file olsun ve içeriğinde;
5
7
8
olsun.
awk '{x+=$0}END{print x}' file
paste -s -d"+" file | bc
perl -lne '$x+=$_; END{print $x;}' file
sed -e :a -e 'N;s/\n/+/;ta' file | bc
echo $((`sed '$!s/$/+/' file | tr '\n' ' '`))
Sonuç : 20
VirtualBox/VMware Linux image larının olduğu güzel bir site:
http://www.osboxes.org/
Dış ip bulma komutu:
$ curl ifconfig.me $ curl ip.appspot.com $ curl icanhazip.com
Web sitesinin cevap verme süresi komutu:
$ curl -s -w ‘\nLookup time:\t%{time_namelookup}\nConnect time:\t%{time_connect}\nPreXfer time:\t%{time_pretransfer}\nStartXfer time:\t%{time_starttransfer}\n\nTotal time:\t%{time_total}\n’ -o /dev/null http://www.ozkantan.com
Lookup time: 0,061 Connect time: 0,304 PreXfer time: 0,304 StartXfer time: 1,636
Total time: 2,152
Ubuntu, Debian, Linux Mint v.b. $ sudo apt-get install figlet
CentOS, RHEL, Fedora v.b. $ yum install figlet
Önce hangi fontta yazacağınıza karar vermek için
$ showfigfonts
komutunu kullanın. Daha sonra beğendiğiniz font ile yazmaya başlayın.
# figlet -f digital ozkantan.com +-+-+-+-+-+-+-+-+-+-+-+-+ |o|z|k|a|n|t|a|n|.|c|o|m| +-+-+-+-+-+-+-+-+-+-+-+-+
$ date +%r | figlet -f bubble _ _ _ _ _ _ _ _ _ _ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ ( 0 | 1 | : | 5 | 1 | : | 4 | 9 ) ( A | M ) \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/
Linuxte disk performans testi için aşağıdaki komutu kullanabilirsiniz.
Öncelikle hangi diski test edeceğinizi
df -h çıktısıyla alabilirsiniz.
Daha sonra eğer sistemde yüklü değilse repodan hdparm yükleyiniz.
Örnek ubuntuda;
apt-get install hdparm
Sonra
$ sudo hdparm -Tt /dev/sda /dev/sda: Timing cached reads: 16924 MB in 2.00 seconds = 8469.95 MB/sec Timing buffered disk reads: 1386 MB in 3.00 seconds = 461.50 MB/sec