Strings command substitute

Strings command substitute

I was looking for basic available tools an option to replace strings which is mostly not pre-installed or shipped with the OS like coreutils package in which tr is the good option to print the printable character and remove junk character but mostly it is prefer to use strings where it extracts printable characters and where tr replace the non-printable character into space as shown in below example.

~ $  head  -1  /dev/urandom  |  tr -c  '[:graph:]\n'   '  ' 
5  lD K  c] k @ 2  {   ]
~ $        

Though some suggest using strings instead of tr to get printable characters but in case if additional package is not allowed to install meanwhile tr can be handy.

To view or add a comment, sign in

More articles by Sanju Debnath

  • File management in Linux CLi
  • Whitespace for alignment

    Whitespace in simply means the spaces, tabs, and newlines you use when writing commands or scripts even though it looks…

  • bash in-built eval command

    Normally, when you tell `bash` something, it reads your instruction one time and does exactly what it understands from…

  • Whitespaces difference in between sed and awk output.

    The difference between sed and awk in terms of whitespaces during output sed just remove the declared characters and…

  • Color your terminal

    Run following commands in Linux terminal to make your black & white screen colourful. To keep script at your machine…

  • crontab

    The crontab, a very useful and most important tool to use it for repetitive jobs. It has most customizable schedule…

  • Pluggable Authentication Modules (PAM)

    PAM is a system for authenticating users in Linux and other Unix-like operating systems. PAM allows for the flexible…

  • Bash scripting - while conditional loop

    while conditional loop - A loop; repeatedly executes a block of code as long as a condition is true, in other words it…

  • Script to rename predictable network devices into classic network devices

    In a curiosity to make a script to have classic network interface name created this script rpni.sh this script is not…

  • Generate random number to a specific length

    There are many ways to generate random number in command line, for now I have found this Where head will read starting…

    4 Comments

Explore content categories