30 Haziran 2019 Pazar

tune2fs komutu

-l seçeneği
Rezerve edilen blok yüzdesini görmek için şöyle yaparız.
tune2fs -l <device> 
-m seçeneği
Açıklaması şöyle
-m reserved-blocks-percentage
Set the percentage of the filesystem which may only be allocated by privileged processes. Reserving some number of filesystem blocks for use by privileged processes is done to avoid filesystem fragmentation, and to allow system daemons, such as syslogd(8), to continue to function correctly after non-privileged processes are prevented from writing to the filesystem. Normally, the default percentage of reserved blocks is 5%.
Örnek
Rezerve edilen blok yüzdesini 0 yapmak için şöyle yaparız.
tune2fs -m 0 /dev/sda1
Örnek
Rezerve edilen blok yüzdesini 0 yapmak için şöyleyaparız.
sudo tune2fs -m 1 /dev/nvme0n1p8

17 Haziran 2019 Pazartesi

bash kodlama echo built-in komutu

Giriş
Açıklaması şöyle. Bu komut yerine printf komutu tercih edilmeli. Çünkü echo komutu parametreler arasına bir boşluk yerleştiriyor ve en sona da bir \n ekliyor.
Display the ARGs, separated by a single space character and followed by a newline, on the standard output.
Bir başka açıklama şöyle
echo prints its arguments separated by spaces, even if they include (or generate) newline characters. Additionally it adds one newline character at the end of its output (unless it's echo -n).
...
When echo does something unexpected, always consider printf. After you get familiar with printf it may even become your first choice.
Bu built-in komut dışında bir de /bin/echo uygulaması var.
Örnek
Şöyle yaparız.
$ echo small*jpg
small1.jpg small2.jpg small photo 1.jpg small photo 2.jpg
-e seçeneği
Açıklaması şöyle. backslah ile escape edilmesi gereken karater varsa kullanılır.
enable interpretation of backslash escapes
Örnek
Şöyle yaparız
$ echo -e 'first\tsecond\tthird'
first   second  third
Örnek
Şöyle yaparız
echo -e "\n"{0..4..2}" "{0..2..2}
Çıktı olarak şunu alırız. En başta boş bir satır olur

0 0
0 2
2 0
2 2
4 0
4 2
Örnek
xxd kullanarak şöyle yaparız.
echo "00 FF AB" | xxd -r -p | program
echo kullanarak şöyle yaparız.
echo -e "\x41\x42\x43\x44" | program


16 Haziran 2019 Pazar

fallocate metodu

Giriş
İmzası şöyle.
int fallocate(int fd, int mode, off_t offset, off_t len);
Belirtilen konumdan itibaren dosyaya ekleme yapar.

13 Haziran 2019 Perşembe

lsmod komutu

Giriş
lshw, lsusb, lsblklspcilscpu gibi komutlarla kardeştir. Açıklaması şöyle.
To “terminate” a device driver, you’d have to stop all the processes using it, then remove its kernel modules (assuming it’s built as modules), and optionally any other modules it uses and which are no longer necessary. You can list the modules on your system using lsmod, and unload them using rmmod or modprobe -r, both of which will only work if lsmod indicates they have no users.
Linux'un yüklediği modülleri gösterir.

Örnek
Benim sisteminde şu komut ile 79 modül yüklü olduğunu görüyorum.
$ lsmod | wc
Örnek
Şöyle yaparız.
$ lsmod | grep uvcvideo
uvcvideo               90112  0
En sağdaki çıktı webcam'i kaç uygulamanın kullandığını gösterir. 

12 Haziran 2019 Çarşamba

dbus-send komutu

dbus Nedir
Açıklaması şöyle
dbus allows two-way communication between applications.
dbus benzeri şeyler Window'ta da vardır. Açıklaması şöyle
dbus provides a generic protocol, and a broker service where programs can ask to be connected to a program providing access control to specific functionality. If the targeted program is already running, the broker will just forward requests, if it isn't running already, the broker will start the program on demand if it knows how to do so.

The equivalent functionality on Windows is COM/DCOM in combination with the registry.
screen reader imlecin nerede olduğunu öğrenmek için dbus kullanır. Açıklaması şöyle
For example, blind computer users rely on screen readers, which can render information through synthetic speech or Braille (or both). Blind users rely on keyboard access to applications (e.g. using TAB to cycle through UI components and lots of shortcuts); a screen reader needs to know where the keyboard focus has landed and then query that UI component for its role (e.g. "button", "menu", "checkbox" etc.), name (i.e. its label, e.g. "OK", "Cancel"), and state and properties (e.g. "checked" and "unchecked" for checkboxes, "expanded" for expandable regions, "required" for required input fields, "disabled", etc.). A screen reader would also need to receive push notifications displayed in the application.
dbus'tan Önce
Örneğin socketler kullanılıyordu. Açıklaması şöyle.
The "traditional" way of Inter Process Communication (IPC) on UNIX and Linux systems directly uses sockets, e.g. process A opens /var/run/a.socket and process B reads/writes to it. This works rather fine for tightly-knit programs that were designed to communicate together.
Kullanım
Örnek
Şöyle yaparız.
dbus-send --type=method_call 
  --dest=org.gnome.ScreenSaver /org/gnome/ScreenSaver org.gnome.ScreenSaver.Lock

startx komutu

Giriş
Eğer DISPLAY yok hatası alıyorsak X11 başlamamış demektir.
$ firefox
Error: no DISPLAY environment variable specified
Örnek
Şöyle yaparız.
startx
firefox

10 Haziran 2019 Pazartesi

wget komutu

Giriş
Sayfayı kaydetmek için google-chrome komutu da kullanılabilir.

Logging and Input File Options
-q seçeneği
Sessiz yapar.
Örnek
Şöyle yaparız-O  - ile çıktı standart output'a yazdırılır.
wget -q -O - https://... | ...
Örnek
Şöyle yaparız-O  - ile çıktı standart output'a yazdırılır.
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | ...
--report-speed seçeneği
Şöyle yaparız
wget -O /dev/null --report-speed=bits http://aserv.example.net/~myuser/links/M77232917.txt
Download Options
-O seçeneği
İndirilen dosyayı belirtilen yere yazar.

-O - seçeneği
Standard output'a yazdırmak için şöyle yaparız
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
--user seçeneği
Şöyle yaparız. Daha sonra şifreyi gireriz.
wget --user=abc --ask-password https://a.b.c/foo.zip
Directory Options
-P seçeneği
Directory prefix anlamına gelir. Nereye indirileceğini belirtir. Şöyle yaparız.
wget -P ~/ https://github.com/user/repository/archive/master.zip
HTTP Options
Örnek ver

HTTPS Options
Örnek ver

FTP Options
Örnek ver

FTPS Options
Örnek ver

HTTP Options
Örnek ver

Recursive Retrieval Options
Örnek ver

Recursive Accept/Reject Options
Örnek ver


objcopy komutu

--redefine-sym seçeneği
main() metodu yerine kendi yazdığımız main1() metodunun başlangıç noktası olmasını sağlar.
Örnek
Şöyle yaparız.
gcc -c test.c
objcopy --redefine-sym main1=main test.o
gcc -o test test.o

9 Haziran 2019 Pazar

chsh komutu

Giriş
change shell anlamıa gelir.

Örnek
Şöyle yaparız.
>sudo chsh userid
Changing the login shell for userid
Enter the new value, or press ENTER for the default
        Login Shell [/xhbin/tcsh]: /bin/bash
-s seçeneği
Şöyle yaparız.
chsh -s /bin/zsh