Categories: TutorialsUbuntu

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...

Sponsored

For example:

$ namei test/test1.txt

Output:

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:

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

Sponsored
$ namei -o test/test1.txt

Output:

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:

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:

Conclusion

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

Thank you for referring!

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.

Ubuntu Server Admin

Recent Posts

How we used Flask and 12-factor charms to simplify Canonical.com development

Our latest Canonical website rebrand did not just bring the new Vanilla-based frontend, it also…

6 hours ago

Web Engineering: Hack Week 2024

At Canonical, the work of our teams is strongly embedded in the open source principles…

1 day ago

Ubuntu Weekly Newsletter Issue 873

Welcome to the Ubuntu Weekly Newsletter, Issue 873 for the week of December 29, 2024…

3 days ago

How to resolve WiFi Issues on Ubuntu 24.04

Have WiFi troubles on your Ubuntu 24.04 system? Don’t worry, you’re not alone. WiFi problems…

3 days ago

Remembering and thanking Steve Langasek

The following is a post from Mark Shuttleworth on the Ubuntu Discourse instance. For more…

3 days ago

How to Change Your Prompt in Bash Shell in Ubuntu

I don’t like my prompt, i want to change it. it has my username and…

3 days ago