60 required commands in Linux

Source: Internet
Author: User
◆ Installation and logon commands: Login, shutdown, halt, reboot, install, mount, umount, CHSH, exit, and last; ◆ file processing commands: file, mkdir, grep, DD, find, MV, ls, diff, Cat, ln; ◆ system management commands: DF, top, free, quota, AT, LP, adduser, groupadd, kill, and crontab; ◆ network operation command: 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, and WHO; ◆ other commands: Tar, unzip, gunzip, unarj, mtools, man, unendcode, uudecode . This document uses Mandrake Linux 9.1 (kenrel 2.4.21) as an example to introduce the installation and logon commands in Linux. Login 1. The role of login is to log on to the system. Its permission is granted to all users. 2. Format: Login [name] [-p] [-H host name]

3. Main Parameter-P: notifies login to keep current environment parameters. -H: used to transmit user names between remote logins. If you choose to log on to Linux in command line mode, the first Linux Command is login :. The general interface is as follows: manddrake Linux release 9.1 (bamboo) for i586 renrel 2.4.21-0.13mdk on i686/tty1localhost
Login: Root
Password: above Code In, the first line is the Linux release version, the second line is the kernel version and the virtual console that you are logged on to. In the third line, enter the login name,
Press enter and enter the account password to log on to the system. For security reasons, characters are not displayed on the screen when the account password is entered.
Echo, And the cursor does not move. After logging on, you will see the following interface (for example, a Super User): [root @ localhost root] # Last login: Tue, nov 18 10:00:55 on VC/1 shows the virtual console used for logon to the day, month, day, and time. 4. Application tips Linux is a real multi-user operating system that allows multiple users to log on at the same time and allows one user to log on multiple times. This is because
Like many versions of UNIX, Linux provides access to the virtual console, allowing users to access the console at the same time (the console of the system)
Is a monitor and keyboard directly connected to the system) for multiple logins. Each virtual console can be seen as an independent Workstation
You can switch between them. The switchover of the virtual console can be done by pressing the Alt key and a function key, typically using a F1-F6. For example, after a user logs on, press the "Alt + F2" key and the user will see the "login:" prompt shown above, indicating that the user has seen
Two virtual consoles. Then, press the "Alt + F1" key to return to the first virtual console. A newly installed Linux system is allowed
Users can use the Alt + F1 to access the first six virtual consoles with the Alt + F6 key. The most useful thing about the virtual console is that when Program System caused by error
When a deadlock occurs, you can switch to another virtual console to close the program. Shutdown 1. The function of the shutdown command is to shut down the computer, and its permission is super user. 2. format: shutdown [-H] [-I] [-K] [-M] [-T] 3. important parameter-T: Tell the INIT program how long it will shut down before it changes to another running level. -K: it does not actually shut down, but only sends a warning signal to each worker. -H: power off after shutdown. -C: Cancel current process cancels the currently executing Shutdown program. Therefore, this option does not have a time parameter, but you can enter
Enter a message for explanation, which will be sent to each user. -F: Forces The fsck to restart the computer. -Time: set the time before shutdown. -M: Change the system to single-user mode. -I: The system information is displayed when the instance is shut down. 4. The command indicates that the shutdown command can safely shut down the system. It is very dangerous for some users to shut down the Linux system by directly disconnecting the power supply.
Because Linux and Windows are different, many processes are running in the background, forced shutdown may lead to data loss of the process, making the system unstable.
Fixed status, or even damage the hardware device (hard disk) in some systems ). Use the shutdown command before shutting down the system. The system administrator will notify you
The system of a logged-on user will be shut down, and the LOGIN Command will be frozen, that is, new users cannot log on again. Halt 1. The role of the halt command is to shut down the system, and its permission to use is a Super User. 2. format: Halt [-N] [-W] [-D] [-F] [-I] [-p] 3. main Parameter description-N: prevents Sync system calls. It is used to fix the root partition with fsck to prevent the kernel from overwriting the repaired super block with the old version of super block. -W: Not a real restart or shutdown, but a wtmp (/var/log/wtmp) record. -F: forced shutdown or restart without calling shutdown. -I: Shut down all network interfaces before shutting down (or restarting. -F: Force Shutdown without calling the shutdown command. -P: when the power is turned off, the power is turned off by the way. -D: Shut down the system, but no record is left. 4. The command indicates that halt calls shutdown-H. When halt is executed, the application process is killed and sync is executed (the data stored in the buffer is forcibly written to the hard disk)
The kernel is stopped after the file system write operation is completed. If the system running level is 0 or 6, shut down the system; otherwise, shutdown indicates
(With the-h Parameter) to replace. Reboot 1. The role of the reboot command is to restart the computer. Its permission is assigned to the system administrator. 2. format: reboot [-N] [-W] [-D] [-F] [-I] 3. main Parameter-N: Do not write the memory data back to the hard disk before re-boot. -W: The record is not written 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 restarting. Install 1. The role of the install command is to install or upgrade software or back up data. Its permission is granted to all users. 2. format (1) install [Options]... source destination (2) install [Option]... source... directory (3) install-d [Option]... directory... in the first two formats, you can copy <source> to <destination> or multiple <source> files to an existing <directory>, and set the permission mode.
And owner/group. In the third format, all specified directories and their home directories are created. Parameters required for the long option are short
Required. 3. Main Parameter -- backup [= control]: backs 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 directories in the specified directory are created. -D: create all the Home Directories Before <destination> and copy <source> to <destination>. This is useful in the first format. -G, -- group = group: Set the group to which the process belongs, rather than the current group to which the process belongs. -M, -- mode = mode: Set the permission mode (such as chmod), instead of rwxr-XR-X. -O, -- owner = owner: Set the owner (applies to Super Users only ). -P, -- preserve-timestamps: Use the <source> File Access/modification time as the time attribute of the corresponding destination file. -S, -- Strip: Use the Strip command to delete the symbol table, only applicable to the first and second formats. -S, -- suffix = Suffix: Specifies the <suffix> of the backup file. -V, -- verbose: The name is printed when processing each file/directory. -- Help: displays the help information and leaves. -- Version: displays the version information and leaves. Mount 1. The function of the mount command is to load the file system. Its permission is granted to a Super User or a user allowed in/etc/fstab. 2. Format: Mount-A [-FV] [-T vfstype] [-N] [-RW] [-F] device dir 3. Main Parameter-H: displays auxiliary information. -V: display information, usually used with-F for debugging. -A: Mount all file systems defined in/etc/fstab. -F: this command is usually used with-a, which generates a route for each Mount action. When the system needs to be hung up
Speed up NFS file system loading. -F: usually used for debugging. It causes mount to not execute the actual mounting action, but simulate the entire mounting process, which is usually used together with-v. -T vfstype: displays the type of the file system to be loaded. -N: Generally, after Mount is mounted, a piece of data is written to the/etc/mtab. If no file system can be written to the system
Use this option to cancel this action. 4. Application tips on Linux and Unix systems, all files are accessed as part of a large tree (with/as the root. To access files on a CD-ROM,
You need to mount the CD-ROM device to a mount point in the file tree. If the release version is installed with an automatic mounting package, this step can be performed automatically.
In Linux, if you want to use storage devices such as hard disks and optical drives, you have to load them first. After the storage devices are mounted, you can attach them
Into a directory. Mount a device and run the mount command. When using the mount command, you must first know at least three types of information:
The file system type of the object to be loaded, the device name of the object to be loaded, and the directory to which the device is loaded. (1) recognizable file systems in Linux ◆ common FAT 32 file systems in Windows 95/98: vfat; ◆ Win NT/2000: NTFS; ◆ OS/2 with the file system: HPFs; ◆ Linux with the file system: ext2, ext3; ◆ CD-ROM disc with the file system: iso9660. Although vfat is a FAT 32 system, it is actually compatible with the file system type of fat 16. (2) Confirm that the device name is in Linux, and the device name usually exists in/dev. The names of these devices are named in a regular way. You can use "inference" to name devices.
Find out the name. For example, the/dev/hda1 ide device, HD is hard disk (hard disk), SD is SCSI device, FD is floppy Device
(Or floppy disk ?). A Indicates the first device. Generally, the IDE interface can be connected to four ide devices (such as four hard disks ). Therefore, you need to identify the IDE
The hard drive methods are hda, HDB, HDC, and HDD. "1" in hda1 represents the first hard disk partition of hda (partition), and hda2 represents
The second primary partition of hda. The first logical partition starts with hda5, and so on. In addition, you can directly check the/var/log/messages file,
In this file, you can find the device code identified by the system after the computer is started. (3) Find the mount point. Before deciding to connect the device, check whether the computer has an empty/mnt Directory, which is used as a mount point.
(Mount point) directory. We recommend that you create several/mnt/CDROM,/mnt/floppy,/mnt/Mo directories in/mnt as dedicated directories.
Mount point. For example, if you want to mount the following five devices, the command execution may be as follows (assuming that all these are Linux ext2 systems
For Windows XX, change ext2 to vfat ): floppy Disk ==> Mount-T ext2/dev/fd0/mnt/Floppy CDROM ==> Mount-T iso9660/dev/HDC/mnt/CDROM
Scsi cdrom ==> Mount-T iso9660/dev/sdb/mnt/bqrom scsi cdr ==> Mount-T iso9660/dev/SDC
/Mnt/scdr, but currently most of the newer Linux releases (including Red Flag Linux, mid-soft Linux, and Mandrake Linux) can be automatically mounted
File System installation, except for Red Hat Linux. Umount 1. umount command is used to uninstall a file system. Its permission is granted to a Super User or a user allowed in/etc/fstab. 2. format: unmount-A [-ffnrsvw] [-T vfstype] [-N] [-RW] [-F] device dir 3. the umount command is the inverse operation of the mount command. Its Parameters and usage are the same as those of the mount command. Linux mounted CD-ROM, Will
Lock the CD-ROM so that it cannot be popped up with the eject button on the CD-ROM panel. However, if the/CDROM]
As a symbolic link, use umount/CDROM to uninstall it. This command is successful only when no user is using the CD. This command
The terminal window that uses the current working directory as the directory in the CD. CHSH 1. The function of the CHSH command is to change the User Shell settings, and its permission is for all users. 2. Format: CHSH [-S] [-list] [-- help] [-V] [username] 3. Main Parameter-L: displays all shell types of the system. -V: displays the shell version number. 4. Application tips I have introduced a variety of shells in Linux. The default is Bash. If you want to change the shell type, you can use the CHSH command. Enter
Enter the account password and the new shell type. If the operation is correct, "shell change" is displayed ". The interface is generally as follows: Changing fihanging shell for caopassword: new shell [/bin/bash]: In the code above/bin/tcsh, the current shell is used in. Normal users can only modify their own shells. Super Users can modify all users.
. To query which shells are provided, run the CHSH-l command, as shown in figure 1. Figure 1 The shell types that can be used by the system can be seen in Figure 1. The shell types that can be used in the author's system include bash (default), CSH, sh, and tcsh. Exit 1. The function of the exit command is to exit the system, and its permission is for all users. 2. Format: Exit 3. The exit command has no parameters. After running the command, exit the system and enter the logon interface. Last 1. The role of the last command is to display the logon status of recent users or terminals. Its permission is granted to all users. View
Program log, 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 Parameter-N: specify the number of output records. -F file: specifies that the file is used as the log file for query. -T tty: only the logon status on the specified virtual console is displayed. -H node: only the logon status on the specified node is displayed. -I IP: only the logon status on the specified IP address is displayed. -1: use an IP address to display the remote address. -Y: displays the year, month, and day of the record. -ID: the user name to be queried. -X: displays the system shutdown, user logon, and logout history. The installation and logon commands of Linux are introduced in the hands-on exercises. The following describes several instances and the commands mentioned earlier. 1. you can run multiple commands at a time in one command line and separate them with semicolons (;). For example: # Last-X; halt indicates that the computer is disabled after the system is disabled, the user logon history, and the user logon history are displayed. 2. Use Mount mounted file system to access many Linux versions in windows. Currently, vfat partitions can be automatically loaded to Access Windows systems. Red Hat versions do not have their own
Manually attach a vfat partition. Mount can be used to mount a Windows partition as a "file" of Linux to an empty folder in Linux.
The partition is associated with the/mnt directory. Therefore, accessing this folder is equivalent to accessing this partition. First, under/mnt
Create a winc folder and enter the following command at the command prompt: # Mount-T vfat/dev/hda1/mnt/winc indicates to mount the Windows C partition to the/mnt/winc directory of liunx. In this case, you can see windows in the/mnt/winc directory
The content of drive C. You can use a similar method to access D and E disks in windows. Windows partitions are displayed in Linux
The sequence is as follows: hda1 is drive C, hda5 is drive D, hda6 is drive E ...... And so on. You can see that there is
A big problem is that all Chinese file names or folder names in windows are displayed as question marks "?". English is normal.
Display. We can add some parameters to display Chinese characters. Take the preceding operation as an example. Enter the command # Mount-T vfat-O iocharset = cp936/dev/hda1/mnt/winc to display Chinese characters normally. 3. Using mount to mount a file system on a flash disk is very simple in Linux. Linux has good support for USB devices. After a flash disk is inserted, the flash disk is recognized as a SCSI disk,
Generally, run the following command: # Mount/dev/sda1/USB to mount the file system on the flash disk. A small knowledge of Linux commands and shell is the so-called shell, that is, the command interpreter program, which provides the programming interface, you can use the program to program. Learning shell for Linux
It is very important for scholars to understand the Linux system. As the operating system shell, the Linux system shell provides users with the operating system
. Shell is a general term for the command language, command interpreter program, 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, shell is the outer layer around the kernel. When passing data from shell or other programs to Linux
The kernel will respond accordingly. Role of Shell in Linux and command. com in ms dos and command. com in Windows 95/98
Assumer.exe is similar. Although shell is not a part of the system's core, it is only an extension of the system's core, but it can call
Most features of the core. Therefore, shell is the most important utility in unux/Linux. There are multiple types of Shell in Linux. The most common types are Bourne shell (SH), c shell (CSH), and Korn shell (Ksh ). Mostly
The default shell of Several Linux releases is the Bourne again shell, which is an extension of the Bourne shell, bash for short, and the Bourne shell
Fully backward compatible, and added many features based on the Bourne shell. Bash is placed in/bin/bash and can be supplemented by commands,
Command editing and command history tables. It also contains many advantages of C shell and Korn shell, with flexible and powerful programming interfaces,
At the same time, there is a friendly user interface. In Linux, 40 of the more than 200 commands are Bash Internal commands, including exit, less, LP,
Kill, CD, PWD, FC, FG, etc.

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.