when someone accidentally did

cd /

mv * /mnt/

Thus, suppose you have an empty root, and normal unix filesystem layout in /mnt

You can’t do chroot. You even cannot run /mnt/bin/cp, to copy it all back to filesystem root.

it is however still possible to recover system without rebooting machine and booting from livcd/liveusb

first, export new library path:

LD_LIBRARY_PATH=/mnt/lib:/mnt/lib64:/mnt/usr/lib:/mnt/usr/lib64:$LD_LIBRARY_PATH

then, run cp with ld-linux loader like this:

/mnt/lib64/ld-linux-x86-64.so.2 /mnt/bin/cp -a /mnt/lib64 /

#unix #chroot #os #system #path #bash #fs

բնօրինակ սփիւռքում(եւ մեկնաբանութիւննե՞ր)

unix  chroot  os  system  path  bash  fs 

yesterday i have tested and sent this piece of code to one girl, it calculates only the size of directories, the sum to be precise.

find -type d -ls | awk 'BEGIN {a=0}{a+=$7}END{print a}'

and she said she did not receive the email, so i have checked and apparently i sent it to other girl because of the thunderbird autocomplete.

then i replied to the other girls email - no offence. #bash #scripting #awk

բնօրինակ սփիւռքում(եւ մեկնաբանութիւննե՞ր)