Almost every command has an associated manual page. Suppose the command verb is ls, then typing man ls at the command line prompt will give you that command's reference page.

The -t flag has no specific meaning across all commands. You will need to look at the man page for the particular command to find out what it does.

Answer from Chris Davies on Stack Exchange
🌐
RapidTables
rapidtables.com › code › linux › ls › ls-t.html
ls -t command in Linux/Unix | sort by date/time
Home > Code > Linux > ls > ls -t · ls -t option flag sorts files/directories list by time/date. $ ls -t [options] [file|dir] Default list: $ ls Desktop Downloads Pictures Templates Videos Documents Music Public todo.txt $ List sorted by time/date ·
🌐
Stack Overflow
stackoverflow.com › questions › 39632689 › using-type-t-command-in-linux-c
shell - Using type -t command in linux c.? - Stack Overflow
I use popen to execute type -t type , this give me an error message -t not found. When I perform type -t type in the shell this gives me builtin. Why doesn't this work with popen?
Top answer
1 of 3
5

You are right that it is amazingly poorly documented. What documentation that there is is quite simple:

-t      Exit after reading and executing one command.

The bash source code is available here. I looked at version 4.2. The short flags handled by bash are listed in flags.c and in there is the relevant line:

{ 't', &just_one_command },

So, -t on the command line sets the variable just_one_command. This variable is used in just one place: it occurs in an if condition at the end of a loop in eval.c:

  if (just_one_command)
    EOF_Reached = EOF;

In other words, if the -t flag is given, then, after the first command is executed, the end-of-file condition is signaled and bash exits.

MORE DETAIL

From eval.c, command line execution in bash appears to be controlled by the function reader_loop:

reader_loop ()
{
  int our_indirection_level;
  COMMAND * volatile current_command;
  USE_VAR(current_command);
  current_command = (COMMAND *)NULL;
  our_indirection_level = ++indirection_level;
  while (EOF_Reached == 0)
    {
      int code;
      code = setjmp_nosigs (top_level);

      [ ... Much code removed ... ]

      if (just_one_command)
        EOF_Reached = EOF;
    }
  indirection_level--;
  return (last_command_exit_value);
}

The loop inside reader_loop continues until it receives the signal EOF_Reached. The sole effect of the -t option is to set this flag at the end of loop which assures that the loop is executed only once.

2 of 3
5

Using the bash builtin help, i.e. by saying help set, you'd find:

  -t  Exit after reading and executing one command.

Since bash parses a line at a time, you might have multiple commands separated by ; on the same line and those would execute. For example, the following:

set -t; echo Do something; echo do more; echo and more
echo no more

would produce

Do something
do more
and more

as the output. On the other hand, the following:

set -t
echo Do something
echo do more
echo and more
echo no more

would not produce any output.


You could look for the documentation in the info page. Say:

info bash "Shell Builtin Commands"

Navigate to * Bourne Shell Builtins:: and search for help.

🌐
Stack Overflow
stackoverflow.com › questions › 74692678 › what-is-the-purpose-of-p-or-t-in-terminal
command line interface - What is the purpose of "-p" or "-t" in terminal? - Stack Overflow
What is the purpose of -p and -t in the following terminal commands? mkdir -p ~/.ssh ssh-keygen -t rsa -b 4096 -C "your_email@example.com" In general, I'm having trouble understanding the
🌐
DataFlair
data-flair.training › blogs › linux-commands-list
Linux Commands List for Linux Programming - Part 3 - DataFlair
November 15, 2018 - This Linux Commands tutorial covers Linux commands list for beginners. It will help you in learning 10 most commonly used Linux commands with syntax to start Linux programming. You will also get few Linux commands with examples here.
🌐
Rocket Software
www3.rocketsoftware.com › rocketd3 › support › documentation › mvb › 32 › refman › proc › t_command2.htm
Rocket Software Documentation
Skip to main contentSkip to search · Powered by Zoomin Software. For more details please contactZoomin · Log in to get a better experience · Login · Rocket Software · 77 4th Avenue Waltham, MA 02451 USA · Products · About · Contact · Resources
Find elsewhere
🌐
GeeksforGeeks
geeksforgeeks.org › linux-unix › tee-command-linux-example
tee command in Linux with examples - GeeksforGeeks
Linux-Unix · Interview Questions ... Updated : 29 Jan, 2026 · The tee command reads standard input and writes it to both standard output and one or more files at the same time....
Published   December 5, 2017
Top answer
1 of 4
14

-s Switch: Squeeze (remove repeated characters)

echo i am a good boy | tr -s good bad

output: i am a bd bdy

There are two things happening behind the scenes that make this happen. Firstly, if the second argument to tr is shorter than the first then the last character in the 2nd arg is repeated to make it the same length as the first. So the equivalent command is:

echo i am a good boy | tr -s good badd

The other thing that is happening is when characters in the first argument are repeated they overwrite any previous occurrence (I'm referring to the two oos in good). This makes the command now equivalent to:

echo i am a good boy | tr -s god bdd

(the second o to d replacement overwrites the previous o to a replacement, making it redundant)

Without the -s switch the output would be

i am a bddd bdy

With the -s switch tr 'squeezes' any repeated characters that are listed in the last argument leaving the final output:

i am a bd bdy

-c Switch: Complement

The -c switch is used to match the complement of the first argument (i.e. all characters not listed in arg 1). As a result, arg 1 will contain many letters (256-3). Now, the same thing happens to arg 2 as in the previous case: Arg 2's final character gets repeated to match the length or Arg 1. So the original statement:

echo i am a good boy | tr -c good bad

is equivalent to:

echo i am a good boy | tr abcefhijklmnp... baddddddddddd...

(note the missing g, o and d in the first set, also note that d will replace every other character in the second set -- including the space character)

This is why i am a good boy turns into dddddddgoodddodd

More info here: http://www.linuxjournal.com/article/2563

2 of 4
4

Your understanding of -s is incorrect, it replaces repeated occurrences of characters in set 1 in the input with a single character. it does not modify the set, eg.

echo i am a good boy | tr -s god bad

gives

i am a bad bay

The -c option replaces set 1 with its complement (ie. the set of all characters not contained in set 1). You can use this to remove all but the specified characters for example.

echo i am a good boy | tr -cd gobdy

outputs

goodboy
🌐
Ubuntu
ubuntu.com › tutorials › command-line-for-beginners
The Linux command line for beginners | Ubuntu
In theory you could even hook up one of those old 1970s terminals to a modern Linux box, and access the shell through that. But these days it’s far more common to use a software terminal: that same old Unix-style text interface, but running in a window alongside your graphical programs. Let’s see how you can do that yourself! On a Ubuntu 18.04 system you can find a launcher for the terminal by clicking on the Activities item at the top left of the screen, then typing the first few letters of “terminal”, “command”, “prompt” or “shell”. Yes, the developers have set up the launcher with all the most common synonyms, so you should have no problems finding it.
Top answer
1 of 3
2

The ls man page can help clarify these options.

The -l option controls output format, producing a 'long' listing.

The -t option sorts by modification time. This value is already present in the long format.

The -u option behaves differently based on the options it is used with.

  1. On its own, as ls -u, it sorts by access time.
  2. With the -l option, it displays the access time, but sorts by name. In this case, it acts as an output modifier rather than a sorting option.
  3. With -l and -t, it shows the access time and also sorts by it.

The -c option works the same way with the ctime property.

The complexity comes from the need to modify the long listing format. Several other options work this way: -lo to suppress group information, -lG to suppress owner information, -lh to display sizes in human-readable format, and so on).


The GNU-style options from the ls manual makes this easier to understand.

-l is --format=long.

-t is --sort=time.

-u is --time=atime.

So -lu is --format=long --time=atime. That is, show the long listing, but with atime instead of the default mtime.

And -ltu is --format=long --sort=time --time=atime. In this case, show the atime and sort by it.

2 of 3
1

You are mostly correct, -t means "sort by time" and -u means "use the atime timestamp" (when sorting with -t or when showing the timestamp with -l). The POSIX -u option does not imply changing the default order of sorting unless -t is also used to explicitly request sorting by a timestamp.

The POSIX specification of ls has the following bits of text in it:

-u

Use time of last access (see XBD <sys/stat.h>) instead of last modification of the file for sorting (-t) or writing (-l).

However, the GNU people thought that it would be convenient to let ls -u also sort by atime, since otherwise there would be no difference between the outputs of ls -u and ls (both would be sorted by name and no timestamps would show). This is why GNU ls works differently from any other system's implementation of ls.

The documentation of ls on a GNU system summarizes this as

-u

with -lt: sort by, and show, access time; with -l: show access time and sort by name; otherwise: sort by access time, newest first

What's not mentioned in this short text is that any other options that provides a similar output format as -l, e.g. -o, -g and -n, also removes the sorting effect from the -u option like -l does. These options all have the text "like -l but, ..." in the GNU ls manual.

The -c option in GNU ls depends on other options in a similar way to sort/display the ctime timestamp.

The GNU ls has worked like this since 1999 or thereabouts.

Regardless of what implementation of ls you are using, to sort the long format output on a timestamp, you will have to use -t. Use -l -ut to sort on atime, -l -ct to sort on ctime, or just -l -t to sort on mtime.

🌐
Carleton University
cs.carleton.edu › generic-course-info › unix.html
Linux command cheat sheet
Hitting the up arrow while in a terminal window will show you the previous command you typed.
🌐
Linuxize
linuxize.com › home › linux commands › linux tee command with examples
Linux Tee Command with Examples | Linuxize
January 12, 2019 - The tee command reads from standard input and writes it to standard output and one or more files. It also works with binary data. If you have any questions or feedback, feel free to leave a comment. ... A quick weekly roundup of new tutorials, news, and tips. ... Dejan Panovski is the founder of Linuxize...
🌐
Linux Command Library
linuxcommandlibrary.com
Basics | Cheat sheets | Linux Command Library
Handy cheat sheets with linux tips and terminal basics about System control, Users, Files, Package managers, Video and Audio, Hacking tools, Terminal games and many more categories.
🌐
Media College
mediacollege.com › linux › command › linux-command.html
Linux Commands
A list of Linux commands, with explanation and html man page for each command.
🌐
Wikipedia
en.wikipedia.org › wiki › Tee_(command)
tee (command) - Wikipedia
1 month ago - The command is provided in Unix and Unix-like systems, OS-9, DOS (e.g. 4DOS, FreeDOS), Windows (e.g. 4NT, PowerShell, UnxUtils), ReactOS and IBM i. The Linux version was written by Mike Parker, Richard Stallman, and David MacKenzie.