Here is most offten used (by me) set of linux commands. That's just examples, so remember to adjust them to yours needs.
Zeroing disk
dd is very good tool for cloning, zeroing or fulfilling with random data disks. Using block size = 64KB increases performance.
1 2 3 4 5 |
sudo dd if=/dev/zero of=/dev/sdb bs=64K # Zeroing disk sdb sudo dd if=/dev/sda of=/dev/sdb bs=64K # Clonning disk sda to sdb sudo dd if=/dev/urandom of=/dev/sdb bs=64K # Fulfill disk sdb with pseudo-random data |
Fulfilling disk with random data
You can use dd, as shown above, or this:
1 2 3 |
openssl enc -aes-256-ctr -pass pass:"$(dd if=/dev/urandom bs=128 count=1 2>/dev/null | base64)" -nosalt </dev/zero> /dev/sdb |
Root password on live CD
1 2 3 |
sudo -i |
Display what make does
It does not compile. It only shows what commands make calls. It's usefull when you are trying to figure out why there are problems with compilation.
1 2 3 |
make -n |
Make iso file (CD image)
1 2 3 |
mkisofs -o image.iso path/to/folder |
Dump symbols from library
1 2 3 |
nm -D libsomelibrary.so > dump.txt |
List shared libraries used by executable
1 2 3 |
ldd path/to/executable |
List sblock devices
I used that when I was looking for cd-rom (/dev/sr0).
1 2 3 |
lsblk |
Searching for text in files.
1 2 3 |
grep -rnw '/path/to/somewhere/' -e 'pattern' |
Zip/UnZip
1 2 3 4 5 |
zip -9 file.zip file zip -9 -r file.zip folder unzip file.zip |
Copy file to remote machine
1 2 3 |
scp file user@somehost.com:/path/where/to/place/file |