Common · Let commands collaborate
printf: Output text according to format
Syntax
printf format [value…]Options
%s- string
%d- number
%%- percent sign
\n- newline
Examples
printf "%s\n" helloUsage and sandbox support
The sandbox supports these basic formats and does not support loop formatting or width control.
Hands-on exercises
- Exactly output a greetingEveryday
Related commands
echoOutput a piece of textteeOutput and save pipeline contentsxargsConvert input into command parametersexportSet environment variablesenvView environment variablesprintenvOutput the value of environment variableunsetRemove variableshistoryView command historyclearClear the terminal displaytrueReturn success statusfalseReturn failure statusseqGenerate a sequence of numberssleepPause for specified timealiasSet command aliasunaliasRemove command aliassourceRead script in current ShellreadRead variables from inputbashRun the Bash scriptshRun the POSIX Shell scriptcommandControl command lookupjobsView current Shell jobsbgResume background jobfgResume foreground jobwaitWait for child process to endnohupIgnore hangup signal and runtimeoutLimit command running timewatchDisplay command results periodicallytimeMeasure run timeulimitView or set resource limitssetSet Shell behaviortrapHandle exit or signaltmuxManage terminal sessionsscreenKeep terminal session