Namei command in linux

namei Command in Linux

Introduction

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, …

For that matter, the namei command appeared. Now we’re gonna teach you to use the namei command in Linux.

The syntax of the namei command

The syntax:

namei [options] pathname...

Namei command in linux 1

Sponsored

For example:

$ namei test/test1.txt

Output:

Namei command in linux 2

f: the path name

d: directory

-: the file name

Using the namei command

1. Align to the left margin (using -v option)

$ namei -v test/test1.txt

Output:

Namei command in linux 3

2. Show owner and group (using -o option)

Sponsored
$ namei -o test/test1.txt

Output:

Namei command in linux 4

This proves that this folder and file are both owned by ubuntu.

3. Show long list (using -l option)

$ namei -l test/test1.txt

Output:

Namei command in linux 5

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

Output:

Namei command in linux 6

Conclusion

We just taught you to use the namei command in Linux.

Thank you for referring!

Karim buzdar

Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications including CCNA RS, SCP, and ACE. As an IT engineer and technical author, he writes for various websites.


Discover more from Ubuntu-Server.com

Subscribe to get the latest posts sent to your email.

Comments

No comments yet. Why don’t you start the discussion?

    Leave a Reply