🖥️truncate

➡️This is a command-line reference manual for commands and command combinations that you don’t use often enough to remember it. This cheatsheet explains the truncate command with important options and switches using examples.

▁ ▂ ▃ ▄ ꧁ 🔴☠ COMMANDLINE-KUNGFU WITH CHEATSHEETS ☠🔴꧂▅ ▃ ▂ ▁

#    ████████╗██████╗ ██╗   ██╗███╗   ██╗ ██████╗ █████╗ ████████╗███████╗
#    ╚══██╔══╝██╔══██╗██║   ██║████╗  ██║██╔════╝██╔══██╗╚══██╔══╝██╔════╝
#       ██║   ██████╔╝██║   ██║██╔██╗ ██║██║     ███████║   ██║   █████╗  
#       ██║   ██╔══██╗██║   ██║██║╚██╗██║██║     ██╔══██║   ██║   ██╔══╝  
#       ██║   ██║  ██║╚██████╔╝██║ ╚████║╚██████╗██║  ██║   ██║   ███████╗
#       ╚═╝   ╚═╝  ╚═╝ ╚═════╝ ╚═╝  ╚═══╝ ╚═════╝╚═╝  ╚═╝   ╚═╝   ╚══════╝
                                                                                     
                                                                                     
                                                                                     
# To clear the contents from a file:
truncate -s 0 file.txt

# To truncate a file to 100 bytes:
truncate -s 100 file.txt

# To truncate a file to 100 KB:
truncate -s 100K file.txt

# (M, G, T, P, E, Z, and Y may be used in place of "K" as required.)

#==============================##==============================#
# CMD TRUNCATE						       #
#==============================##==============================#
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

  █║▌│║█║▌★ KALI ★ PARROT ★ DEBIAN 🔴 PENTESTING ★ HACKING ★ █║▌│║█║▌

              ██╗ ██╗ ██████╗  ██████╗ ██╗  ██╗███████╗██████╗
             ████████╗██╔══██╗██╔═══██╗╚██╗██╔╝██╔════╝██╔══██╗
             ╚██╔═██╔╝██║  ██║██║   ██║ ╚███╔╝ █████╗  ██║  ██║
             ████████╗██║  ██║██║   ██║ ██╔██╗ ██╔══╝  ██║  ██║
             ╚██╔═██╔╝██████╔╝╚██████╔╝██╔╝ ██╗███████╗██████╔╝
              ╚═╝ ╚═╝ ╚═════╝  ╚═════╝ ╚═╝  ╚═╝╚══════╝╚═════╝

               █║▌│║█║▌ WITH COMMANDLINE-KUNGFU POWER █║▌│║█║▌

░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░