As a Linux administrator, you often have to work with files, folders, symlinks, etc. And sometimes you need to know more information about individual elements in a path for example file type, owner, and so on. This is where the namei commandcomes to play.
Here at Ibmi Media, we shall look into how to use the namei command in Linux.
It's syntax is given below:
$ namei [options] pathname...
For example, For example, if we have a file named test1.txt:
$ namei test/test1.txt
Then from the output, you will see:
1. Align to the left margin (using -v option):
$ namei -v test/test1.txt
2. Show owner and group (using -o option):
$ namei -o test/test1.txt
In our case, the folder and file are both owned by ubuntu.
3. Show long list (using -l option):
$ namei -l test/test1.txt
With this option, it will show more privileges of the owner.
If you only want to show the privileges of the owner, let’s use the -m option:
$ namei -m test/test1.txt
This article covers how to use the namei command in Linux.
The namei command in Linux follows a pathname until a terminal point is found. Following is its syntax:
$ namei [options] pathname...
And here's what the man page says about this tool: