I am learning the cat command of linux, and I found this command :
$ echo 'Text through stdin' | cat - file.txt
What does "-" mean here? If I don't type it , then 'Text through stdin' will not be shown.
One of the most useful features of shell scripts is the lowly back quote character, usually called the backtick (`) in the Linux world. Be careful—this is not the normal single quotation mark character you are used to using for strings.
In Bash, the exclamation mark (!) is used with the pound (#) symbol to specify the interpreter path. This usage is called “shebang” and is denoted as: #!interpreter [arguments] In shell scripts, we can use it to specify bash as an interpreter: $ cat welcome.sh #!/usr/bin/bash echo "Welcome !!!"
command line - What does "./" mean in linux shell? - Ask Ubuntu Closed 8 years ago. What does the command ./ mean? For example, sometimes we call a file with ./config, sometimes ../config, thanks ./config means you're calling something in the current working directory. In this case config is an executable.
However the characters do have a special meaning for some of the apps that you run inside the terminal - usually your shell: These are just some of the expansions the shell performs on command lines; there are quite a few. Note that these expansions happen before the command is executed; the command will never “know” that you typed e.g.
These are just some of the expansions the shell performs on command lines; there are quite a few. Note that these expansions happen before the command is executed; the command will never “know” that you typed e.g. What is something the Linux Terminal cannot do?
And for that, either execute: What does "./" do in the Linux Terminal? At any time when you are using Linux from the command line you are located somewhere on the file system hierarchy. For non-root users this usually means somewhere in their home directory. ./ is shorthand for wherever you are located on the current directory.
it is common to write stdin
as dash (-
).
even man cat
mentions that:
With no FILE, or when FILE is -, read standard input.
and the manpage even has an example illustrating the use of dash and ordinary filenames (which is quite close to your original question, but includes the answer):
cat f - g
Output f's contents, then standard input, then g's contents.
-
tells cat to read from stdin
. This is quite common, a lot of apps read from stdin if you pass -
to them.
Some apps use -
as stdout
.
Here is an example of downloading blender and instead of writing it to a file we write it directly to stdout
and pipe it to tar, which expands it on the fly during download.
wget -c https://download.blender.org/source/blender-2.90.1.tar.xz -O - | tar -xzv
Here the -O -
tells wget to write directly to stdout
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With