İleri Seviye Linux Komutları

Bu konuyu okuyanlar

darkstar

Müdavim
Katılım
21 Ağustos 2016
Mesajlar
1,638
Reaksiyon puanı
1,481
Puanları
113
Arkadaşlar çok detaya inmeden işinize yarayacağını düşündüğüm birkaç linux komutunu yazacağım. Amacım komutların tüm parametrelerini anlatmak değil bu komutları hiç kullanmamış bilmeyen arkadaşlara kısaca bilgi vermek; tamamen can sıkıntısından yazıyorum umarım işinize yarar.

1 - nslookup komutu :
Herhangi bir domainin ipsini manuel olarak sorgulamanıza yarar.
Kod:
bash-4.3# nslookup -type=any shiftdelete.net

Server:         4.2.2.4
Address:        4.2.2.4#53

Non-authoritative answer:
Name:   shiftdelete.net
Address: 94.101.80.102
2- last komutu :
Sisteme spesifik bir kullanıcının ne zaman hangi iplerden login olduğunu görüntülemenizi sağlar.
Kod:
root@darkstar:~# last root

root     pts/1        95.10.xx.xxx     Fri Nov  3 21:44   still logged in
wtmp begins Fri Nov  3 21:44:26 2017
3- lastlog komutu :
Tüm kullanıcıların sisteme en son hangi ipden ve ne zaman login olduğunu görüntülemenizi sağlar.
Kod:
root@darkstar:~# lastlog                    
Username         Port     From             Latest             
root             pts/1    95.10.xx.xxx    Fri Nov  3 21:44:26 +0000 2017
daemon                                     **Never logged in**
bin                                        **Never logged in**
sys                                        **Never logged in**
sync                                       **Never logged in**
games                                      **Never logged in**
man                                        **Never logged in**
lp                                         **Never logged in**
mail                                       **Never logged in**
news                                       **Never logged in**
uucp                                       **Never logged in**
proxy                                      **Never logged in**
www-data                                   **Never logged in**
backup                                     **Never logged in**
list                                       **Never logged in**
irc                                        **Never logged in**
gnats                                      **Never logged in**
nobody                                     **Never logged in**
_apt                                       **Never logged in**
systemd-timesync                           **Never logged in**
systemd-network                            **Never logged in**
systemd-resolve                            **Never logged in**
systemd-bus-proxy                           **Never logged in**
Debian-exim                                **Never logged in**
uuidd                                      **Never logged in**
ntp                                        **Never logged in**
messagebus                                 **Never logged in**
sshd                                       **Never logged in**
4- netstat komutu :
Sisteminizin ağ istatistiklerini açık portları vs görüntüleyebileceğiniz komuttur, çok kullanışlıdır.
Kod:
root@darkstar:~# netstat -lp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name  
tcp        0      0 0.0.0.0:11022           0.0.0.0:*               LISTEN      2694/sshd        
tcp        0      0 0.0.0.0:55972           0.0.0.0:*               LISTEN      2397/rtorrent    
tcp        0      0 localhost:5000          0.0.0.0:*               LISTEN      2397/rtorrent    
tcp6       0      0 [::]:11022              [::]:*                  LISTEN      2694/sshd        
tcp6       0      0 [::]:https              [::]:*                  LISTEN      10693/apache2    
tcp6       0      0 [::]:11080              [::]:*                  LISTEN      10693/apache2    
Active UNIX domain sockets (only servers)
Proto RefCnt Flags       Type       State         I-Node   PID/Program name     Path
unix  2      [ ACC ]     STREAM     LISTENING     3314951  21272/systemd        /run/user/0/systemd/private
unix  2      [ ACC ]     STREAM     LISTENING     6152     1/init               /var/run/dbus/system_bus_socket
unix  2      [ ACC ]     STREAM     LISTENING     6155     1/init               /run/uuidd/request
unix  2      [ ACC ]     STREAM     LISTENING     3314956  21272/systemd        /run/user/0/gnupg/S.dirmngr
unix  2      [ ACC ]     STREAM     LISTENING     3314959  21272/systemd        /run/user/0/gnupg/S.gpg-agent.ssh
unix  2      [ ACC ]     STREAM     LISTENING     3314961  21272/systemd        /run/user/0/gnupg/S.gpg-agent.extra
unix  2      [ ACC ]     STREAM     LISTENING     3314963  21272/systemd        /run/user/0/gnupg/S.gpg-agent.browser
unix  2      [ ACC ]     STREAM     LISTENING     3314965  21272/systemd        /run/user/0/gnupg/S.gpg-agent
unix  2      [ ACC ]     STREAM     LISTENING     2900     1/init               /run/systemd/private
unix  2      [ ACC ]     STREAM     LISTENING     2929     1/init               /run/systemd/journal/stdout
5- ifconfig komutu :
Ağ yapılandırmanızı görüntülemenize ve değiştirmenize yarayan komuttur. Aynı zamanda networkünüzü durdurup çalıştırmanıza da yarar.
Kod:
root@darkstar:~# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.1.43.xx  netmask 255.255.254.0  broadcast 10.1.43.255
        inet6 fe80::207:cbff:fe03:7e9c  prefixlen 64  scopeid 0x20<link>
        ether 00:07:cb:03:7e:9c  txqueuelen 532  (Ethernet)
        RX packets 1306900071  bytes 1356785292260 (1.2 TiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 586073724  bytes 1330549206581 (1.2 TiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 25
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 330010  bytes 124081411 (118.3 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 330010  bytes 124081411 (118.3 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

örnek: ifconfig eth0 down , ifconfig eth0 up, ifconfig eth0 192.168.1.12 , ifconfig eth0 netmask 255.255.255. vs
6- lsof komutu :
Sistemde açık olan dosyaları görüntüleyen komuttur.
Kod:
root@darkstar:~# lsof|more
COMMAND     PID  TID       USER   FD      TYPE     DEVICE SIZE/OFF       NODE NAME
systemd       1            root  cwd       DIR       43,0     4096          2 /
systemd       1            root  rtd       DIR       43,0     4096          2 /
systemd       1            root  txt       REG       43,0   751888    1574294 /lib/systemd/systemd
systemd       1            root  mem       REG       43,0    14052    1573005 /lib/arm-linux-gnueabihf/libuuid.so.1.3.0
systemd       1            root  mem       REG       43,0    13884    1573121 /lib/arm-linux-gnueabihf/libattr.so.1.1.0
systemd       1            root  mem       REG       43,0    50672    1573077 /lib/arm-linux-gnueabihf/libgpg-error.so.0.21.0
systemd       1            root  mem       REG       43,0   174988    1572939 /lib/arm-linux-gnueabihf/libblkid.so.1.1.0
systemd       1            root  mem       REG       43,0    13896    1572967 /lib/arm-linux-gnueabihf/libcap-ng.so.0.0.0
systemd       1            root  mem       REG       43,0     9804    1572988 /lib/arm-linux-gnueabihf/libdl-2.24.so
systemd       1            root  mem       REG       43,0   320860    1573002 /lib/arm-linux-gnueabihf/libpcre.so.3.13.3
systemd       1            root  mem       REG       43,0   193960    1573114 /lib/arm-linux-gnueabihf/libidn.so.11.6.16
systemd       1            root  mem       REG       43,0    22220    1572942 /lib/arm-linux-gnueabihf/libacl.so.1.1.0
systemd       1            root  DEL       REG       43,0             1573370 /lib/arm-linux-gnueabihf/libgcrypt.so.20.1.6
systemd       1            root  mem       REG       43,0    46616     920770 /usr/lib/arm-linux-gnueabihf/liblz4.so.1.7.1
systemd       1            root  mem       REG       43,0   104260    1572938 /lib/arm-linux-gnueabihf/liblzma.so.5.2.2
systemd       1            root  mem       REG       43,0    13824    1573081 /lib/arm-linux-gnueabihf/libcap.so.2.25
systemd       1            root  mem       REG       43,0   902996    1573090 /lib/arm-linux-gnueabihf/libc-2.24.so
systemd       1            root  mem       REG       43,0   106972    1573096 /lib/arm-linux-gnueabihf/libpthread-2.24.so
systemd       1            root  mem       REG       43,0   100044    1573011 /lib/arm-linux-gnueabihf/libgcc_s.so.1
.........
7- more komutu :
more komutu çalıştırdığınız herhangi bir komutun çıktısını sayfa sayfa ekrana getiren komuttur tek başına kullanılmaz genelde grep komutu gibi başka komutlarla birlikte kullanılır.
Kod:
üstteki örneğe bakabilirsiniz, less komutu da bunun zıddıdır.
8- grep komutu :
Çalıştırdığınız herhangi bir komutun çıktısında istediğiniz ifadeyi içeren satırları ekrana getirir.
Kod:
root@darkstar:~# cat /var/log/auth.log.1 | grep ssh
Oct 27 17:51:14 darkstar sshd[25536]: Accepted publickey for root from 95.10.xx.xxx
Oct 27 17:51:14 darkstar sshd[25536]: Accepted publickey for root from 95.10.xx.xxx
Oct 27 17:51:14 darkstar sshd[25536]: pam_unix(sshd:session): session opened for user root by (uid=0)
Oct 27 17:51:14 darkstar sshd[25536]: pam_unix(sshd:session): session opened for user root by (uid=0)
Oct 27 18:00:29 darkstar sshd[25536]: pam_unix(sshd:session): session closed for user root
Oct 27 18:00:29 darkstar sshd[25536]: pam_unix(sshd:session): session closed for user root
Oct 27 18:00:33 darkstar sshd[28162]: Accepted publickey for root from 95.10.xx.xxx
Oct 27 18:00:33 darkstar sshd[28162]: Accepted publickey for root from 95.10.xx.xxx
Oct 27 18:00:33 darkstar sshd[28162]: pam_unix(sshd:session): session opened for user root by (uid=0)
Oct 27 18:00:33 darkstar sshd[28162]: pam_unix(sshd:session): session opened for user root by (uid=0)
Oct 27 18:00:42 darkstar sshd[28162]: Received disconnect from 95.10.xx.xxx port 18208:11: disconnected by user
Oct 27 18:00:42 darkstar sshd[28162]: Received disconnect from 95.10.xx.xxx port 18208:11: disconnected by user
Oct 27 18:00:42 darkstar sshd[28162]: Disconnected from 95.10.xx.xxx port 18208
Oct 27 18:00:42 darkstar sshd[28162]: Disconnected from 95.10.xx.xxx port 18208
Oct 27 18:00:42 darkstar sshd[28162]: pam_unix(sshd:session): session closed for user root
Oct 27 18:00:42 darkstar sshd[28162]: pam_unix(sshd:session): session closed for user root
9- route komutu :
Sisteminizdeki ağ yönlendirmelerini gateway(leri) görüntülemeye veya değiştirmeye yarayan komuttur.
Kod:
root@darkstar:~# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         gateway         0.0.0.0         UG    0      0        0 eth0
10.1.42.0       0.0.0.0         255.255.254.0   U     0      0        0 eth0
10- watch komutu :
Gireceğiniz komutların belirlediğiniz sürede düzenli olarak çalıştırılmasını ve terminalde tam ekran olarak çıktısının verilmesini sağlar.
Kod:
root@darkstar:~# watch -n 10 'ls -la ; echo ; vmstat ; echo ; df'
Every 10.0s: ls -la ; echo ; vmstat ; echo ; df                       darkstar: Fri Nov  3 22:33:54 2017

total 60
drwx------  8 root root 4096 Aug  5 15:54 .
drwxr-xr-x 21 root root 4096 Jun 29 10:32 ..
-rw-------  1 root root 3845 Oct 27 18:00 .bash_history
-rw-r--r--  1 root root  570 Jan 31  2010 .bashrc
drwx------  3 root root 4096 Aug  5 13:41 .cache
drwx------  4 root root 4096 Aug  5 15:29 .config
drwx------  3 root root 4096 Aug  5 13:41 .local
lrwxrwxrwx  1 root root    8 Aug  5 13:51 log -> /var/log
drwxr-xr-x  2 root root 4096 Aug  5 14:35 .nano
-rw-r--r--  1 root root  148 Aug 17  2015 .profile
-rwx------  1 root root   13 Aug  5 13:30 .pw
-rw-------  1 root root 1024 Aug  5 14:36 .rnd
-rw-r--r--  1 root root 1240 Jun 29 10:15 .s3cfg.sample
-rw-r--r--  1 root root   72 Aug  5 13:41 .selected_editor
drwx------  2 root root 4096 Aug  5 13:30 .ssh
drwxr-xr-x  3 root root 4096 Aug  5 15:03 .subversion

procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 0  0      0 1486080 156476 371396    0    0     1     1    0    1  0  1 99  0  0

Filesystem     1K-blocks    Used Available Use% Mounted on
none             1033276       0   1033276   0% /dev
tmpfs             207104   28288    178816  14% /run
/dev/nbd0       47929956 1517244  43954924   4% /
tmpfs            1035504       0   1035504   0% /dev/shm
tmpfs               5120       0      5120   0% /run/lock
tmpfs            1035504       0   1035504   0% /sys/fs/cgroup
tmpfs             207100       0    207100   0% /run/user/0
11- nc komutu :
Ağ ile ilgili hemen hemen herşeyi yapabileceğiniz bir komuttur.
Kod:
root@darkstar:~# nc -l 12345

root@darkstar:~# netstat -lp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name  
tcp        0      0 0.0.0.0:12345           0.0.0.0:*               LISTEN      22636/nc          
.....
12-whois komutu :
Herhangi bir domain ile ilgili bilgi almak istediğinizde kullanabileceğiniz bir komuttur.
Kod:
root@darkstar:~# whois shiftdelete.net
   Domain Name: SHIFTDELETE.NET
   Registry Domain ID: 156499311_DOMAIN_NET-VRSN
   Registrar WHOIS Server: whois.reg2c.com
   Registrar URL: http://www.reg2c.com
   Updated Date: 2016-11-09T19:20:04Z
   Creation Date: 2005-05-11T20:48:50Z
   Registry Expiry Date: 2022-05-11T20:48:50Z
   Registrar: REG2C.COM, INC.
   Registrar IANA ID: 819
   Registrar Abuse Contact Email: [email protected]
   Registrar Abuse Contact Phone: 0902242248640
   Domain Status: clientTransferProhibited https://icann.org/epp#clientTransferProhibited
   Name Server: DARWIN.NS.CLOUDFLARE.COM
   Name Server: MARGE.NS.CLOUDFLARE.COM
   DNSSEC: unsigned
   URL of the ICANN Whois Inaccuracy Complaint Form: https://www.icann.org/wicf/
>>> Last update of whois database: 2017-11-03T23:11:01Z <<<
.....................

bu komutlara ilave olarak ps, w, kill, wget, nano, mc, htop, iftop programları da oldukça kullanışlıdır.
 

EFI Shell

shellx64.efi
Katılım
9 Ağustos 2018
Mesajlar
19,209
Çözümler
33
Reaksiyon puanı
18,895
Puanları
113
Yaş
18
Yararlı paylaşımınız için teşekkür ederiz. :)
 
Üst