• Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Archives

format

Bash Reformat Numbers

February 27, 2022

How to reformat numbers in Bash.

$ n=1023555
$ m=$(numfmt --to=si n)
$ echo $m
1.1M

$ n=1023555 $ m=$(numfmt --to=si n) $ echo $m 1.1M

Other options

--to=none     # no scaling. Output: 1023555
--to=si       # International System of Units (SI) standard. Output 1.1M
--to=iec      # International Electrotechnical Commission (IEC) standard. Output: 1.1Mi 
--to=iec-i    # International Electrotechnical Commission (IEC) standard. Output: 1.1M
--to=auto     # ‘auto’ can only be used with --from.

--to=none # no scaling. Output: 1023555 --to=si # International System of Units (SI) standard. Output 1.1M --to=iec # International Electrotechnical Commission (IEC) standard. Output: 1.1Mi --to=iec-i # International Electrotechnical Commission (IEC) standard. Output: 1.1M --to=auto # ‘auto’ can only be used with --from.

fmtnum

Filed Under: Linux Tagged With: bash, convert, fmtnum, format, numbers

Linux Format USB Drive

July 9, 2020

Here’s how to format a USB drive on Linux.

Plug in the USB drive to see mount point.

# scan for all drives
df -Th
Filesystem     Type     Size  Used Avail Use% Mounted on
/dev/sdc1      fuseblk   30G   66M   30G   1% /media/ulysses/451B99AF225B48EC

# scan for all drives df -Th Filesystem Type Size Used Avail Use% Mounted on /dev/sdc1 fuseblk 30G 66M 30G 1% /media/ulysses/451B99AF225B48EC

Unmount USB drive.

umount /dev/sdc1

umount /dev/sdc1

Choose a file system type and run the appropriate format command.

# nfts format
mkfs.ntfs /dev/sdc1
# vfat format
mkfs.vfat /dev/sdc1
# ext4 format
mkfs.ext4 /dev/sdc1

# nfts format mkfs.ntfs /dev/sdc1 # vfat format mkfs.vfat /dev/sdc1 # ext4 format mkfs.ext4 /dev/sdc1

Filed Under: Linux Tagged With: 3.0, command line, format, mount, terminal, usb

Determine USB Format Type

January 21, 2020

Here’s how to determine what type of USB format a thumb drive is in Linux.

  • df -Th (shows the file system type)
  • lsblk (shows the block devices)
  • lsusb (show usb ports and devices)
  • fdisk -l (displays the USB format type)

To display, use “fdisk -l” to display either NTFS, FAT32 or exFAT32.

Filed Under: Linux Tagged With: df, fdisk, format, lsblk, lsusb, type, usb

Matrox Monarch USB Format

July 4, 2019

Format USB drives to NTFS. Use USB 0 for recording.

Filed Under: Misc Tagged With: encoder, format, hardware, live streaming, ntfs, usb

200MB USB Drive

November 19, 2018

I have a 8GB USB drive that displays only as 200MB. I have to run diskpart as an Administrator from my Windows 10 computer. I selected the disk, and then cleaned it. After that, go back to disk management, and then reformat the entire partition to FAT32. USB drive is now showing 7.9GB.

Here’s the fix.

Filed Under: Misc Tagged With: format, usb

  • Home
  • About
  • Archives

Copyright © 2023