24 Şubat 2017 Cuma
6 Şubat 2017 Pazartesi
svn komutu
up seçeneği
Kodun en son halini indirir.
Kodun en son halini indirir.
15 Ocak 2017 Pazar
AF_NETLINK Soketi
Giriş
Şu satırı dahil ederiz.
Şöyle yaparız.
Şöyle yaparız.
Şöyle yaparız.
Şu satırı dahil ederiz.
#include <sys/socket.h>
#include <linux/types.h>
#include <linux/netlink.h>
socket metoduŞöyle yaparız.
#define NETLINK_KOBJECT_UEVENT 15
int socket_fd = socket(AF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT);
bind metodu
Şöyle yaparız.
struct sockaddr_nl address;
memset(&address, 0, sizeof(address));
address.nl_family = AF_NETLINK;
address.nl_pid = atoi(argv[1]);
address.nl_groups = 0;
bind(socket_fd, (struct sockaddr *) &address, sizeof(address));
send metodu
Şöyle yaparız.
struct msghdr msg;
...
sendmsg(socket_fd, &msg, 0);
msghdr yapısını doldurmak için şöyle yaparız.struct msghdr msg;
struct iovec iovector;
msg.msg_name = (void*)&address;
msg.msg_namelen = sizeof(address);
msg.msg_iov = &iovector;
msg.msg_iovlen = 1;
char message[LONG_STRING];
char *mp;
mp = message;
mp += sprintf(mp, "%s@%s", event, sysfspath) +1;
mp += sprintf(mp, "ACTION=%s", event) +1;
mp += sprintf(mp, "DEVPATH=%s", sysfspath) +1;
mp += sprintf(mp, "MAJOR=%s", major) +1;
mp += sprintf(mp, "MINOR=%s", minor) +1;
mp += sprintf(mp, "SUBSYSTEM=%s", subsystem) +1;
mp += sprintf(mp, "LD_PRELOAD=/tmp/libno_ex.so.1.0") +1;
iovector.iov_base = (void*)message;
iovector.iov_len = (int)(mp-message);
7 Ocak 2017 Cumartesi
ip link komutu
Giriş
ip komutu ile birlikte birçok object kullanılabilir. Bunlar şöyle
link, addr, addrlabel, route, rule, neigh, tunnel, maddr, mroute, monitor.
Bu yazıda link anlatılıyor.
netns seçeneği
Şöyle yaparız.
ip komutu ile birlikte birçok object kullanılabilir. Bunlar şöyle
link, addr, addrlabel, route, rule, neigh, tunnel, maddr, mroute, monitor.
Bu yazıda link anlatılıyor.
Şöyle yaparız.
ip netns add blue
ip netns add red
ip netns exec red ip link set dev lo up
ip netns exec blue ip link set dev lo up
ip link add veth0 type veth peer name veth1
ip link set veth0 netns red
ip link set veth1 netns blue
ip netns exec red ip link set dev veth0 up
ip netns exec red ip addr add 192.168.168.0/32 dev veth0
ip netns exec red ip route add 192.168.168.0/24 dev veth0
ip netns exec blue ip link set dev veth1 up
ip netns exec blue ip addr add 192.168.168.255/32 dev veth1
ip netns exec blue ip route add 192.168.168.0/24 dev veth1
ip netns exec red ping 192.168.168.255
ip netns exec blue ping 192.168.168.0
3 Ocak 2017 Salı
ntpdate komutu - Kullanmayın
Giriş
Açıklaması şöyle.
2. Bu komut eğer ntpd çalışıyorsa hata verir.
Seçeneksiz Kullanımı
Sunucunun ismi verilir.
Komutun çıktısını ekran yerine sistem loguna gönderir. Şöyle yaparız.
-u seçeneği - unprivileged port
Açıklaması şöyle.
ntpdate - set the date and time via NTP
1.Bu komut artık "deprecated". Yerine ntpd kullanılmalı. ntpd yok ike insanlar cron ile ntpdate komutunu saat başı çalıştırarak sistem saatini eş zamanlı tutmaya çalışıyorlardı.2. Bu komut eğer ntpd çalışıyorsa hata verir.
Seçeneksiz Kullanımı
Sunucunun ismi verilir.
ntpdate TIME-SERVER
Şöyle yaparızntpdate ntp.ubuntu.com
-s seçeneğiKomutun çıktısını ekran yerine sistem loguna gönderir. Şöyle yaparız.
ntpdate -s time.nist.gov
Sunucu ile bağlantı kurmak için unprivileged bir port (1024'ün üstündeki sayılar) kullanarak saati günceller. Ntp havuzundaki sunucular için şöyle yaparız.
ntpdate -u pool.ntp.org
Kendi yerel sunucumuz için şöyle yaparız.
ntpdate -u 192.168.128.118
Sunucuya 3 defa sorguda bulunur. Komut çıktısında saat farkı "offset ..." olarak görülebilir.
offset 0.000000
2 Aralık 2016 Cuma
gpsmon
Şöyle yaparız
gpsmon /dev/ttyS0
gpsmon /dev/ttyS0
22 Kasım 2016 Salı
dpkg-query komutu
-f seçeneği
Açıklaması şöyle
Şöyle yaparız
Açıklaması şöyle
Açıklaması şöyle
...this tool is focused on querying the database of installed packages, and can output information in particular format(-f option plus -W action).Şöyle yaparız.
$ dpkg-query -W -f='PACK:${Package}\nARCH:${Architecture}\nSTAT:${Status}\n---\n' libc6
PACK:libc6
ARCH:amd64
STAT:install ok installed
---
PACK:libc6
ARCH:i386
STAT:install ok installed
---
-L seçeneğiŞöyle yaparız
dpkg-query -L dia-shapes
-S seçeneğiAçıklaması şöyle
-S, --search filename-search-pattern...
Search for packages that own files corresponding to the given
pattern. Standard shell wildcard characters can be used in the
pattern, where asterisk (*) and question mark (?) will match a
slash, and blackslash (\) will be used as an escape character.
If the first character in the filename-search-pattern is none of
‘*[?/’ then it will be considered a substring match and will be
implicitly surrounded by ‘*’ (as in *filename-search-pattern*).
If the subsequent string contains any of ‘*[?\’, then it will
handled like a glob pattern, otherwise any trailing ‘/’ or ‘/.’
will be removed and a literal path lookup will be performed.
This command will not list extra files created by maintainer
scripts, nor will it list alternatives.
Şöyle yaparızdpkg-query -S .shape
Kaydol:
Kayıtlar (Atom)