Linux provides a large number of commands that can be used to efficiently perform a large number of tasks, such as disk operations, file access, directory operations, process management, file permissions, and more. Therefore, working on a Linux system is inseparable from using the commands provided by the system. To truly understand the Linux system, you must learn from Linux commands and learn more about Linux systems through basic command learning.
The number of commands for different Linux distributions is different, but there are more than 200 commands for Linux distributions. Here, the Marco linux college study group divides the more important and frequently used commands into the following six parts according to their role in the system.
â—† Installation and login commands: login, shutdown, halt, reboot, install, mount, umount, chsh, exit, last;
â—† File processing commands: file, mkdir, grep, dd, find, mv, ls, diff, cat, ln;
â—† System management related commands: df, top, free, quota, at, lp, adduser, groupadd, kill, crontab;
â—† Network operation commands: ifconfig, ip, ping, netstat, telnet, ftp, route, rlogin, rcp, finger, mail, nslookup;
â—† System security related commands: passwd, su, umask, chgrp, chmod, chown, chattr, sudo ps, who;
â—† Other commands: tar, unzip, gunzip, unarj, mtools, man, unendcode, uudecode.
This article uses Mandrake Linux 9.1 (Kenrel 2.4.21) as an example to introduce the installation and login commands under Linux.
Immortality press: Please use ctrl+f to find the content of a certain part or the usage of a certain command on this page.
60 commands that Linux must learn (1) - Installation and login commands
Login
Function
The role of login is to log in to the system, and its usage rights are all users.
2. Format
Login [name][-p ][-h hostname]
3. Main parameters
-p: Notifies login that the current environment parameters are maintained.
-h: Used to transfer the username to the remote login.
If you choose to log in to Linux with command line mode, the first Linux command you see is login:.
The general interface is like this:
Manddrake Linux release 9.1(Bamboo) for i586renrel 2.4.21-0.13mdk on i686 / tty1localhost login:rootpassword:
In the above code, the first line is the Linux distribution number, the second line is the kernel version number and the login virtual console. We enter the login name in the third line, press the “Enter†key to enter the account password after the password. log in system. For security reasons, characters are not echoed on the screen when the account password is entered, and the cursor does not move.
After logging in, you will see the following interface (take superuser as an example):
[root@localhost root]#last login:Tue,Nov 18 10:00:55 on vc/1
Shown above is the login week, month, day, time, and virtual console used.
4. Application skills
Linux is a true multi-user operating system that accepts multiple users at the same time and allows multiple users to log in multiple times. This is because Linux, like many versions of Unix, provides access to the virtual console, allowing users to log in multiple times at the same time from the console (the system's console is the monitor and keyboard directly connected to the system). Each virtual console can be thought of as a separate workstation that can be switched between workbenches. The virtual console can be switched by pressing the Alt key and a function key, usually using F1-F6.
For example, after the user logs in, press the "Alt+F2" button, and the user can see the "login:" prompt that appears above, indicating that the user has seen the second virtual console. Then just press the "Alt+F1" button and you can go back to the first virtual console. A newly installed Linux system allows users to access the first six virtual consoles using the "Alt+F1" to "Alt+F6" keys. The most useful thing about the virtual console is that when a program error causes the system to deadlock, you can switch to another virtual console to work and close the program.
Debug
Function
The shutdown command is used to shut down the computer and its usage rights are superusers.
2. Format
Shutdown [-h][-i][-k][-m][-t]
3. Important parameters
-t: Tells the init program how long it will shut down before changing to other run levels.
-k: Does not really shut down, just sends a warning signal to each registrant.
-h: Turn off the power after shutting down.
-c:cancel current process cancels the shutdown program currently being executed. So of course this option has no time parameters, but you can enter a message for explanation, and this information will be sent to each user.
-F: Force fsck when restarting the computer.
-time: Set the time before shutdown.
-m: Change the system to single-user mode.
-i: Displays system information when shutting down.
4. Command Description
The shutdown command safely shuts down the system. Some users will shut down the Linux system by directly disconnecting the power supply, which is very dangerous. Because Linux is different from Windows, it runs many processes in the background, so forcible shutdown may result in data loss of the process, making the system unstable, and even in some systems, the hardware device (hard disk) will be damaged. Use the shutdown command before the system is shut down. The system administrator will notify all logged-in users that the system will be shut down, and the login command will be frozen, that is, the new user can no longer log in.
Halt
Function
The halt command is used to shut down the system and its usage rights are superusers.
2. Format
Halt [-n] [-w] [-d] [-f] [-i] [-p]
3. Description of main parameters
-n: Prevents sync system calls. It is used after patching the root partition with fsck to prevent the kernel from overwriting the patched superblock with the old version of the superblock.
-w: It's not really a reboot or shutdown, just write a wtmp (/var/log/wtmp) record.
-f: No shutdown is called, but forced shutdown or restart.
-i: Turn off all network interfaces before shutting down (or restarting).
-f: Force shutdown, do not call shutdown command.
-p: When the power is turned off, the power is turned off.
-d: Shut down the system, but leave no records.
4. Command Description
Halt is called shutdown -h. When halt is executed, it kills the application process, executes sync (forces the data stored in the buffer to the hard disk). The system calls, and the kernel stops after the file system write operation is completed. If the system's run level is 0 or 6, shut down the system; otherwise, replace it with the shutdown command (plus the -h parameter).
Reboot
Function
The reboot command is used to restart the computer. Its usage rights are system administrators.
2. Format
Reboot [-n] [-w] [-d] [-f] [-i]
3. Main parameters
-n: Do not write the memory data back to the hard disk before rebooting.
-w: Doesn't really reboot, just write the record to the /var/log/wtmp file.
-d: Do not write the record to the /var/log/wtmp file (the -n parameter contains -d).
-i: Stop all network related devices before rebooting.
Install
Function
The install command is used to install or upgrade software or backup data. Its usage rights are for all users.
2. Format
(1)install [options]... source destination
(2)install [options]... source... directory
(3) install -d [options]... directory...
In the first two formats, <source> is copied to <destination> or multiple <source> files are copied to the existing <directory>, and the permission mode and owner/owner group are set. In the third format, all specified directories and their home directories are created. The parameters that must be used for long options are also required when using short options.
3. Main parameters
--backup[=CONTROL]: Back up each existing destination file.
-b: Similar to --backup, but does not accept any parameters.
-c: (This option is not processed).
-d, --directory: All parameters are processed as directories, and all home directories of the specified directory are created.
-D: Create all home directories before <destination>, then copy <source> to <destination>; useful in the first usage format.
-g,--group=Group: Set the own group, not the current group of the process.
-m,--mode= mode: Set the permission mode (like chmod) instead of rwxr-xr-x.
-o,--owner=Owner: Set the owner by yourself (only for superusers).
-p, --preserve-timestamps: Use the access/modification time of the <source> file as the time attribute of the corresponding destination file.
-s, --strip: Use the strip command to delete the symbol table, which is only applicable to the first and second usage formats.
-S,--suffix=Suffix: Specify the <suffix> of the backup file by yourself.
-v, --verbose: Prints the name when processing each file/directory.
--help: Display this help message and leave.
--version: Display version information and leave.
Mount
Function
The role of the mount command is to load the file system. Its permissions are superusers or users allowed in /etc/fstab.
2. Format
Mount -a [-fv] [-t vfstype] [-n] [-rw] [-F] device dir
3. Main parameters
-h: Display auxiliary information.
-v: Display information, usually used with -f to debug.
-a: hang all filesystems defined in /etc/fstab.
-F: This command is usually used with -a, which generates a trip for each mount action. It can speed up the loading when the system needs to mount a large number of NFS file systems.
-f: Usually used for debugging. It causes mount to not perform the actual hanging action, but instead simulates the entire hanging process, usually with -v.
-t vfstype: Displays the type of file system being loaded.
-n: Generally speaking, after the mount is mounted, a data will be written in /etc/mtab. If there is no file system available in the system, you can use this option to cancel this action.
4. Application skills
On Linux and Unix systems, all files are accessed as part of a large tree (with / as root). To access a file on a CD-ROM, you need to mount the CD-ROM device at a mount point in the file tree. This step can be automated if the distribution has an automount package installed. In Linux, if you want to use a storage device such as a hard disk or an optical drive, you must first load it. Once the storage device is mounted, you can access it as a directory. Mount a device using the mount command. When using the mount command, at least the following three kinds of information must be known: the file system type of the object to be loaded, the device name of the object to be loaded, and the directory where the device is to be loaded.
(1) File system that Linux can recognize
â—† Windows 95/98 commonly used FAT 32 file system: vfat;
â—† Win NT/2000 file system: ntfs;
â—† File system for OS/2: hpfs;
â—† File system for Linux: ext2, ext3;
â—† File system for CD-ROM: iso9660.
Although vfat refers to the FAT 32 system, it is actually compatible with the FAT 16 file system type.
(2) Determine the name of the device
In Linux, device names are usually stored in /dev. The names of these device names are all regular, and the device name can be found by "reasoning". For example, the /dev/hda1 IDE device, hd is Hard Disk, sd is SCSI Device, and fd is Floppy Device (or Floppy Disk?). a represents the first device, usually the IDE interface can be connected to 4 IDE devices (such as 4 hard drives). So the way to identify the IDE hard drive is hda, hdb, hdc, hdd. The "1" in hda1 represents the first hard disk partition of hda, hda2 represents the second primary partition of hda, the first logical partition starts from hda5, and so on. In addition, you can directly check the /var/log/messages file, where you can find the device ID that the system has recognized after the computer is turned on.
(3) Find the mount point
Before deciding to mount the device, first check to see if the computer has an empty directory of /mnt, which is the directory dedicated to the Mount Point. It is recommended to create several /mnt/cdrom, /mnt/floppy, /mnt/mo directories in /mnt as a dedicated mount point for the directory. For example, if you want to mount the following five devices, the execution instructions may be as follows (assuming all are ext2 systems for Linux, if you are Windows XX, change ext2 to vfat):
Floppy disk===>mount -t ext2 /dev/fd0 /mnt/floppycdrom ===>mount -t iso9660 /dev/hdc /mnt/cdromSCSI cdrom ===>mount -t iso9660 /dev/sdb /mnt/scdromSCSI Cdr ===>mount -t iso9660 /dev/sdc /mnt/scdr
However, most newer Linux distributions (including Red Flag Linux, Medium Soft Linux, Mandrake Linux, etc.) can automatically mount file systems, with the exception of Red Hat Linux.
Umount
Function
The umount command is used to unload a file system. Its usage rights are superusers or users allowed in /etc/fstab.
2. Format
Unmount -a [-fFnrsvw] [-t vfstype] [-n] [-rw] [-F] device dir
3. Instructions for use
The umount command is the inverse of the mount command. Its parameters and usage are the same as the mount command. After Linux mounts the CD-ROM, it locks the CD-ROM so that it cannot be ejected using the Eject button on the CD-ROM panel. However, if the CD is no longer needed, if you have /cdrom as a symbolic link, use umount/cdrom to uninstall it. This command will only succeed if no user is using the disc. This command includes a terminal window that takes the current working directory as a directory on the disc.
Chsh
Function
The purpose of the chsh command is to change the user shell settings, which are used by all users.
2. Format
Chsh [ -s ] [ -list] [ --help ] [ -v ] [ username ]
3. Main parameters
-l: Display all shell types of the system.
-v: Display the shell version number.
4. Application skills
I introduced a variety of shells under Linux. The default is Bash. If you want to replace the shell type, you can use the chsh command. Enter the account password first, then enter the new shell type. If the operation is correct, the system will display "Shell change". The interface is generally as follows:
Changing fihanging shell for caoPassword:New shell [/bin/bash]: /bin/tcsh
In the above code, [ ] is the currently used shell. Ordinary users can only modify their own shells, and superusers can modify the shells of all users. To query which shells are provided by the system, you can use the chsh -l command, as shown in Figure 1.
Figure 1 Shell type that the system can use
As can be seen from Figure 1, the shells that can be used in the author system are bash (default), csh, sh, tcsh.
Exit
Function
The exit command is used to quit the system, and its usage rights are all users.
2. Format
Exit
3. Parameters
The exit command has no parameters. After running, the system exits the login interface.
Last
Function
The role of the last command is to display the login status of recent users or terminals. Its usage rights are all users. By viewing the log of the program with the last command, the administrator can know who has or attempted to connect to the system.
2. Format
1ast[—n][-f file][-t tty] [—h node][-I —IP][-1][-y][1D]
3. Main parameters
-n: Specifies the number of records to be output.
-f file: Specifies the file file as the log file for the query.
-t tty: Displays only the login status on the specified virtual console.
-h node: Displays only the login status on the specified node.
-i IP: Displays only the login on the specified IP.
-1: Use IP to display the remote address.
-y: Displays the year, month, and day of the record.
-ID: Know the username of the query.
-x: Displays the history of system shutdown, user login, and logout.
Hands-on practice
The Linux installation and login commands are described above. Here are a few examples to practice the commands just mentioned.
1. Run multiple commands at once
You can execute multiple commands on a single command line, separating each command with a semicolon, for example:
#last -x;halt
The above code indicates that the computer is shut down after displaying a history of system shutdown, user login, and logout.
2. Use the mount mount file system to access the Windows system
Many Linux distributions now automatically load Vfat partitions to access Windows systems, and Red Hat versions do not automatically load Vfat partitions, so manual operations are required.
Mount can attach a Windows partition as a "file" of Linux to an empty folder on Linux, thus linking the Windows partition to the /mnt directory. Therefore, just accessing this folder is equivalent to accessing the partition. First create the winc folder under /mnt and type the following at the command prompt:
#mount -t vfat /dev/hda1 /mnt/winc
This means that the C partition of Windows is hung in the /mnt/winc directory of Liunx. At this time, you can see the contents of the C drive in Windows in the /mnt/winc directory. Use a similar method to access the D and E disks of the Windows system. In Linux, Windows partitions are generally displayed in the following order: hda1 is C drive, hda5 is D drive, hda6 is E drive, and so on. The above method can be viewed in Windows system has a big problem, that is, all Chinese file names or folder names in Windows are displayed as question mark "?", but English can be displayed normally. We can show it in Chinese by adding some parameters. Taking the above operation as an example, enter the command at this time:
#mount -t vfat -o iocharset=cp936 /dev/hda1 /mnt/winc
Now it can display Chinese normally.
3. Use mount to mount the file system on the flash drive
Using a flash drive under Linux is very simple. Linux has good support for USB devices. When a flash drive is inserted, the flash drive is recognized as a SCSI disk. Usually enter the following command:
# mount /dev/sda1 /usb
It is possible to add a file system on the flash drive.
tips
Linux commands and shell
The so-called shell is the command interpreter, which provides a programming interface that can be programmed using a program. Learning Shell is very important for Linux beginners to understand Linux systems. The shell of the Linux system acts as the shell of the operating system and provides the user with an interface to use the operating system. Shell is a general term for command language, command interpreter, and programming language. It is an interface program between the user and the Linux kernel. If you think of the Linux kernel as the center of a sphere, the shell is the outer layer around the kernel. When you pass commands from Shell or other programs to Linux, the kernel reacts accordingly. The role of Shell in Linux systems is similar to COMMAND.COM under MS DOS and explorer.exe for Windows 95/98. Although Shell is not part of the system core, it is just an extension of the system core, but it can call most of the functions of the system kernel. Therefore, it can be said that Shell is the most important utility of Unux/Linux.
There are many types of shells in Linux, the most common of which are Bourne Shell (sh), C Shell (csh), and Korn Shell (ksh). The default shell for most Linux distributions is the Bourne Again Shell, which is an extension of the Bourne Shell, bash for short, fully backwards compatible with the Bourne Shell, and adds many features to the Bourne Shell. Bash is placed in /bin/bash and provides functions such as command completion, command editing, and command history tables. It also includes many of the advantages of the C Shell and Korn Shell, with a flexible and powerful programming interface, and a very user-friendly interface. 40 of the more than 200 commands in the Linux system are internal commands of bash, including exit, less, lp, kill, cd, pwd, fc, fg, etc.
60 commands that Linux must learn (2) - file processing commands
Linux system information is stored in a file similar to a normal business file. Each file has its own name, content, storage address, and other management information, such as the user of the file, the size of the file, and so on. A file can be a letter, an address book, or a source statement of a program, program data, or even executable programs and other non-text content. The Linux file system has a good structure and the system provides many file handlers. Here are the main commonly used file processing commands.
File
1. The content of the action piece determines the file type, and the usage rights are all users.
2. Format
File through probe text
File [options] filename
3.[options] main parameters
-v: Displays version information after standard output and exits.
-z: Detects compressed file types.
-L: Allows the connection to be met.
-f name: Reads the list of file names to be parsed from the file namefile.
4. Brief description
Use the file command to know whether a file is a binary (ELF format) executable, a Shell Script file, or something else. File types that can be recognized by file include directory, shell script, English text, binary executable file, C language source file, text file, and DOS executable file.
5. Application examples
If we see a file grap without a suffix, we can use the following command:
$ file grap
Grap: English text
At this point the system shows that this is an English text file. It should be noted that the file command cannot detect multimedia file types including graphics, audio, video, and so on.
Mkdir
Function
The mkdir command is used to create a subdirectory named dirname, similar to the md command under MS DOS. Its usage rights are all users.
2. Format
Mkdir [options] directory name
3.[options] main parameters
-m, --mode= mode: Set the permission <mode>, similar to chmod.
-p, --parents: Create the upper directory if needed; if the directory already exists, it is not considered an error.
-v, --verbose: Displays information each time a new directory is created.
--version: Leave after displaying the version information.
4. Application examples
You can set the permissions of the directory when creating the directory. The parameter used here is "-m". Assuming the directory name to be created is "tsk", so that all users have rwx (ie read, write, execute permissions), then you can use the following command:
$ mkdir -m 777 tsk
Grep
Function
The grep command can specify a file to search for specific content and output the line containing the content as standard. The full name of grep is Global Regular Expression Print, which represents the global regular expression version, and its usage rights are for all users.
2. Format
Grep [options]
3. Main parameters
[options] main parameters:
-c: Output only the count of matching rows.
-I: Not case sensitive (only for single characters).
-h: Do not display the file name when querying multiple files.
-l: When querying multiple files, only the file name containing the matching characters is output.
-n: Display matching lines and line numbers.
-s: Do not display error messages that do not exist or have no matching text.
-v: Displays all lines that do not contain matching text.
Pattern regular expression main parameters:
/: Ignores the original meaning of special characters in regular expressions.
^: Matches the start line of the regular expression.
$: matches the end line of the regular expression.
/<: Starts with a line that matches the regular expression.
/>: Ends the line that matches the regular expression.
[ ]: A single character, such as [A] that A meets the requirements.
[ - ]: Range, such as [AZ], that is, A, B, C all the way to Z meet the requirements.
. : All single characters.
* : There are characters and the length can be 0.
Regular expressions are a very important concept in Linux/Unix systems. A regular expression (also known as "regex" or "regexp") is a pattern that can describe a type of string. If a string can be described by a regular expression, we say that the character matches the regular expression (Match). This is similar to the use of the wildcard "*" for any character in DOS. On Linux systems, regular expressions are often used to find patterns in text, as well as perform "search-replace" operations and other functions on text.
4. Application examples
Querying the DNS service is one of the daily tasks, which means maintaining a large number of IP addresses covering different networks. Sometimes the IP address will exceed 2000. If you want to look at the nnn.nnn network address, but forget the rest of the second part, you only know that there are two periods, such as nnn nn.. To extract all of the nnn.nnn IP addresses, use [0-9 ]/{3 /}/.[0-0/{3/}/. The meaning is that any number appears 3 times, followed by a period, followed by any number 3 times, followed by a period.
$grep '[0-9 ]/{3 /}/.[0-0/{3/}/' ipfile
In addition, the grep family also includes fgrep and egrep. Fgrep is fix grep, which allows you to find strings instead of a pattern; egrep is an extended grep that supports basic and extended regular expressions, but does not support /q mode-scoped applications and some of the more standard patterns that correspond to them.
Dd
Function
The dd command is used to copy files and convert and format the data according to parameters.
2. Format
Dd [options]
3.[opitions] main parameters
Bs=byte: Force ibs=<byte> and obs=<byte>.
Cbs=byte: The specified <byte> is converted each time.
Conv=keyword: Convert files according to the way comma-separated keywords are represented.
Count=number of blocks: Only the input data of the specified <number of blocks> is copied.
Ibs=byte: Reads the specified <byte> each time.
If= file: Read <file> content instead of standard input data.
Obs=byte: Writes the specified <byte> each time.
Of=File: Write data to <file> instead of standard output.
Seek=number of blocks: The output data of the specified <number of blocks> in obs is skipped first.
Skip=Number of blocks: The input data of the specified <number of blocks> in ibs is skipped first.
4. Application examples
The dd command is often used to make Linux boot disks. First find a bootable kernel, point its root device to the correct root partition, and then write it to the floppy disk using the dd command:
$ rdev vmlinuz /dev/hda
$dd if=vmlinuz of=/dev/fd0
The above code shows that use the rdev command to point the root device in the bootable kernel vmlinuz to /dev/hda, please replace "hda" with its own root partition, and then use the dd command to write the kernel to the floppy disk.
Find
Function
The function of the find command is to search for files in the directory. Its usage rights are all users.
2. Format
Find [path][options][expression]
Path specifies the directory path from which the system looks down the file along the directory tree. It is a list of paths separated from each other by spaces. If you do not write path, the default is the current directory.
3. Main parameters
[options] parameters:
-depth: Use the depth level search process to find the file content first in a specified directory on a certain layer.
-maxdepth levels: Indicates that at most the level level subdirectory of the start directory is found. Level is a non-negative number. If level is 0, it means only looking in the current directory.
-mindepth levels: indicates that at least the level level subdirectory of the start directory is found.
-mount: Do not look in directories and files of other file systems (such as Msdos, Vfat, etc.).
-version: Print version.
[expression] is a matching expression, which is an expression accepted by the find command. All operations of the find command are for expressions. It has a lot of parameters, only some common parameters are introduced here.
—name: Supports the wildcards * and ?.
-atime n: Search for files that have been read in the past n days.
-ctime n: Search for files that have been modified in the past n days.
-group grpoupname: Search all files whose group is grpoupname.
-user username: Search for files whose owner is the username (ID or name).
-size n: Search for files whose file size is n blocks.
-print: Output search results and print.
4. Application skills
The find command finds several ways to find a file:
(1) Find by file name
For example, we want to find a file whose file name is lilo.conf. You can use the following command:
Find / -name lilo.conf
The "/" after the find command means searching the entire hard disk.
(2) Quickly find files
Finding a file based on the file name has a real problem, which is a considerable amount of time, especially when large Linux file systems and large hard disk files are placed in deep subdirectories. If we know that this file is stored in a directory, then looking down in this directory can save a lot of time. For example, the smb.conf file, from its file suffix ".conf" can be judged that this is a configuration file, then it should be in the /etc directory, you can use the following command:
Find /etc -name smb.conf
This way, you can use the "quick find files" method to reduce the time.
(3) Find method based on partial file name
Sometimes we know that only a file contains the 4 words abvd, then to find all the files in the system that contain these 4 characters, you can enter the following command:
Find / -name '*abvd*'
After entering this command, the Linux system will find all the files containing the abvd 4 characters (where * is a wildcard) in the / directory, such as abvdrmyz and other eligible files can be displayed.
(4) Find files using hybrid lookup
The find command can use a hybrid lookup method. For example, if we want to find a file larger than 500000 bytes in the /etc directory and modify it within 24 hours, we can use -and to link the two lookup parameters. Synthesize a mixed lookup.
Find /etc -size +500000c -and -mtime +1
Mv
Function
The mv command is used to rename a file or directory, or to move a file from one directory to another. Its usage rights are all users. This command is like the combination of ren and move in a DOS command.
2. Format
Mv[options] source file or directory object file or directory
3.[options] main parameters
-i: Interactive mode operation. If the mv operation will result in an overwriting of the existing target file, the system asks whether to rewrite, and asks the user to answer "y" or "n", so as to avoid accidentally overwriting the file.
-f: Disable interworking. The mv operation does not give any indication when it wants to overwrite an existing target file. After this parameter is specified, the i parameter will no longer work.
4. Application examples
(1) Move all files in /usr/cbu to the current directory (indicated by "."):
$ mv /usr/cbu/ * .
(2) Rename the file cjh.txt to wjz.txt:
$ mv cjh.txt wjz.txt
Ls
Function
The ls command is used to display the contents of the directory, similar to the dir command under DOS, and its usage rights are all users.
2. Format
Ls [options][filename]
3.options main parameters
-a, --all: Do not hide any items starting with the "." character.
-A, --almost-all: Lists any items except "." and "..".
--author: Print out each file author.
-b, --escape: Indicates unprintable characters in an octal overflow sequence.
--block-size=Size: The block is in bytes of the specified <size>.
-B, --ignore-backups: Does not list any items that end with a ~ character.
-f: Do not sort, the -aU parameter takes effect, and the -lst parameter fails.
-F, --classify: Add an indicator for the file type (*/=@| one of them).
-g:like -l, but do not list owner.
-G, --no-group:inhibit display of group information.
-i, --inode: Lists the inode number of each file.
-I, --ignore=Style: Do not print any items that match the Shell universal character <style>.
-k: ie --block-size=1K.
-l: Lists information in a longer format.
-L, --dereference: When the file information of the symbolic link is displayed, the object indicated by the symbolic link is displayed instead of the information of the symbolic link itself.
-m: All items are separated by commas and fill the entire line width.
-n, --numeric-uid-gid: Similar to -l, but lists UID and GID numbers.
-N, --literal: Lists unprocessed project names, such as no special handling of control characters.
-p, --file-type: Add an indicator for the file type (/=@| one of them).
-Q, --quote-name: Enclose the project name in double quotes.
-r, --reverse: Arrange in reverse order.
-R, --recursive: List all subdirectory layers at the same time.
-s, --size: in block order.
4. Application examples
The ls command is the most frequently used command in Linux systems, and its parameters are the most common in Linux commands. There are several different colors when using the ls command, where blue indicates a directory, green indicates an executable file, red indicates a compressed file, light blue indicates a link file, bold black indicates a symbolic link, and gray indicates Is a different format file. The most commonly used ls is ls-l, as shown in Figure 1.
Figure 1 Using the ls-l command
The file type begins with a string of 10 characters. The first character represents the file type, which can be one of the following types: - (plain file), d (directory), l (symbolic link), b (block device file), c (character device file). The next 9 characters indicate the access rights of the file, divided into 3 groups of 3 bits each. The first group represents the permissions of the owner of the file, the second group represents the permissions of the same group of users, and the third group represents the permissions of other users. The three characters of each group represent the read (r), write (w), and execute permission (x) of the file. For directories, indicates access rights. s indicates that when the file is executed, the UID or GID of the file is assigned to the UID (User ID) or GID (Group ID) of the execution process. t indicates the setting flag (left in memory, not swapped out). If the file is a directory, files in that directory can only be deleted by the superuser, directory owner, or file owner. If it is an executable file, the pointer to its body segment remains in memory after the file is executed. When you execute it again, the system can load the file faster. The file size, build time, file or command name is then displayed.
Diff
Function
The diff command is used to compare between two files and points out the difference between the two, and its usage rights are all users.
2. Format
Diff [options] source file object file
3.[options] main parameters
-a: Treat all files as text files.
-b: Ignore the difference caused by spaces.
-B: Ignore the difference caused by blank lines.
-c: Use the outline output format.
-H: Use heuristics to speed up searches for large files.
-I: Ignore case changes.
-n --rcs: Outputs the RCS format.
Cmp
Function
The cmp (short for "compare") command is used to briefly indicate whether there is a difference between two files, and its usage rights are all users.
2. Format
Cmp[options] filename
3.[options] main parameters
-l: å°†å—节以å进制的方å¼è¾“出,并方便将两个文件ä¸ä¸åŒçš„以八进制的方å¼è¾“出。
cat
1.作用
cat(“concatenateâ€çš„缩写)命令用于连接并显示指定的一个和多个文件的有关信æ¯ï¼Œå®ƒçš„使用æƒé™æ˜¯æ‰€æœ‰ç”¨æˆ·ã€‚
2.æ ¼å¼
cat [options] 文件1 文件2……
3.[options]主è¦å‚æ•°
ï¼n:由第一行开始对所有输出的行数编å·ã€‚
ï¼b:和ï¼n相似,åªä¸è¿‡å¯¹äºŽç©ºç™½è¡Œä¸ç¼–å·ã€‚
ï¼s:当é‡åˆ°æœ‰è¿žç»ä¸¤è¡Œä»¥ä¸Šçš„空白行时,就代æ¢ä¸ºä¸€è¡Œçš„空白行。
4.应用举例
(1)cat命令一个最简å•çš„用处是显示文本文件的内容。例如,我们想在命令行看一下README文件的内容,å¯ä»¥ä½¿ç”¨å‘½ä»¤ï¼š
$ cat README
(2)有时需è¦å°†å‡ 个文件处ç†æˆä¸€ä¸ªæ–‡ä»¶ï¼Œå¹¶å°†è¿™ç§å¤„ç†çš„结果ä¿å˜åˆ°ä¸€ä¸ªå•ç‹¬çš„输出文件。cat命令在其输入上接å—一个或多个文件,并将它们作为一个å•ç‹¬çš„文件打å°åˆ°å®ƒçš„输出。例如,把READMEå’ŒINSTALLçš„æ–‡ä»¶å†…å®¹åŠ ä¸Šè¡Œå·ï¼ˆç©ºç™½è¡Œä¸åŠ )之åŽï¼Œå°†å†…å®¹é™„åŠ åˆ°ä¸€ä¸ªæ–°æ–‡æœ¬æ–‡ä»¶File1 ä¸ï¼š
$ cat README INSTALL File1
(3)cat还有一个é‡è¦çš„功能就是å¯ä»¥å¯¹è¡Œè¿›è¡Œç¼–å·ï¼Œè§å›¾2所示。这ç§åŠŸèƒ½å¯¹äºŽç¨‹åºæ–‡æ¡£çš„编制,以åŠæ³•å¾‹å’Œç§‘å¦æ–‡æ¡£çš„编制很方便,打å°åœ¨å·¦è¾¹çš„è¡Œå·ä½¿å¾—å‚考文档的æŸä¸€éƒ¨åˆ†å˜å¾—容易,这些在编程ã€ç§‘å¦ç ”究ã€ä¸šåŠ¡æŠ¥å‘Šç”šè‡³æ˜¯ç«‹æ³•å·¥ä½œä¸éƒ½æ˜¯éžå¸¸é‡è¦çš„。
图2 使用cat命令/etc/named.conf文件进行编å·
对行进行编å·åŠŸèƒ½æœ‰-b(åªèƒ½å¯¹éžç©ºç™½è¡Œè¿›è¡Œç¼–å·ï¼‰å’Œ-n(å¯ä»¥å¯¹æ‰€æœ‰è¡Œè¿›è¡Œç¼–å·ï¼‰ä¸¤ä¸ªå‚数:
$ cat -b /etc/named.conf
ln
1.作用
ln命令用æ¥åœ¨æ–‡ä»¶ä¹‹é—´åˆ›å»ºé“¾æŽ¥ï¼Œå®ƒçš„使用æƒé™æ˜¯æ‰€æœ‰ç”¨æˆ·ã€‚
2.æ ¼å¼
ln [options] æºæ–‡ä»¶[链接å]
3.å‚æ•°
ï¼f:链结时先将æºæ–‡ä»¶åˆ 除。
ï¼d:å…许系统管ç†è€…硬链结自己的目录。
ï¼s:进行软链结(Symbolic Link)。
ï¼bï¼šå°†åœ¨é“¾ç»“æ—¶ä¼šè¢«è¦†ç›–æˆ–åˆ é™¤çš„æ–‡ä»¶è¿›è¡Œå¤‡ä»½ã€‚
链接有两ç§ï¼Œä¸€ç§è¢«ç§°ä¸ºç¡¬é“¾æŽ¥ï¼ˆHard Link),å¦ä¸€ç§è¢«ç§°ä¸ºç¬¦å·é“¾æŽ¥ï¼ˆSymbolic Link)。默认情况下,ln命令产生硬链接。
硬连接指通过索引节点æ¥è¿›è¡Œçš„连接。在Linux的文件系统ä¸ï¼Œä¿å˜åœ¨ç£ç›˜åˆ†åŒºä¸çš„文件ä¸ç®¡æ˜¯ä»€ä¹ˆç±»åž‹éƒ½ç»™å®ƒåˆ†é…一个编å·ï¼Œç§°ä¸ºç´¢å¼•èŠ‚点å·(Inode Index)。在Linuxä¸ï¼Œå¤šä¸ªæ–‡ä»¶å指å‘åŒä¸€ç´¢å¼•èŠ‚点是å˜åœ¨çš„。一般这ç§è¿žæŽ¥å°±æ˜¯ç¡¬è¿žæŽ¥ã€‚硬连接的作用是å…许一个文件拥有多个有效路径åï¼Œè¿™æ ·ç”¨æˆ·å°±å¯ä»¥å»ºç«‹ç¡¬è¿žæŽ¥åˆ°é‡è¦æ–‡ä»¶ï¼Œä»¥é˜²æ¢â€œè¯¯åˆ â€çš„åŠŸèƒ½ã€‚å…¶åŽŸå› å¦‚ä¸Šæ‰€è¿°ï¼Œå› ä¸ºå¯¹åº”è¯¥ç›®å½•çš„ç´¢å¼•èŠ‚ç‚¹æœ‰ä¸€ä¸ªä»¥ä¸Šçš„è¿žæŽ¥ã€‚åªåˆ 除一个连接并ä¸å½±å“索引节点本身和其它的连接,åªæœ‰å½“最åŽä¸€ä¸ªè¿žæŽ¥è¢«åˆ 除åŽï¼Œæ–‡ä»¶çš„æ•°æ®å—åŠç›®å½•çš„连接æ‰ä¼šè¢«é‡Šæ”¾ã€‚也就是说,文件æ‰ä¼šè¢«çœŸæ£åˆ 除。
与硬连接相对应,Lnux系统ä¸è¿˜å˜åœ¨å¦ä¸€ç§è¿žæŽ¥ï¼Œç§°ä¸ºç¬¦å·è¿žæŽ¥ï¼ˆSymbilc Link),也å«è½¯è¿žæŽ¥ã€‚软链接文件有点类似于Windowsçš„å¿«æ·æ–¹å¼ã€‚它实际上是特殊文件的一ç§ã€‚在符å·è¿žæŽ¥ä¸ï¼Œæ–‡ä»¶å®žé™…上是一个文本文件,其ä¸åŒ…å«çš„有å¦ä¸€æ–‡ä»¶çš„ä½ç½®ä¿¡æ¯ã€‚
动手练ä¹
上é¢æˆ‘们介ç»äº†Linux文件处ç†å‘½ä»¤ï¼Œä¸‹é¢ä»‹ç»å‡ 个实例,大家å¯ä»¥åŠ¨æ‰‹ç»ƒä¹ 一下刚æ‰è®²è¿‡çš„命令。
1.利用符å·é“¾æŽ¥å¿«é€Ÿè®¿é—®å…³é”®ç›®å½•
符å·é“¾æŽ¥æ˜¯ä¸€ä¸ªéžå¸¸å®žç”¨çš„功能。å‡è®¾æœ‰ä¸€äº›ç›®å½•æˆ–文件需è¦é¢‘ç¹ä½¿ç”¨ï¼Œä½†ç”±äºŽLinux的文件和目录结构ç‰åŽŸå› ,这个文件或目录在很深的å目录ä¸ã€‚比如, Apache WebæœåŠ¡å™¨æ–‡æ¡£ä½äºŽç³»ç»Ÿçš„/usr/local/httpd/htdocsä¸ï¼Œå¹¶ä¸”ä¸æƒ³æ¯æ¬¡éƒ½è¦ä»Žä¸»ç›®å½•è¿›å…¥è¿™æ ·ä¸€ä¸ªé•¿çš„路径之ä¸(实际上,这个路径也éžå¸¸ä¸å®¹æ˜“记忆)。
为了解决这个问题,å¯ä»¥åœ¨ä¸»ç›®å½•ä¸åˆ›å»ºä¸€ä¸ªç¬¦å·é“¾æŽ¥ï¼Œè¿™æ ·åœ¨éœ€è¦è¿›å…¥è¯¥ç›®å½•æ—¶ï¼Œåªéœ€è¿›å…¥è¿™ä¸ªé“¾æŽ¥å³å¯ã€‚
为了能方便地进入WebæœåŠ¡å™¨(/usr/local/httpd/htdocs)文档所在的目录,在主目录下å¯ä»¥ä½¿ç”¨ä»¥ä¸‹å‘½ä»¤ï¼š
$ ln -s /usr/local/httpd/htdocs gg
è¿™æ ·æ¯æ¬¡è¿›å…¥gg目录就å¯è®¿é—®WebæœåŠ¡å™¨çš„文档,以åŽå¦‚æžœä¸å†è®¿é—®WebæœåŠ¡å™¨çš„æ–‡æ¡£æ—¶ï¼Œåˆ é™¤ggå³å¯ï¼Œè€ŒçœŸæ£çš„WebæœåŠ¡å™¨çš„æ–‡æ¡£å¹¶æ²¡æœ‰åˆ é™¤ã€‚
2.使用dd命令将init.rdæ ¼å¼çš„root.ram内容导入内å˜
dd if=/dev/fd0 of=floppy.fd
dd if=root.ram of=/dev/ram0 #
3.grep命令系统调用
grep是Linux/Unixä¸ä½¿ç”¨æœ€å¹¿æ³›çš„命令之一,许多Linux系统内部都å¯ä»¥è°ƒç”¨å®ƒã€‚
(1)如果è¦æŸ¥è¯¢ç›®å½•åˆ—表ä¸çš„目录,方法如下:
$ ls -l | grep '∧d'
(2)如果在一个目录ä¸æŸ¥è¯¢ä¸åŒ…å«ç›®å½•çš„所有文件,方法如下:
$ ls -l | grep '∧[∧d]'
(3)用find命令调用grep,如所有Cæºä»£ç ä¸çš„“Chinputâ€ï¼Œæ–¹æ³•å¦‚下:
$find /ZhXwin -name *.c -exec grep -q -s Chinput {} /;-print
Linuxå¿…å¦çš„60个命令(3)-系统管ç†å‘½ä»¤
对于Linux系统æ¥è¯´ï¼Œæ— 论是ä¸å¤®å¤„ç†å™¨ã€å†…å˜ã€ç£ç›˜é©±åŠ¨å™¨ã€é”®ç›˜ã€é¼ æ ‡ï¼Œè¿˜æ˜¯ç”¨æˆ·ç‰éƒ½æ˜¯æ–‡ä»¶ï¼ŒLinux系统管ç†çš„命令是它æ£å¸¸è¿è¡Œçš„æ ¸å¿ƒã€‚ç†Ÿæ‚‰äº†Linux常用的文件处ç†å‘½ä»¤ä»¥åŽï¼Œè¿™ä¸€è®²ä»‹ç»å¯¹ç³»ç»Ÿå’Œç”¨æˆ·è¿›è¡Œç®¡ç†çš„命令。
df
1.作用df命令用æ¥æ£€æŸ¥æ–‡ä»¶ç³»ç»Ÿçš„ç£ç›˜ç©ºé—´å 用情况,使用æƒé™æ˜¯æ‰€æœ‰ç”¨æˆ·ã€‚
2.æ ¼å¼df [options]
3.主è¦å‚æ•°ï¼s:对æ¯ä¸ªNameså‚æ•°åªç»™å‡ºå 用的数æ®å—总数。ï¼a:递归地显示指定目录ä¸å„文件åŠå目录ä¸å„文件å 用的数æ®å—数。若既ä¸æŒ‡å®šï¼s,也ä¸æŒ‡å®šï¼a,则åªæ˜¾ç¤ºNamesä¸çš„æ¯ä¸€ä¸ªç›®å½•åŠå…¶ä¸çš„å„å目录所å çš„ç£ç›˜å—数。ï¼k:以1024å—节为å•ä½åˆ—出ç£ç›˜ç©ºé—´ä½¿ç”¨æƒ…况。ï¼x:跳过在ä¸åŒæ–‡ä»¶ç³»ç»Ÿä¸Šçš„目录ä¸äºˆç»Ÿè®¡ã€‚ï¼l:计算所有的文件大å°ï¼Œå¯¹ç¡¬é“¾æŽ¥æ–‡ä»¶åˆ™è®¡ç®—多次。ï¼i:显示inodeä¿¡æ¯è€Œéžå—使用é‡ã€‚ï¼h:以容易ç†è§£çš„æ ¼å¼å°å‡ºæ–‡ä»¶ç³»ç»Ÿå¤§å°ï¼Œä¾‹å¦‚136KBã€254MBã€21GB。ï¼P:使用POSIXè¾“å‡ºæ ¼å¼ã€‚ï¼T:显示文件系统类型。
4.说明df命令被广泛地用æ¥ç”Ÿæˆæ–‡ä»¶ç³»ç»Ÿçš„使用统计数æ®ï¼Œå®ƒèƒ½æ˜¾ç¤ºç³»ç»Ÿä¸æ‰€æœ‰çš„文件系统的信æ¯ï¼ŒåŒ…括总容é‡ã€å¯ç”¨çš„空闲空间ã€ç›®å‰çš„安装点ç‰ã€‚
超级æƒé™ç”¨æˆ·ä½¿ç”¨df命令时会å‘çŽ°è¿™æ ·çš„æƒ…å†µï¼šæŸä¸ªåˆ†åŒºçš„容é‡è¶…过了100ï¼…ã€‚è¿™æ˜¯å› ä¸ºLinux系统为超级用户ä¿ç•™äº†10%的空间,由其å•ç‹¬æ”¯é…。也就是说,对于超级用户而言,他所è§åˆ°çš„硬盘容é‡å°†æ˜¯110ï¼…ã€‚è¿™æ ·çš„å®‰æŽ’å¯¹äºŽç³»ç»Ÿç®¡ç†è€Œè¨€æ˜¯æœ‰å¥½å¤„的,当硬盘被使用的容é‡æŽ¥è¿‘100%时系统管ç†å‘˜è¿˜å¯ä»¥æ£å¸¸å·¥ä½œã€‚
5.应用实例Linux支æŒçš„文件系统éžå¸¸å¤šï¼ŒåŒ…括JFSã€ReiserFSã€extã€ext2ã€ext3ã€ISO9660ã€XFSã€Minxã€vfatã€MSDOSç‰ã€‚使用df -T命令查看ç£ç›˜ç©ºé—´æ—¶è¿˜å¯ä»¥å¾—到文件系统的信æ¯ï¼š
#df ï¼T文件系统类型容é‡å·²ç”¨å¯ç”¨å·²ç”¨% 挂载点/dev/hda7 reiserfs 5.2G 1.6G 3.7G 30% //dev/hda1 vfat 2.4G 1.6G 827M 66% /windows/C/dev/hda5 vfat 3.0G 1.7G 1.3G 57% /windows/D/dev/hda9 vfat 3.0G 2.4G 566M 82% /windows/E/dev/hda10 NTFS 3.2G 573M 2.6G 18% /windows/F/dev/hda11 vfat 1.6G 1.5G 23M 99% /windows/G
从上é¢é™¤äº†å¯ä»¥çœ‹åˆ°ç£ç›˜ç©ºé—´çš„容é‡ã€ä½¿ç”¨æƒ…况外,分区的文件系统类型ã€æŒ‚载点ç‰ä¿¡æ¯ä¹Ÿä¸€è§ˆæ— é—。
top
1.作用top命令用æ¥æ˜¾ç¤ºæ‰§è¡Œä¸çš„程åºè¿›ç¨‹ï¼Œä½¿ç”¨æƒé™æ˜¯æ‰€æœ‰ç”¨æˆ·ã€‚
2.æ ¼å¼top [ï¼] [d delay] [q] [c] [S] [s] [i] [n]
3.主è¦å‚æ•°d:指定更新的间隔,以秒计算。q:没有任何延迟的更新。如果使用者有超级用户,则top命令将会以最高的优先åºæ‰§è¡Œã€‚c:显示进程完整的路径与å称。S:累积模å¼ï¼Œä¼šå°†å·±å®Œæˆæˆ–消失的å行程的CPU时间累积起æ¥ã€‚s:安全模å¼ã€‚i:ä¸æ˜¾ç¤ºä»»ä½•é—²ç½®(Idle)æˆ–æ— ç”¨(Zombie)的行程。n:显示更新的次数,完æˆåŽå°†ä¼šé€€å‡ºtop。
4.说明top命令是Linux系统管ç†çš„一个主è¦å‘½ä»¤ï¼Œé€šè¿‡å®ƒå¯ä»¥èŽ·å¾—许多信æ¯ã€‚这里我们结åˆå›¾1æ¥è¯´æ˜Žå®ƒç»™å‡ºçš„ä¿¡æ¯ã€‚
图1 top命令的显示
在图1ä¸ï¼Œç¬¬ä¸€è¡Œè¡¨ç¤ºçš„项目ä¾æ¬¡ä¸ºå½“å‰æ—¶é—´ã€ç³»ç»Ÿå¯åŠ¨æ—¶é—´ã€å½“å‰ç³»ç»Ÿç™»å½•ç”¨æˆ·æ•°ç›®ã€å¹³å‡è´Ÿè½½ã€‚第二行显示的是所有å¯åŠ¨çš„进程ã€ç›®å‰è¿è¡Œçš„ã€æŒ‚èµ·(Sleeping)çš„å’Œæ— ç”¨(Zombie)的进程。第三行显示的是目å‰CPU的使用情况,包括系统å 用的比例ã€ç”¨æˆ·ä½¿ç”¨æ¯”例ã€é—²ç½®(Idle)比例。第四行显示物ç†å†…å˜çš„使用情况,包括总的å¯ä»¥ä½¿ç”¨çš„内å˜ã€å·²ç”¨å†…å˜ã€ç©ºé—²å†…å˜ã€ç¼“冲区å 用的内å˜ã€‚第五行显示交æ¢åˆ†åŒºä½¿ç”¨æƒ…况,包括总的交æ¢åˆ†åŒºã€ä½¿ç”¨çš„ã€ç©ºé—²çš„和用于高速缓å˜çš„大å°ã€‚第å…行显示的项目最多,下é¢åˆ—出了详细解释。PID(Process IDï¼‰ï¼šè¿›ç¨‹æ ‡ç¤ºå·ã€‚USER:进程所有者的用户å。PR:进程的优先级别。NI:进程的优先级别数值。VIRT:进程å 用的虚拟内å˜å€¼ã€‚RES:进程å 用的物ç†å†…å˜å€¼ã€‚SHR:进程使用的共享内å˜å€¼ã€‚S:进程的状æ€ï¼Œå…¶ä¸Sè¡¨ç¤ºä¼‘çœ ï¼ŒR表示æ£åœ¨è¿è¡Œï¼ŒZ表示僵æ»çŠ¶æ€ï¼ŒN表示该进程优先值是负数。%CPU:该进程å 用的CPU使用率。%MEM:该进程å 用的物ç†å†…å˜å’Œæ€»å†…å˜çš„百分比。TIME+:该进程å¯åŠ¨åŽå 用的总的CPU时间。Command:进程å¯åŠ¨çš„å¯åŠ¨å‘½ä»¤å称,如果这一行显示ä¸ä¸‹ï¼Œè¿›ç¨‹ä¼šæœ‰ä¸€ä¸ªå®Œæ•´çš„命令行。top命令使用过程ä¸ï¼Œè¿˜å¯ä»¥ä½¿ç”¨ä¸€äº›äº¤äº’的命令æ¥å®Œæˆå…¶å®ƒå‚数的功能。这些命令是通过快æ·é”®å¯åŠ¨çš„。<ç©ºæ ¼>:立刻刷新。Pï¼šæ ¹æ®CPU使用大å°è¿›è¡ŒæŽ’åºã€‚Tï¼šæ ¹æ®æ—¶é—´ã€ç´¯è®¡æ—¶é—´æŽ’åºã€‚q:退出top命令。m:切æ¢æ˜¾ç¤ºå†…å˜ä¿¡æ¯ã€‚t:切æ¢æ˜¾ç¤ºè¿›ç¨‹å’ŒCPU状æ€ä¿¡æ¯ã€‚c:切æ¢æ˜¾ç¤ºå‘½ä»¤å称和完整命令行。Mï¼šæ ¹æ®ä½¿ç”¨å†…å˜å¤§å°è¿›è¡ŒæŽ’åºã€‚W:将当å‰è®¾ç½®å†™å…¥~/.toprc文件ä¸ã€‚这是写topé…置文件的推è方法。
å¯ä»¥çœ‹åˆ°ï¼Œtop命令是一个功能å分强大的监控系统的工具,对于系统管ç†å‘˜è€Œè¨€å°¤å…¶é‡è¦ã€‚但是,它的缺点是会消耗很多系统资æºã€‚
5.应用实例使用top命令å¯ä»¥ç›‘视指定用户,缺çœæƒ…况是监视所有用户的进程。如果想查看指定用户的情况,在终端ä¸æŒ‰â€œUâ€é”®ï¼Œç„¶åŽè¾“入用户å,系统就会切æ¢ä¸ºæŒ‡å®šç”¨æˆ·çš„进程è¿è¡Œç•Œé¢ï¼Œè§å›¾2所示。
图2 使用top命令监视指定用户
free
1.作用free命令用æ¥æ˜¾ç¤ºå†…å˜çš„使用情况,使用æƒé™æ˜¯æ‰€æœ‰ç”¨æˆ·ã€‚
2.æ ¼å¼free [ï¼b|ï¼k|ï¼m] [ï¼o] [ï¼s delay] [ï¼t] [ï¼V]
3.主è¦å‚æ•°ï¼b ï¼k ï¼m:分别以å—节(KBã€MB)为å•ä½æ˜¾ç¤ºå†…å˜ä½¿ç”¨æƒ…况。ï¼s delay:显示æ¯éš”多少秒数æ¥æ˜¾ç¤ºä¸€æ¬¡å†…å˜ä½¿ç”¨æƒ…况。ï¼t:显示内å˜æ€»å’Œåˆ—。ï¼o:ä¸æ˜¾ç¤ºç¼“冲区调节列。
4.应用实例free命令是用æ¥æŸ¥çœ‹å†…å˜ä½¿ç”¨æƒ…况的主è¦å‘½ä»¤ã€‚å’Œtop命令相比,它的优点是使用简å•ï¼Œå¹¶ä¸”åªå 用很少的系统资æºã€‚通过ï¼Så‚æ•°å¯ä»¥ä½¿ç”¨free命令ä¸é—´æ–地监视有多少内å˜åœ¨ä½¿ç”¨ï¼Œè¿™æ ·å¯ä»¥æŠŠå®ƒå½“作一个方便实时监控器。#free ï¼b ï¼s5
使用这个命令åŽç»ˆç«¯ä¼šè¿žç»ä¸æ–地报告内å˜ä½¿ç”¨æƒ…况(以å—节为å•ä½ï¼‰ï¼Œæ¯5秒更新一次。
quota
1.作用quota命令用æ¥æ˜¾ç¤ºç£ç›˜ä½¿ç”¨æƒ…况和é™åˆ¶æƒ…况,使用æƒé™è¶…级用户。
2.æ ¼å¼quota [ï¼g][ï¼u][ï¼v][ï¼p] 用户å组å
3.å‚æ•°ï¼g:显示用户所在组的ç£ç›˜ä½¿ç”¨é™åˆ¶ã€‚ï¼u:显示用户的ç£ç›˜ä½¿ç”¨é™åˆ¶ã€‚ï¼v:显示没有分é…空间的文件系统的分é…情况。ï¼p:显示简化信æ¯ã€‚
4.应用实例在ä¼ä¸šåº”用ä¸ç£ç›˜é…é¢éžå¸¸é‡è¦ï¼Œæ™®é€šç”¨æˆ·è¦å¦ä¼šçœ‹æ‡‚自己的ç£ç›˜ä½¿ç”¨æƒ…况。è¦æŸ¥è¯¢è‡ªå·±çš„ç£ç›˜é…é¢å¯ä»¥ä½¿ç”¨ä¸‹é¢å‘½ä»¤ï¼ˆä¸‹ä¾‹ä¸ç”¨æˆ·è´¦å·æ˜¯caojh):
#quota caojhDisk quotas for user caojh(uid 502):Filesystem blocks quota limit grace files quota limit grace/dev/hda3 58 200000 400000 41 500 1000
以上显示IDå·ä¸º502çš„caojhè´¦å·ï¼Œæ–‡ä»¶ä¸ªæ•°è®¾ç½®ä¸º500~1000个,硬盘空间é™åˆ¶è®¾ç½®ä¸º200MB~400MB。一旦ç£ç›˜é…é¢è¦ç”¨å®Œæ—¶ï¼Œå°±éœ€è¦åˆ 除一些垃圾文件或å‘系统管ç†å‘˜è¯·æ±‚è¿½åŠ é…é¢ã€‚
at
1.作用at命令用æ¥åœ¨æŒ‡å®šæ—¶åˆ»æ‰§è¡ŒæŒ‡å®šçš„命令åºåˆ—。
2.æ ¼å¼at [ï¼V] [ï¼qx] [ï¼f file] [ï¼m] time
3.主è¦å‚æ•°ï¼Vï¼šæ˜¾ç¤ºæ ‡å‡†é”™è¯¯è¾“å‡ºã€‚ï¼q:许多队列输出。ï¼f:从文件ä¸è¯»å–作业。ï¼m:执行完作业åŽå‘é€ç”µå邮件到用户。time:设定作业执行的时间。timeæ ¼å¼æœ‰ä¸¥æ ¼çš„è¦æ±‚,由å°æ—¶ã€åˆ†é’Ÿã€æ—¥æœŸå’Œæ—¶é—´çš„å移é‡ç»„æˆï¼Œå…¶ä¸æ—¥æœŸçš„æ ¼å¼ä¸ºMM.DD.YY,MM是分钟,DD是日期,YY是指年份。å移é‡çš„æ ¼å¼ä¸ºæ—¶é—´ï¼‹å移é‡ï¼Œå•ä½æ˜¯minutesã€hourså’Œdays。
4.应用实例#at ï¼f data 15:30 +2 days
上é¢å‘½ä»¤è¡¨ç¤ºè®©ç³»ç»Ÿåœ¨ä¸¤å¤©åŽçš„17:30执行文件dataä¸æŒ‡æ˜Žçš„作业。
lp
1.作用lp是打å°æ–‡ä»¶çš„命令,使用æƒé™æ˜¯æ‰€æœ‰ç”¨æˆ·ã€‚
2.æ ¼å¼lp [ï¼c][ï¼d][ï¼m][ï¼number][ï¼title][-p]
3.主è¦å‚æ•°ï¼c:先拷è´æ–‡ä»¶å†æ‰“å°ã€‚ï¼d:打å°é˜Ÿåˆ—文件。ï¼m:打å°ç»“æŸåŽå‘é€ç”µå邮件到用户。ï¼number:打å°ä»½æ•°ã€‚ï¼title:打å°æ ‡é¢˜ã€‚ï¼p:设定打å°çš„优先级别,最高为100。
4.应用实例(1)使用lp命令打å°å¤šä¸ªæ–‡ä»¶ï¼ƒlp 2 3 4request id is 11 (3 file(s))
å…¶ä¸2ã€3ã€4分别是文件å;“request id is 11 (3 file(s)) â€è¡¨ç¤ºè¿™æ˜¯ç¬¬11个打å°å‘½ä»¤ï¼Œä¾æ¬¡æ‰“å°è¿™ä¸‰ä¸ªæ–‡ä»¶ã€‚
(2)设定打å°ä¼˜å…ˆçº§åˆ«ï¼ƒlp lp -d LaserJet -p 90 /etc/aliases
é€šè¿‡æ·»åŠ â€œ-p 90â€ï¼Œè§„定了打å°ä½œä¸šçš„优先级为90。它将在优先级低于90的打å°ä½œä¸šä¹‹å‰æ‰“å°ï¼ŒåŒ…括没有设置优先级的作业,缺çœä¼˜å…ˆçº§æ˜¯50
useradd
1.作用useradd命令用æ¥å»ºç«‹ç”¨æˆ·å¸å·å’Œåˆ›å»ºç”¨æˆ·çš„起始目录,使用æƒé™æ˜¯è¶…级用户。
2.æ ¼å¼useradd [ï¼d home] [ï¼s shell] [ï¼c comment] [ï¼m [ï¼k template]] [ï¼f inactive] [ï¼e expire ] [ï¼p passwd] [ï¼r] name
3.主è¦å‚æ•°ï¼cï¼šåŠ ä¸Šå¤‡æ³¨æ–‡å—,备注文å—ä¿å˜åœ¨passwd的备注æ ä¸ã€‚ ï¼d:指定用户登入时的å¯å§‹ç›®å½•ã€‚ï¼
5G Setor Panel Antemma,4G Sector Panel Antenna,Base Station Grid Antenna,Sector Panel Antenna,MIMO Sector Panel Antenna
Yetnorson Antenna Co., Ltd. , https://www.xhlantenna.com