Giriş
Bu dizin ile de sistem hafıza kullanımı bilgisine erişmek mümkün.
Bu dizin ile de sistem hafıza kullanımı bilgisine erişmek mümkün.
apt gibi internetten paket indiremez, sadece diskteki dosyaları kurabilir.dpkg can also be used as a front-end to dpkg-deb(1) and dpkg-query(1). The list of supported actions can be found later on in the ACTIONS section. If any such action is encountered dpkg just runs dpkg-deb or dpkg-query with the parameters given to it, but no specific options are currently passed to them, to use any such option the back-ends need to be called directly.
apt is for managing remote repositories, dpkg - for locally installed packages. They're related. apt is front end to dpkg. When you run apt-get install package it gets .deb file, and installs it via dpkg.
/var/lib/dpkg//var/lib/dpkg/lock-frontenddpkg: error: dpkg frontend lock is locked by another processsudo lsof /var/lib/dpkg/lock-frontend/var/log/dpkg.log
--get-selections seçeneğidpkg --get-selections > my_package_list.txt
-i seçeneğidpkg -i linux-firmware_1.161_all.deb
-l seçeneğidpkg -l shows your installed package versions (starting with ii), removed ones (rc), and some others (e.g. installed but not configured, see the manpage).Örnek
$ dpkg -l terminator
dpkg-query: no packages found matching terminator
Örnek$ dpkg -l gedit
||/ Name Version ...
+++-==========================================
ii gedit 3.22.0-1 ...
-L seçeneğidpkg -L elixir
Çıktı olarak şunu alırız./.
/usr
/usr/bin
/usr/lib
/usr/lib/elixir
/usr/lib/elixir/bin
/usr/lib/elixir/bin/elixir
/usr/lib/elixir/bin/elixirc
/usr/lib/elixir/bin/iex
/usr/lib/elixir/bin/mix
/usr/lib/elixir/lib
/usr/lib/elixir/lib/eex
/usr/lib/elixir/lib/eex/ebin
/usr/lib/elixir/lib/eex/ebin/Elixir.EEx.Compiler.beam
(etc...)
-S seçeneğidpkg -S /usr/bin/gdb
veya şöyle yaparız.dpkg -S $(which gdb)
... so Linux uses pre-emptive scheduling. In this scheme, each process is allowed to run for a small amount of time, 200ms, and, when this time has expired another process is selected to run and the original process is made to wait for a little while until it can run again. This small amount of time is known as a time-slice.Pre-emptive Scheduling İçin CPU Interrupt Kullanılır
All practical approaches to preemption will use some sort of CPU interrupt to jump back into privileged mode, i.e. the linux kernel scheduler.Sistem Çağrısı Olunca
If you look at your /proc/interrupts you'll find the interrupts used in the system, including timers.
I understand that processes jump to syscalls and those jump back to the scheduler, so it makes sense how processes can be “swapped” in that regardsBir başka açıklama şöyle.
Also, when a program issues a system call (Usually by a software interrupt - "trap"), the kernel is also able to preempt the calling program, this is especially evident with system calls waiting for data from other processes.
the Completely Fair Scheduler (CFS). Integrated into Linux 2.6.23., CFS performs the following duties:CFS bu işleri gerçekleştirmek için arka tarafta bir tane "Red Black Tree" kullanır. Açıklaması şöyle
- CFS ensures that the CPU is allocated equitably.
- If the CPU access time provided to different tasks isn’t balanced, CFS gives the shortchanged tasks the time they need to execute.
- CFS keeps track of the balance between tasks by maintaining CPU access times in the virtual runtime. The smaller a task’s virtual runtime, the greater its recognized CPU need.
- CFS uses “sleeper fairness” to make sure even tasks that aren’t currently running will still receive their fair share of CPU when required.
-CFS doesn’t directly use priorities.
CFS uses nanosecond granularity accounting and does not rely on any jiffies or other HZ detail. Thus the CFS scheduler has no notion of “timeslices” in the way the previous scheduler had, and has no heuristics whatsoever.
$ cp first.html second.html
$ cat second.html
first
-a seçeneğiSembolik linkeri de takip eder.-a Same as -pPR options. Preserves structure and attributes of files but not directory structure.
cp -a src_dir another_destination/
cp -a /media/external/disk1/. /media/external/disk2/--no-clobber do not overwrite an existing fileNasıl çalıştığının açıklaması şöyle. Eğer cp komutu dosyayı yok olarak tespit etse, ve bir sonraki aşamada başka bir uygulama dosyayı yaratsa bir doğru çalışır. Çünkü dosyayı overwrite edecek bayraklar ile açmadğı için hata alır ve dosyayı ezmez.
When --no-clobber is set, it checks whether the destination already exists; if it determines it doesn’t, and it should therefore proceed with the copy, it remembers that it’s supposed to copy to a new file. When the time comes to open the destination file, it opens it with flags which enforce its creation, O_CREAT and O_EXCL; the operating system then checks that the file doesn’t exist while opening it, and fails (EEXIST) if it does.-p seçeneği
-p same as --preserve=mode,ownership,timestamps
--preserve[=ATTR_LIST]
preserve the specified attributes (default: mode,ownership,time‐
stamps), if possible additional attributes: context, links,
xattr, all
Örnekcp --preserve oldfile newfile
Şöyle yaparız.cp -p oldfile newfile
Örnekcp --preserve=timestamps oldfile newfile
cp -r ~/Documents/* ~/copies # works as expected
cp -r ~/Documents/*.odt ~/copies # does not work as expectedshopt -s globstar
cp -nt ~/copies/ ~/Documents/**/*.odtfind ~/Documents -name '*.odt' -exec cp -nt ~/copies/ {} +cp -r srcdir/!(subdir) dstdir
cp -t ~/me/dir1 dir1/linkdir6/file1
sd/common.py -> actual_filecp /tmp/Star_Wrangler/common.py sd/common.pyThis depends on what Unix you are using.On some BSD systems (OpenBSD, FreeBSD), you will find that cp -f will unlink (remove) the symbolic link and replace it with the source.Using GNU cp, this would not have the same effect, and you would need to use the long option --remove-destination instead.On macOS, use cp -c to, as the manual says, "copy files using clonefile(2)".On NetBSD, use cp -a ("archive mode", the same as cp -RpP on that system). This doesn't work on GNU, macOS, OpenBSD, or FreeBSD, even though all of these systems have the same or similar -a option for cp (on GNU systems, it's the same as -dR --preserve).You already mention this yourself: Removing the link before copying the file will solve the issue. The rm utility removes the link rather than the file referenced by the link. This is also the most portable way to replace a symbolic link with a regular file.
$ cp --sparse=always junk junk.sparse && mv junk.sparse junk
-v seçeneğicp -v ~/Downloads/*.pdf ~/Downloads/BOOKS/
-x seçeneği - GNU ExtensionThe -x flag to cp is a GNU extension. When copying a single file, this option will have no effect, but when copying a whole file hierarchy, the -x option prevents the copying of files and directories that does not live on the same filesystem as the original source.Örnek
For example, on a filesystem with mount points at /usr and /usr/local, using cp -xR /usr /some-dest would not copy the hierarchy under /usr/local.
There are other utilities with an -x option with similar semantics, such as du and find (the flag is called -xdev for find), and rsync
cp -xr / blah
if shopt -s direxpand 2>/dev/null; then
… # the direxpand option exists
else
… # the direxpand option does not exist
fi
2. extglobExtended globs like +(...) aren't enabled in Bash by default, you'll need to explicitly use shopt -s extglob in the script to enable them.
$ s='1 2, 3 4,' $ s0="$(echo ${s//,/ }|tr -s ' ')" $ echo "s0: $s0" s0: 1 2 3 4 $ d="'${s0//+([[:space:]])/"' '"}'" $ echo "d: $d" d: '1' '2' '3' '4'
The expression *([0-9]).conf is a KSH-style extended glob. The feature is enabled by default for interactive bash shells, but to use it in a bash script it must be enabled explicitly using shopt -s extglob
ls /etc/pve/lxc/*([0-9]).conf#!/bin/bash
ls /etc/pve/lxc/*([0-9]).conf
Çıktı olarak
Result: ERROR
syntax error near unexpected token `('$ touch file.txt file.text
$ ls file.*
file.text file.txt
$ ls file.te?xt
ls: cannot access 'file.te?xt': No such file or directory
Açıklaması şöyle.The ? matches a single character (like . in a regular expression). You have no file matching the pattern file.te?xt so the pattern remains unexpanded.Şöyle yaparız
You may have expected it to work as in a regular expression, where it means "zero or one of the previous expression". Unfortunately, there is no such wildcard in bash.
$ shopt -s extglob
$ ls file.t?(e)xt
file.text file.txt
3. histverify
If the histverify shell option is enabled, and Readline is being used, history substitutions are not immediately passed to the shell parser. Instead, the expanded line is reloaded into the Readline editing buffer for further modification.