Which is the meaning of this expression


New Member
Jan 10, 2019
Reaction score
I can´t find the meaning of this: (/.*) i have seen this many times in command line but i dont understand it

. = a character . right?
* = everything...

The pattern .* will match any file or directory that has a name which starts with a '.' character. The * will match anything with 0 or more characters after the '.'

So from your home directory, if you issue the command:
ls .*

It would match and list:
- ALL of the hidden files and directories - Because the names of hidden files and directories start with a '.' character. (e.g. .vimrc, .bashrc, .profile, .cache/, .config/ )
- All top-level files and directories in the current directory - Because the current directory is called '.')
- All top-level files and directories in the previous directory - Because the previous dir is called '..')
- The contents of ALL hidden directories in the current directory (e.g. .cache/ .config/)

And if you did something like this:
ls myfile.*[code]
That would match any file or directory that starts with "myfile." and has any characters afterwards.
So it would match "myfile.mp3", "myfile.ogg", "myfile.c", "myfile.h", "myfile.py", "myfile.jpg" and even just plain old "myfile." (assuming you had files with those names!)

And if you wanted to list all files of a particular type (e.g. .mp3)  you would switch the pattern around to this:
ls *.mp3

The pattern "*.mp3" will match any files or directories whose name starts with any number of characters (the * means zero or more of any character) and ends in ".mp3"

Does that make sense?
1. Full stop (.) è It is used for denoting current position when running commands such as find, cd.

For Example: following command will find all .txt files in current folder.

Commandè “find . -name *.txt”

One more example:

With use of this command “ps -ef | grep f..efox”

Here, “ps -ef” command will generate a list of running processes and gives it to grep which searches for all the line in the list which has “f..efox”. Where, “.” can mean any character.

2. Aesterisk (*) è It means 0 or more when searching for a pattern.

For example: “find . -name *.txt”

The above command will provide all the files which have a .txt extension.

One more example:

With the use of this command “ps -ef | grep F*efox”

Now, this command will find all the relevant things that match and generate output such as facefox, ferretfox, firefox etc.

3. Forward slash (/) è It is used for moving one directory to another directory, or we can say that for moving from one path from another path.

For example: cd /home/etc
Be careful not to mix regular expressions and file globs.

This is a file glob:
ls /.*
It gives a confusing result because it matches two directories in the root: "." and ".."

This is a regular expression:
ls | grep 'V.*s'
It will match any file or directory in the current directory that starts with 'V' and ends with 's'. Your home directory probably has a directory named "Videos" which it will find and return.

You should always use quotes with regular expressions on the command line. Otherwise the shell will interpret them as file globs and expand them before the command sees them.

For example, if there's a file named "V.tests" in the current directory, and you don't use quotes with the grep command above, the shell will interpret your intended regular expression as a file glob and expand it to that filename, which grep will return unmodified.

Staff online

Members online