Wednesday, April 13, 2011

sorting files according to their names with number

To sort the files in a directory, such as

file_2.txt
file_12.txt
file_43.txt
file_1.txt

ls command will get you, this
file_1.txt
file_12.txt
file_2.txt
file_43.txt

if you want the sorted list to look like
file_1.txt
file_2.txt
file_12.txt
file_43.txt
according to the numeric order, then you need to sort command

ls *.txt | sort -t_ -k2 -n

-t specifies the separator
-k specifies the field id
-n indicates numeric sorting

Wednesday, April 6, 2011

Ubuntu: update-initramfs failed to pass e2fsck check

Error:
update-initramfs: Generating /boot/initrd.img-2.6.32-30-generic-pae
E: /etc/initramfs-tools/hooks/e2fsck failed with return 1.
update-initramfs: failed for /boot/initrd.img-2.6.32-30-generic-pae

Cause:
Missing configuration file for e2fsck in /etc/

Solution:
create a file in /etc/e2fsck.conf with the following content

[options]

RISC-v emulator

Changes are based on https://risc-v-getting-started-guide.readthedocs.io/en/latest/linux-qemu.html For Ubuntu/Debian, in addition to sud...