Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Last Updated: Mar 27, 2024
Difficulty: Easy

Linux -Man Pages

Leveraging ChatGPT - GenAI as a Microsoft Data Expert
Speaker
Prerita Agarwal
Data Specialist @
23 Jul, 2024 @ 01:30 PM

Introduction

As you begin your Linux journey, you'll notice that things are much simpler than you initially assumed. This is especially true on desktop computers, where everything is done with a point-and-click interface. You could live your entire life without ever using the command line.

Linux -Man Pages

Users can learn how to use commands in Linux by checking manuals. In this article, we will learn about man pages in Linux.

Linux Man Pages

The term "man" stands for manual page. Man pages are manual pages designed to assist users in learning how Linux commands are used. By default, these pages are installed alongside the commands. A man page created by a software developer will always be accessible to show how to use a specific command.

The syntax of using man pages:

man <command_name>

 

The argument could be a keyword, utility or function.

 

Command Shell Output

The man pages use a pager to display their output. The output of a pager is displayed one screenful at a time. Thus the entire text does not appear at once, and there is no way to scroll the page.

The bottom of the screen has a colon that indicates the page's finish. You can use the "space bar" or "f" to advance to the next page and the "b" key to go backward. Use 'q' to leave the current page, which will take you to the shell programs. Press "h" to get help.

Sections

The man page is divided into various sections. A specific topic subdivides each section. A number is written in parentheses following the command in the man pages. These numbers stand for the section number.

1 → Executable Commands.

2 → System Calls.

3 → Library Functions.

4 → Special files and drivers.

5 → File conventions and formats.

6 → Screensavers and games.

7 → Miscellaneous.

8 → Commands and daemons for system administration.

 

The syntax for the section number:

Man section_number arguments

 

Man Options

We will see some of the man options along with the function descriptions.

💡 man -a: To display every man page for a command, type man -a.

💡 man -aw: List every part of the available command.

💡 man -f, whatis: If applicable, it shows the description from the manual page.

💡 sman -k (apropos): It displays a list of man-page results that match a given keyword.

💡 whereis: It is used to find a man page's location.

Get the tech career you deserve, faster!
Connect with our expert counsellors to understand how to hack your way to success
User rating 4.7/5
1:1 doubt support
95% placement record
Akash Pal
Senior Software Engineer
326% Hike After Job Bootcamp
Himanshu Gusain
Programmer Analyst
32 LPA After Job Bootcamp
After Job
Bootcamp

Man -a

This command allows us to display every portion of a specific topic's man page. The lowest section number will appear first as the sections are presented in increasing order.

For example, we are using the man -a pwd command. The pwd command is used to display the complete path name of your current directory (from the root directory).

We will get the following output.

Man -a pwd command

We can press h for help and q to quit the current page. 

Man -aw

This command allows us to display all the sections of a specific topic's man page.

Example:  Consider one example of man -aw command with the syntax:

man -aw pwd

 

We will get the following output.

man -aw pwd command

Man -f

This command functions similarly to the "whatis" command. It looks for the name of the relevant manual page for a given command and shows the result and a summary of that manual page.

Example: Consider one example of man -aw command with the syntax:

man -f pwd

 

We will get the following output.

Man -f pwd

Man -k

In the same way as apropos works, this command will display all types of results related to our keyword search on the man page. It might be helpful when we don't know a command's specific name.

Example: Consider one example of man -k command with the syntax:

man -k pwd

 

We will get the following output.

man -k pwd

Whereis -m

We can find the location of a man page using the whereis -m command. For example, we are using the whereis -m pwd command, and we will get the following output.

Whereis -m pwd

Frequently Asked Questions

What is the function of CLI?

A command language interpreter is known as CLI. It deals with computer programme interaction when the user issues text-line commands. It also links with computer terminals; the interface accepts text lines and transforms them into instructions for the operating system.

What do you mean by Shell?

A computer programme called Shell acts as a connection between the user and the kernel. Users can write programs, instructions, and shell scripts to connect with the kernel. It accepts commands that can be read by humans and turn them into kernel-understandable instructions.

What is a swap space?

When physical RAM memory is exhausted, swap space is used. The swap space will get the RAM's inactive pages. It may take into account using swap files or a separate swap partition.

Conclusion

We have discussed the manual pages in Linux. We discussed the command shell output, sections of the manual pages, and options for the man pages. We have discussed the man -a, man -f and man -k commands in detail.

We hope this blog helped you. We recommend visiting Coding Ninjas Studio to learn more topics about Linux, such as

🔥 Linux Operating System.

🔥 Types of Operating Systems.

🔥 Functions of an Operating System.

If you liked our article, do upvote our article and help other ninjas grow.  You can refer to our Guided Path on Coding Ninjas Studio to upskill yourself in Data Structures and AlgorithmsCompetitive ProgrammingSystem Design, and many more!

Head over to our practice platform Coding Ninjas Studio to practice top problems, attempt mock tests, read interview experiences and interview bundles, follow guided paths for placement preparations, and much more!!

Happy Reading!!

Topics covered
1.
Introduction
2.
Linux Man Pages
2.1.
Command Shell Output
2.2.
Sections
2.3.
Man Options
3.
Man -a
4.
Man -aw
5.
Man -f
6.
Man -k
7.
Whereis -m
8.
Frequently Asked Questions
8.1.
What is the function of CLI?
8.2.
What do you mean by Shell?
8.3.
What is a swap space?
9.
Conclusion