Bash basics man manual and bash basics man

Source: Internet
Author: User
Tags crypt kali linux

Bash basics man manual and bash basics man
Bash basics man Manual

Penetration tests based on Android devices are implemented through various terminals. Therefore, it is particularly important to master Shell-related operations. Bash is a Unix Shell program written for GNU. This document selects the Kali Linux penetration test tutorial Based on Android devices.

It is a Shell defined on many Linux platforms, and has many shells used on traditional UNIX systems, such as tcsh, csh, ash, bsh, and ksh. Bash is the default Shell in most Linux systems. This chapter introduces the basic knowledge of Bash.

2.1 man Manual

In Linux man, man is the abbreviation of manual. In Linux, the man manual is used to view various reference manuals in the system. By viewing the man manual, you can obtain help information about various commands, files, libraries, and functions. This section describes the man manual.

It is easy to use man files. Here we will first introduce its syntax format and related parameters. The syntax format of the man command is as follows:

  • Man [section number] MAN PAGE NAME

In the preceding command, the meanings of the two options are as follows:

Q section number: the unit NUMBER on the man manual page.

Q man page name: NAME of a man manual, usually the NAME of a command, system, or library. For example, if you look for the man command manual page, execute the command as follows:

  • Man 1 man

In the preceding command, 1 indicates that the man command is in section 1st, and the command after the man parameter is the name of the man manual page.

The chapter numbers on the Man manual page are defined according to their own specifications and mainly divided into several parts. As follows:

Q 1: Common commands use this section to find the command information used in the command line. In the above command, use it to find information about the man file.

Q 2: System Call: A function provided by the kernel.

Q 3: C library functions. This document is very useful for C language development, and developers use the development language as a C extension tool, such as Python. It displays parameter-related information, header file definitions, behaviors, and basic C library function calls.

Q 4: Special files, that is, various device files. These files are usually stored in the/dev/directory, such as character devices and pseudo terminals.

Q 5: File Format and conversion. This document contains the file format in Linux. For example, in the passwd password file, this manual page describes the meaning of each field in this file.

Q 6: Game and screen protection. This document contains information about games and screen saver programs.

Q 7: Miscellaneous. This document contains various command information and other information.

Q 8: system administrator commands and daemon processes. Commands and system daemon in this document can only be used by administrators.

The page layout of the man manual is standardized and contains a set of specific parts. Each part of the man manual page contains a description, system call, or library function. The following describes the parts with the same purpose in the man file, as shown below:

Q Name: Name of the command, function, system call, or file format.

Q Synopsis: It indicates syntax formats such as commands, functions, system calls, and file formats.

Q Description: Description of the command function

Q Examples: an example of how to use a command.

Q See also: reference documents, Web pages, and other programs related to the program.

In order to verify the syntax format and content format of the man manual, the following examples are provided for verification.

[Instance 2-1] view the man manual page of the local Pseudo Terminal. Run the following command:

  • Android @ localhost :~ $ Man 4 pts

After the preceding command is executed, the following information is displayed:

  • PTS (4) Linux Programmer's Manual PTS (4)

  • NAME

  • Ptmx, pts-pseudo-terminal master and slave

  • DESCRIPTION

  • The file/dev/ptmx is a character file with major number 5 and minor

  • Number 2, usually of mode 0666 and owner. group of root. root. It is

  • Used to create a pseudo-terminal master and slave pair.

  • When a process opens/dev/ptmx, it gets a file descriptor for a previous u ‐

  • Doterminal master (PTM), and a pseudo doterminal slave (PTS) device is

  • Created in the/dev/pts directory. Each file descriptor obtained

  • Opening/dev/ptmx is an independent PTM with its own associated PTS,

  • Whose path can be found by passing the descriptor to ptsname (3 ).

  • Before opening the pseudo-terminal slave, you must pass the master's

  • File descriptor to grantpt (3) and unlockpt (3 ).

  • Once both the pseudo-terminal master and slave are open, the slave pro ‐

  • Vides processes with an interface that is identical to that of a real

  • Terminal.

  • ......

  • FILES

  • /Dev/ptmx,/dev/pts /*

  • NOTES

  • The Linux support for the above (known as UNIX 98 pseudo doterminal nam ‐

  • Ing) is done using the devpts file system, that shoshould be mounted on

  • /Dev/pts.

  • Before this UNIX 98 scheme, master pseudo terminals were called

  • /Dev/ptyp0,... and slave pseudo doterminals/dev/ttyp0,... and one

  • Needed lots of preallocated device nodes.

  • SEE ALSO

  • Getpt (3), grantpt (3), ptsname (3), unlockpt (3), pty (7)

  • COLOPHON

  • This page is part of release 3.44 of the Linux man-pages project.

  • Description of the project, and information about reporting bugs, can

  • Be found at http://www.kernel.org/doc/man-pages.

From the information output above, we can see that this manual page consists of seven parts, such as the topic, file name, file storage location, and reference materials. PTS (4) is displayed in the upper left corner of the output information ). PTS indicates the name of the manual, and (4) indicates that the Manual is located in Chapter 4. Finally, press the q key to exit the man manual page. This document selects the Kali Linux penetration test tutorial Based on Android devices.

[Instance 2-2] view the man manual page of the passwd file. Run the following command:

  • Android @ localhost :~ $ Man 5 passwd

After the preceding command is executed, the following information is output:

  • PASSWD (5) File Formats and Conversions PASSWD (5)

  • NAME

  • Passwd-the password file

  • DESCRIPTION

  • /Etc/passwd contains one line for each user account, with seven fields

  • Delimited by colons (":"). These fields are:

  • · Login name

  • · Optional encrypted password

  • · Numerical user ID

  • · Numerical group ID

  • · User name or comment field

  • · User home directory

  • · Optional user command interpreter

  • The encrypted password field may be blank, in which case no password is

  • Required to authenticate as the specified login name. However, some

  • Applications which read the/etc/passwd file may decide not to permit

  • Any access at all if the password field is blank. If the password field

  • Is a lower-case "x", then the encrypted password is actually stored in

  • The shadow (5) file instead; there must be a corresponding line in

  • /Etc/shadow file, or else the user account is invalid. If the password

  • Field is any other string, then it will be treated as an encrypted

  • Password, as specified by crypt (3 ).

  • The comment field is used by various system utilities, such

  • Finger (1 ).

  • The home directory field provides the name of the initial working

  • Directory. The login program uses this information to set the value

  • The $ HOME environmental variable.

  • The command interpreter field provides the name of the user's command

  • Language interpreter, or the name of the initial program to execute.

  • The login program uses this information to set the value of the $ SHELL

  • Environmental variable. If this field is empty, it defaults to

  • Value/bin/sh.

  • FILES

  • /Etc/passwd

  • User account information.

  • /Etc/shadow

  • Optional encrypted password file

  • /Etc/passwd-

  • Backup file for/etc/passwd.

  • Note that this file is used by the tools of the shadow toolsuite,

  • But not by all user and password management tools.

  • SEE ALSO

  • Crypt (3), getent (1), getpwnam (3), login (1), passwd (1), pwck (8 ),

  • Pwconv (8), pwunconv (8), shadow (5), su (1), sulogin (8 ).

  • Shadow-utils 4.1.5.1 05/25/2012 PASSWD (5)

From the above output information, we can see that there are seven fields in the passwd file, and each field is separated by a colon. The specific role of each field is described in this document. The passwd command is also available in Linux. To view the help information of the command, run the following command:

  • Android @ localhost :~ $ Man 1 passwd

The output information is as follows:

  • PASSWD (1) User Commands PASSWD (1)

  • NAME

  • Passwd-change user password

  • SYNOPSIS

  • Passwd [options] [LOGIN]

  • DESCRIPTION

  • The passwd command changes passwords for user accounts. A normal user

  • May only change the password for his/her own account, while

  • Superuser may change the password for any account. passwd also changes

  • The account or associated password validity period.

  • ......

  • OPTIONS

  • The options which apply to the passwd command are:

  • -A, -- all

  • This option can be used only with-S and causes show status for all

  • Users.

  • -D, -- delete

  • Delete a user's password (make it empty). This is a quick way

  • Disable a password for an account. It will set the named account

  • Passwordless.

  • -E, -- expire

  • Immediately expire an account's password. This in effect can force

  • A user to change his/her password at the user's next login.

  • -H, -- help

  • Display help message and exit.

  • -I, -- inactive INACTIVE

  • This option is used to disable an account after the password has

  • Been expired for a number of days. After a user account has had

  • Expired password for INACTIVE days, the user may no longer sign on

  • To the account.

  • ......

  • CAVEATS

  • Password complexity checking may vary from site to site. The user is

  • Urged to select a password as complex as he or she feels comfortable

  • With.

  • Users may not be able to change their password on a system if NIS is

  • Enabled and they are not logged into the NIS server.

  • Passwd uses PAM to authenticate users and to change their passwords.

  • FILES

  • /Etc/passwd

  • User account information.

  • /Etc/shadow

  • Secure user account information.

  • /Etc/pam. d/passwd

  • PAM configuration for passwd.

  • EXIT VALUES

  • The passwd command exits with the following values:

  • 0

  • Success

  • 1

  • Permission denied

  • 2

  • Invalid combination of options

  • 3

  • Unexpected failure, nothing done

  • 4

  • Unexpected failure, passwd file missing

  • 5

  • Passwd file busy, try again

  • 6

  • Invalid argument to option

  • SEE ALSO

  • Chpasswd (8), passwd (5), shadow (5), usermod (8 ).

  • Shadow-utils 4.1.5.1 05/25/2012 PASSWD (1)

The above output information displays the syntax format, options, descriptions, and other information of the passwd command. From the above output information, we can find that the chapter numbers are different and the content of the help document displayed is also different. In the preceding command, you can also skip section 1. By default, man commands are used to find related commands and functions from manuals with small numbers.

Note: The man command is searched in the order of chapter numbers in the manual. For example, you can view the manual of the sleep command and execute the man sleep command. To view the library function sleep, run the man 3 sleep command. In this section, you must enter the Kali Linux penetration test tutorial Based on Android devices.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.