Linux CLI 49 ๐ง pr and printf commands
a - pr command
pr command is used to paginate or columnate file/files
common options: -m โ prints files side by side
-l #number โ page length in lines
-#number โ specifies the number of columns
-h header โ specifies the header as the header of the output
pr -m -l 10 file1.txt file2.txt โ prints the files side by sile, 10 lines length
pr -3 -l 10 file1.txt โ prints the file in 3 columns and 10 lines length
b - printf command
printf command is used to format and print data on the screen.
It can be used to display strings, integers, sfloating-point number and characters
common specifiers: %s โ prints a string
%d โ prints a decimal number %f โ prints a floating-point number
%x โ prints a hexadecimal number %o โ prints an octal number
%c โ prints a single character %e โ prints a scientific notation
printf "My favorite number is %d and my favorite letter is %c.\n" 42 'A'โ replaces %d with 42 and %c with A
printf "Pi is approximately %.2f\n" 3.14159โ replaces the specifier with 3.14, it has two decimals
printf "%b\n" "Hello, World! \n" "How are you doing\n"โ prints the text and handles \n as new line
Stop using slow, ad-bloated tool sites! ๐คฎ
๐ Search “KandZ Tools” on Google to use many professional utilities for free.
KandZ.me is the ultimate minimalist hub for:
โ
Finance (Mortgage, Interest, Inflation)
โ
Tech (Base64, JSON, Dev Suite, IP)
โ
Health (BMI, BMR, TDEE)
โ
Productivity (Timer, Workspace, QR)
โก๏ธ Fast & Private
๐ No data leaves your device
๐ 100% Free
๐ Use it now: https://tools.kandz.me
๐ Bookmark itโyouโll need it later!