Linux common Commands (iii)

Source: Internet
Author: User

1. Top

Description: Instant display of process dynamics

Syntax format: top [-] [D delay] [Q] [C] [s] [s] [i] [n] [b]
Basic parameters:
D: Change the update speed of the display, or press s in the chat command column (interactive command)
Q: There is no delay in the display speed, if the user has Superuser permissions, then top will be executed with the highest precedence
C: Toggle display mode, a total of two modes, one is to display the name of the execution file, the other is to display the full path and name S: Cumulative modulus
, the CPU time of the dead child process, which is completed or disappeared, is accumulated.
S: Safe mode, cancel conversational instruction, avoid potential crisis
I: Do not display any idle (idle) or useless (zombie) travel
N: The number of updates that will exit the top after completion
B: Batch mode, used with "n" parameter, can be used to output top results in the file
Example:
Show Update 10 times after exiting;
Top-n 10
The user will not be able to use the conversational instruction to command the trip:
Top-s
Enter the results of the update display two times into the file named Top.log:
Top-n 2-b < Top.log

2, Skill

Send a signal to the executing program, the default message is term (interrupt), the more commonly used message is HUP, INT, KILL, STOP,
CONT, and 0
Messages are written in three ways:-9,-sigkill,-kill, can use-l or-l lists the available messages.
How to use: skill [signal to send] [options] rules for selecting programs
Basic parameters:
-F Quick Mode/not completed
-I interactive mode/each action will be confirmed
-v Verbose output/listing information for the selected program
-W Smart warning message/not completed
-N No action/Display program code
Parameters: Select the program's rules can be, terminal code, user name, program code, command name.
-T Terminal code (TTY or pty)
-U user Name
-P Program code (PID)
-C command name can use the signal:
The following is a list of known signal names, signal codes, and functions.
Name (code) function/Description
Alrm 14 Away
HUP 1 away
INT 2 Leave
KILL 9 leave/force close
PIPE 13 left
POLL leave
PROF leave
Term 15 left
USR1 leave
USR2 leave
Vtalrm leave
Stkflt departure/Only for i386, m68k, arm and PPC hardware
UNUSED departure/Only for i386, m68k, arm and PPC hardware
TSTP Stop/generate content-related behavior
Ttin Stop/generate content-related behavior
Ttou Stop/generate content-related behavior
Stop stop/Force close
CONT from New start/If in stopped state, otherwise ignored
PWR ignored/will leave in some systems
WINCH Ignore
CHLD Ignore
ABRT 6 Core
FPE 8 Core
ILL 4 Core
QUIT 3 Core
SEGV 11 Core
TRAP 5 Core
SYS core/Perhaps not yet implemented
EMT core/Perhaps not yet implemented
BUS Core/Core failure
XCPU Core/Core failure
Xfsz Core/Core failure
Example:
Stop all the programs on the PTY device
Skill-kill-v pts/*
Stop three users User1, User2, User3
Skill-stop user1 User2 User3

3. Expr

# # # String length
shell>> expr Length "This is a test"
14
# # # Digital Quotient
Shell>> Expr 14% 9
5
# # # Grab a string from a position
Shell>> expr substr "This is a test" 3 5
IS is
# # # Number string only the first character
shell>> Expr Index "Testforthegame" E
2
True reproduction of # # # Strings
shell>> Expr Quote Thisisatestformela
Thisisatestformela

4, Mformat

Syntax format:

Mformat [-t cylinders] [-H heads] [-s sectors] [-l volume_label] [-f] [-I fsver-sion] [-S sizecode] [-2
SECTORS_ON_TRACK_0] [-M software_sector_size] [-A] [-X] [-c] [-H hidden_sectors] [-R Root_sectors] [-B
Boot_sector] [-0 rate_on_track_0] [-A rate_on_other_tracks] [-1] [-K] Drive:
Set up a DOS file system on a magnetic chip that has already done low-order formatting. If the use_2m parameters are hit when compiling the Mtools
Some parameters related to the 2M format will function. Otherwise, these parameters (like s,2,1,m) do not work.
Parameters:
-T Magnetic column (Synlider) number
-H Head (head) number
-S number of magnetic regions per magnetic track
-L Label
-F Formats the disk in FAT32 format, but this parameter is still in the experiment.
-I sets the version number in FAT32. This, of course, is still in the experiment.
-S magnetic region size code, calculated as Sector = 2^ (size code +7)
The number of magnetic regions of the-C magnetic Bundle (cluster). If the given number causes the number of magnetic bundles to exceed the limit of the FAT table, Mformat will automatically enlarge
Number of magnetic regions.
-S
-M soft magnetic region size. This number is the size of the magnetic field that the system returns. is usually the same as the actual size.
-A If you add this parameter, Mformat will generate a set of Atari system numbers to this floppy disk.
-X formats the floppy disk into the XDF format. You must first use the xdfcopy instruction to make a low-order formatted action on the floppy disk.
-C produces a disk image file (disk image) that can install MS-DOS file system. Of course, for a physical disk drive this parameter
There is no point in it.
-H hides the number of magnetic regions. This usually applies when formatting the partition of the hard disk, because there is usually a partition table in front of a partition. This one
parameter is not tested, can not be used.
-N Disk number
The size of the-r root directory, in units of the number of magnetic regions. This parameter is valid only for FAT12 and FAT16.
-B Use the designated file or the device's boot magnetic area as the magnetic field of this piece or partition area. Of course, the hardware parameters will follow
Change.
-K try to keep the original boot magnetic area.
-0 data transfer rate for NO. 0 track
-A data transfer rate beyond the No. 0 rail
-2 Using 2m format
-1 do not use 2m format
Example:
Mformat A:
This will use the default value of a: (that is,/dev/fd0) in the disk format.

5, Mkdosfs:

Set up a DOS file system. Device refers to the code you want to set up a DOS file system. It's like/dev/hda1 and so on.
Block_count is the number of chunks you want to configure. If Block_count is not specified, the system will automatically calculate the size of the device for you
The number of small chunks.

Syntax format:

MKDOSFS [-C |-l filename]
[-F Number_of_fats]
[-F Fat_size]
[-I. volume_id]
[-M Message_file]
[-N Volume_Name]
[-R Root_dir_entry]
[-S Sector_per_cluster]
[-V]
Device
[Block_count]

Parameters:
-C Check if there is a bad track before setting up the file system.
-L reads the bad track record from the determined file.
-f Specifies the number of file configuration tables (FAT, File Allocation table). The preset value is 2. Currently, the FAT file system of Linux does not
Support for more than 2 FAT tables. Usually this does not need to be changed.
-f Specifies the size of the FAT table, typically 12 or 16 bytes. 12-bit groups are typically used for magnetic discs, and 16-bit groups are used for general
The partition of the hard disk, the so-called FAT16 format. This value usually designates the appropriate value for the system itself. Using FAT16 on a magnetic disc
Often does not work, and vice versa with FAT12 on hard drives.
-i specifies the Volume ID. is typically a 4-byte number, like a 2e203a47. If you do not give the system will generate itself.
-M when the user attempts to use this piece of magnetic or partition to boot, and there is no operating system, the system will give users a warning message.
This parameter is used to change the message. You can use the file to edit it first, then specify it with this parameter, or use
-M-the system will ask you to enter the text directly. It is important to note that the length of the string in the file should not exceed 418 characters, including the expansion
The Jump bar symbol (TAB) and line break symbol (line break symbols are counted two characters under DOS!) )
-n Specifies Volume Name, which is the disk label. Just like the format directive under DOS, you can give it all. No pre-
Set the value.
-r Specifies the maximum number of files under the root directory. Here the number of so-called archives includes directories. The default value is 112 or 224 on the soft disc,
The hard disk is 512. Don't change that number.
-s the number of magnetic regions per magnetic bundle (cluster). Must be 2 of the number of times. But unless you know what you're doing, don't give the value.
-V provides additional information
Example:
Mkdosfs-n tester/dev/fd0 Formats the disk in a slot in DOS format and sets the label to Tester

6, Chsh

Description: Changing the user shell settings

Usage:shell>> CHSH

Example:
Shell>> Chsh
changing fihanging shell for User1
Password: [del]
New Shell [/bin/tcsh]: # # # [is the currently used shell]
[Del]
Shell>> Chsh-l # # # show/etc/shells archive contents
/bin/bash
/bin/sh
/bin/ash
/bin/bsh
/bin/tcsh
/bin/csh

7. lsof Command

The lsof command is used to view the files that your process is opening, the process that opened the file, the ports that the process opened (TCP, UDP). Retrieve/Recover deleted files. is a very convenient system monitoring tool, because the lsof command requires access to core memory and various files, so the root user needs to execute. In a Linux environment, everything is in the form of files, with files that not only access regular data, but also access to network connectivity and hardware. So, such as Transmission Control Protocol (TCP) and User Datagram Protocol (UDP) sockets, the system assigns a file descriptor to the application in the background, regardless of the nature of the file, which provides a common interface for the interaction between the application and the underlying operating system. Because the application opens a descriptor list of files that provides a lot of information about the application itself, it is helpful to see the list through the Lsof tool for system monitoring and troubleshooting.

Grammatical structure

Lsof (parametric)

Parameters:

-A: Lists the processes that exist for open files;

-c< process name;: Lists files opened by the specified process;

-G: List the GID process details;

-d< file number;: Lists the processes that occupy the file number;

+d< directory;: Lists the files that are opened in the directory;

+d< Directory: Recursively lists the files that are opened in the directory;

-n< directory;: Lists files that use NFS;

-i< conditions;: Lists the processes that meet the criteria. (4, 6, protocol,: Port, @ip)

-p< process number;: Lists the files opened by the specified process number;

-U: Lists the UID number process details;

-H: Displays help information;

-V: Displays version information.

8. Stat

The stat command File permission property sets the stat command to display the status information for a file. The output information of the Stat command is more verbose than the output information of the LS command.

Syntax stat (option) (parameter)

Options

-L: Supports symbolic connection;

-F: Displays file system Status instead of file status;

-T: Output information in a concise manner;

--help: Display the help information of the instruction;

--version: Displays the version information of the instruction.

Parameters

File: Specifies the normal file to display information or the file system's corresponding device file name.

Linux common Commands (iii)

Related Article

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.