Commands I forget (last update: 2020-06-16, created: 2012-10-03) back to the list ↑
|
|||
Some console commands (Bash, cmd.exe, Linux-specific, Windows-specific, etc) I use infrequently, but still I need them from time to time, and I waste time to look them up. This note may grow over time.
Linux mount partition from imageStep 1. Find the partition offset (in sectors):> fdisk ./hdd.img Step 2. Mount the partition (example for partition 2): >sudo mount -o loop,offset=$[512 * 206848] ./hdd.img /some/path Other ways to do it: 1. Extract the partition using dd. 2. Use losetup and a normal mount later. 3. Use partprobe or partx on /dev/loopN to map partition devices - /dev/loopNpM (thx licho). VirtualBox raw disk imageVirtualBox is unable to directly use raw disk images (as far as I know), but has a built-in raw-to-vdi converter:vboxmanage convertfromraw disk.raw disk.vdi It can also convert to other formats, like vmdk or vhd (--format vdi|vmdk|vhd) and has some other variant options (the default variant is "Standard" which is not raw+header, but a kind of sparse format afair). And the other way around: vboxmanage internalcommands converttoraw disk.vdi disk.raw VirtualBox real USB device used in VM/guestNote: The VM/guest system can be running. I've tested this with Windows host and Linux guest.1. [optional] On host, in case you don't won't to mount USB disk on host "by accident"*: run mountvol /N as admin to disable automatic volume mounting. 2. Plug in the device and run vboxmanage list usbhost. It should display a list of USB devices like this: Host USB Devices: 3. Find your device, note e.g. VendorId and ProductId. 4. Unplug your device. 5. Add a filter using the following command: vboxmanage usbfilter add 0 --target NameOfYourVM --name pendrive --productid 0252 --vendorid 0346 6. [optional] Run: mountvol /E as admin. 7. Plug in the device again. It should get detected by the VM. * Windows FS drivers will "attach" to the volume anyway, you just won't get a letter assigned for it (it won't get mounted). This normally doesn't matter, unless you have a FS exploit on your pendrive that gets triggered on mount/unmount (yes, it did BSoD my host, grr). Removing lots and lots of files on GNU/LinuxWell, rm * just won't do. Use find:find . -name 'somenamemask*' -type f -print -delete Deny execute in a directory on WindowsIO - Inherit Only (i.e. this does not apply to the container itself, only to it's children)OI - Objects Inherit (i.e. this works on files, not on directories; this can be combined with CI which is Container Inherit) X - eXecute obviously icacls download /deny everyone:(IO)(OI)(X) That annoying "Address already in use" errorIf you're able to modify the application:server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) System-wide disable (a little heavy handed, since this protection is there for a reason, but sometimes worth it): echo 1 > /proc/sys/net/ipv4/tcp_tw_reuse See also the official documentation. Chrome's "always show full URL"chrome://flags/#omnibox-context-menu-show-full-urlsThen restart, right-click on the URL bar and select "Always show full URLs". | |||
|