31 Aralık 2015 Perşembe

Linux storage komutlari

Linux disk durumunu goruntuleme
               
                disk free komutu
                # df -h
    Filesystem      Size  Used Avail Use% Mounted on
    /dev/sda1        77G  5.4G   68G   8% /
    tmpfs           3.9G     0  3.9G   0% /dev/shm
    /dev/sda3       374G  6.6G  349G   2% /opt/inseptra
               
                disk usage
                komutu dosyanin yada dizinin diskteki kapladigi boyutu sorgular
                # du -sh test.sh
4.0K    test.sh
               
                ulasilabilir aygitlari gorutuleme
                # fdisk -l

Disk /dev/sda: 64.4 GB, 64424509440 bytes
255 heads, 63 sectors/track, 7832 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000e7669

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              64        7833    62401536   8e  Linux LVM

Disk /dev/mapper/vg_imc-lv_root: 52.3 GB, 52344913920 bytes
255 heads, 63 sectors/track, 6363 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

               
                    acilista sisteme baglanmis dosyalar hakkinda bilgi verir
                    /etc/fstab
# Created by anaconda on Wed Feb 25 17:18:17 2015
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/vg_imc-lv_root /                       ext4    defaults        1 1
UUID=d7d31050-7663-4ced-9409-27d7e0a68e66 /boot                   ext4    defaults        1 2
/dev/mapper/vg_imc-lv_home /home                   ext4    defaults        1 2
/dev/mapper/vg_imc-lv_swap swap                    swap    defaults        0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0



                    # mount
/dev/mapper/vg_imc-lv_root on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
/dev/sda1 on /boot type ext4 (rw)
/dev/mapper/vg_imc-lv_home on /home type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)

17 Kasım 2015 Salı

Ram tuketimi


sistemin bellek kullanımı cpu/ram tarafından ayrıntılı ve anlık olarak
    top
    htop  (yum install htop)
  
anlık ram kullanımı sorgulama

    free -m

sistemlerdeki bellek kullanımı ile istatistikler  
  
    cat /proc/meminfo

Ram modeli, Ram kullanımı detaylı sorgulama

     dmidecode –type memory
  
Swap kullanımı, Swap IN/OUT
Ram çok fazla kullanıldığında boşta ram kalmaz işletim sistemi verileri Ram den çekip diske atar yeniden kullanması gerektiğinde geri Ram e alır
 
     ipcs -m
memory den reserve isteyen programlar

1 Eylül 2015 Salı

sifresiz ssh baglantisi icin yapilmasi gerekenler


[ayse@A ~]$ ls .ssh

id_rsa  id_rsa.pub  known_hosts



[ayse@A ~]$ ssh-copy-id -i .ssh/id_rsa.pub ayse@192.168.0.44


ayse@192.168.0.44's password:
Now try logging into the machine, with "ssh 'ayse@192.168.0.44'", and check in:

  .ssh/authorized_keys

to make sure we haven't added extra keys that you weren't expecting.




[ayse@A ~]$ ssh ayse@192.168.0.44

Last login: Tue Sep  1 09:34:39 2015 from ....



ayse$ logout
Connection to 192.168.0.44 closed.



[ayse@A ~]$ vi .ssh/config



buraya:


host 44

hostaname 192.168.0.44

user ayse




yazarak kaydediyoruz


[

ayse@A ~]$ ssh 44

Bad owner or permissions on /home/ayse/.ssh/config


[ayse@A ~]$ chmod 600 .ssh/config


[ayse@A ~]$ ssh 44

6 Ağustos 2015 Perşembe

git commit


$git status





On branch master
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#    modified:   category-application.log
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)


$git add <filename>

$git commit -a -m "aciklama bilgisi"

master 0f8b9fe] application log updated
 1 files changed, 1 insertions(+), 1 deletions(-)


$git push origin master

Counting objects: 5, done.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 338 bytes, done.
Total 3 (delta 1), reused 0 (delta 0)

29 Temmuz 2015 Çarşamba

wireshark kurulumu ve symbol lookup error

CentOS 6.5 icin kurulum ;

root olunur

# yum install wireshark-gnome

# wireshark

hata ile karsilasilirsa ;

centos 6.5: wireshark: symbol lookup error: wireshark: undefined symbol: gtk_combo_box_text_new_with_entry

gibi

cozum:

#yum update gtk2

# rpm -qa | grep wireshark
wireshark-devel-1.8.10-8.el6_6.x86_64
wireshark-gnome-1.8.10-8.el6_6.x86_64
wireshark-1.8.10-8.el6_6.x86_64

23 Temmuz 2015 Perşembe

netcat command

To install netcat on a CentOS system (64bit), simply issue the following command: yum install nc.x86_64


#yum install nc.x86_64


Basic syntax of netcat :

usage: nc [-46bCDdhjklnrStUuvZz] [-I length] [-i interval] [-O length] [-P proxy_username] [-p source_port] [-q seconds] [-s source] [-T toskeyword] [-V rtable] [-w timeout] [-X proxy_protocol] [-x proxy_address[:port]] [destination] [port]

7 Temmuz 2015 Salı

eth1 interface'inde trafik kontrol islemi



 ~ vnstat -l -i eth1

Monitoring eth1...    (press CTRL-C to stop)

   rx:     8.32 Mbit/s  1430 p/s          tx:        0 kbit/s     0 p/s

26 Haziran 2015 Cuma

mysqldump ile veritabanı yedeği

Veritabanı yedeği;



mysqldump -u=[Kullanıcı adı] -p=Şifre  Veritabanı>[yedeklenmiş ismi].sql


komut satırından işlemler:

ayse veritabanındaki tabloları listeler

mysql -u userA -p$PASS ayse -e "show tables"


Aşağıdaki komut ayse veritanındaki test tablosunu export'unu alır.

(Data + schema export for specific table)
mysqldump -u userA -p$PASS ayse test > /tmp/`date "+%Y%m%d-"`ayse .test .sql

Kontrol işlemi:

ls -alt /tmp/20150630-ayse .test .sql





3 Mayıs 2015 Pazar

MySQL: yeni kullanıcı yaratma

mysql> GRANT ALL PRIVILEGES ON *.* TO 'kullaniciadi'@'%' IDENTIFIED BY 'sifre';
Query OK, 0 rows affected (0.04 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)


@'%' ifadesi herhangi bir ip adresinden bağlanılabileceğini ifade eder,
eğer sadece belirli bir ip adresine izin verilmek isteniyorsa % yerine ip adresi girilmelidir.

Linux: kullanıcı işlemleri


kullanıcı ekleme
  --- kullanıcı ekleme işlemi root user'ında iken yapılmalı

[root@Ayse ~]# useradd -m testuser

[root@Ayse ~]# ls /home/
lost+found  pythonuser  test  testuser

[root@Ayse ~]# id testuser
uid=504(testuser) gid=504(testuser) groups=504(testuser)



 kullanıcı şifre atama

 # passwd <testuser>


 herhangi bir kullanıcı belirtmeden passwd komutu çalıştırılırsa aktif olan kullanıcının şifresi değiştirilir


 mevcut kullanıcı bilgileri görüntüleme

 [root@Ayse ~]# cat /etc/passwd

 mevcut kullanıcı bilgileri düzenleme:

 # vipw


29 Nisan 2015 Çarşamba

Linux: whois command line

             whois searches Whois servers for the object on the command line.

       The  host  to  query  is  taken from a global configuration file, a configuration file specified on the command
       line, or selected directly on the command line.

[root@ayse~]# whois 1.1.1.1
[Querying whois.arin.net]
[Redirected to whois.apnic.net]
[Querying whois.apnic.net]
[whois.apnic.net]
% [whois.apnic.net]
% Whois data copyright terms    http://www.apnic.net/db/dbcopyright.html

% Information related to '1.1.1.0 - 1.1.1.255'
...


[root@ayse~]# whois wikipedia.org
...

Linux: perform Manual DNS Queries with dig tool


dig (domain information groper) is a flexible tool for interrogating DNS name servers. It performs DNS lookups and displays the answers that are returned from the name server(s) that were queried. Most DNS administrators use dig to troubleshoot DNS problems because of its flexibility, ease of use and clarity of output. Other lookup tools tend to have less functionality than dig.

[root@ayse ~]# dig +short NS trakya.edu.tr @8.8.8.8
tubimdc.trakya.edu.tr.
tubim.trakya.edu.tr.
[root@ayse ~]# dig +short A www.trakya.edu.tr @tubimdc.trakya.edu.tr
193.255.140.50
[root@ayse~]# dig +short MX trakya.edu.tr @tubimdc.trakya.edu.tr
0 mail.trakya.edu.tr.
[root@ayse~]# dig +short A mail.trakya.edu.tr @tubimdc.trakya.edu.tr
193.255.140.16
[root@ayse~]#