Linux will learn the 60 commands (rpm)

Linux provides a large number of commands, it can effectively use a lot of work, such as disk operations, file access, directory operations, process management, file permissions settings. Therefore, the Linux system work, the use of system commands. To truly understand the Linux system, it must learn from the Linux command, the command-based learning can be through a better understanding of Linux.

Different Linux distributions the number of different orders, but Linux distributions have at least an order of more than 200. More important and here the author to the most frequently used commands, according to their role in the system is divided into the following six parts introduced one by one.

◆ installation and login commands: login, shutdown, halt, reboot, install, mount, umount, chsh, exit, last;

◆ file processing command: file, mkdir, grep, dd, find, mv, ls, diff, cat, ln;

◆ systems management-related commands: df, top, free, quota, at, lp, adduser, groupadd, kill, crontab;

◆ network operations 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, who;

◆ Other command: tar, unzip, gunzip, unarj, mtools, man, unendcode, uudecode.

In this paper, Mandrake Linux 9.1 (Kenrel 2.4.21) as an example, under Linux installation and login commands.


1. Role

login role is to log in and use its authority to all users.

2. Format

login [name] [-p] [-h hostname]

3. The main parameters

-P: notice to maintain the current login environment parameters.

-H: used to transfer between the remote login username.

If you choose to log on Linux command line mode, then see the first Linux command is login:.

General interface like this:

Manddrake Linux release 9.1 (Bamboo) for i586
renrel 2.4.21-0.13mdk on i686 / tty1
localhost login: root

The above code, the first line is the version number of Linux distribution, the second line is the kernel version number and log the virtual console, we enter the login name in the third line, press "Enter" key in the Password and enter the account password to login system. For security reasons, enter the account password characters will not echo on the screen, the cursor does not move.

This login will see the following interface (for example root):

[Root @ localhost root] #
last login: Tue, Nov 18 10:00:55 on vc / 1

Shown above is the log week, month, date, time, and use the virtual console.

4. Application Skills

Linux is a true multi-user operating system, you can also accept multiple users log on, but also allows a user to repeatedly log. This is because many versions of Linux and Unix-like virtual console provides access mode that allows users at the same time from the console (system console is connected directly with the system monitor and keyboard) for multiple logins. Each virtual console can be seen as an independent workstation, you can switch between tables. Virtual Console switch by pressing the Alt key and can be a function key to achieve, usually F1-F6.

For example, users log in, click "Alt + F2" key, the user can see above there's "login:" prompt, the user can see the second virtual console. Then just press "Alt + F1" key, you can return to the first virtual console. A newly installed Linux system allows users to use "Alt + F1" to "Alt + F6" key to access the first six virtual consoles. Virtual Console is most useful when a program error causes the system deadlock, you can switch to other virtual console work, close the program.


1. Role

The role of shutdown command is turned off the computer, it is super user permissions.

2. Format

shutdown [-h] [-i] [-k] [-m] [-t]

3. The important parameters

-T: changing to another run level before the procedure to tell init how long after the shutdown.

-K: do not really shutdown, only to send warning signals to each Registrant.

-H: power off after shutdown.

-C: cancel current process canceled shutdown procedures are being implemented. Therefore, this option is of course no time for argument, but you can enter a message to explain, and this information will be sent to each user.

-F: restart the computer in the forced fsck.

-Time: the time before setting off.

-M: the system into single user mode.

-I: shut down when the display system information.

4. Command Description

shutdown command can be safely shut down the system. Some users will use a direct way to turn off the power supply broken Linux system, which is very dangerous. Because different Linux and Windows, its background running many process, so the process of Force shutdown may result in loss of data, the system in an unstable state, and even some system damage to hardware devices (hard drive). In the system before using the shutdown command shutdown, system administrators will inform all users of the system will log off and login instructions will be frozen, that new user can not log on.


1. Role

halt command role is shut down the system, it is super user permissions.

2. Format

halt [-n] [-w] [-d] [-f] [-i] [-p]

3. Main Parameter Description

-N: to prevent the sync system call, it is used in the repair with fsck the root partition, in order to prevent the kernel with the old version of the super-block coverage over the super-block patch.

-W: not really a reboot or shut down, just write wtmp (/ var / log / wtmp) record.

-F: do not call the shutdown, which forced shutdown or restart.

-I: shutdown (or restart) before, turn off all network interfaces.

-F: forced shutdown, do not call shutdown the command.

-P: When the shutdown power off when the way to do the action.

-D: shut down the system, but not the record.

4. Command Description

halt is to call shutdown-h. halt execution, kill the application process, the implementation of sync (will be kept in force the write buffer data in the hard disk) system call, file system write operation will stop after the completion of the kernel. If the operation of the system level to 0 or 6, then shut down the system; otherwise to shutdown command (with-h parameter) instead.


1. Role

reboot command role is to restart the computer, it is the system administrator permissions.

2. Format

reboot [-n] [-w] [-d] [-f] [-i]

3. The main parameters

-N: do not do the re-boot before the hard disk memory data write-back action.

-W: not really a reboot, just to record write / var / log / wtmp file.

-D: not to record write / var / log / wtmp file (-n This parameter contains a-d).

-I: first of all before the reboot and stop network-related devices.


1. Role

role install command to install or upgrade software or backup data, it is all the user permissions.

2. Format

(1) install [option] source destination ...

(2) install [option] ... source directory ...

(3) install-d [option] ... catalog ...

In the first two formats, will be <source> Copy to <Destinations> or more <source> files to the existing <Directory>, while setting permission modes and owner / owned group. In the third format, will create all the specified directory and their home directory. The parameters of long options are mandatory for short options too necessary.

3. The main parameters

- Backup [= CONTROL]: for each existing destination file for backup.

-B: like - backup, but does not accept any parameters.

-C: (this option is ignored).

-D, - directory: all arguments as directory, and they will create the specified directory of all the home directory.

-D: Create <destination> before all the main directory, then <source> Copy to <Destinations>; in a useful way to use format.

-G, - group = group: to set their own group, rather than the process currently owned group.

-M, - mode = mode: mode to set their permissions (like chmod), instead of rwxr-xr-x.

-O, - owner = owner: self-set owners (for super-users).

-P, - preserve-timestamps: to <source> file access / modification time as the corresponding destination file time attributes.

-S, - strip: use the strip command to remove the symbol table, only the first and second to use format.

-S, - suffix = suffix: self-designated back up the topic "suffix>.

-V, - verbose: processing each file / directory name printed.

- Help: show this help message and exit.

- Version: display version information and exit.


1. Role

The role of the mount command loads the file system, it is the super user with permissions or / etc / fstab that allows the users.

2. Format

mount-a [-fv] [-t vfstype] [-n] [-rw] [-F] device dir

3. The main parameters

-H: display auxiliary information.

-V: display information, usually-f is used to debug.

-A: the / etc / fstab file system defined in all hang.

-F: This command is usually and-a used together, it will mount every action generates a schedule for implementation. The system needs a lot of NFS mounted file system can speed up the loading speed.

-F: often used to debug. It will mount the action does not perform the actual hang, but the whole hang of the process simulation, and-v is usually used together.

-T vfstype: shows the type of file system is loaded.

-N: In general, mount after mount in / etc / mtab to write a data in the system can be written to the file system is not the case, you can use this option to cancel the action.

4. Application Skills

In Linux and Unix systems, all documents are, as a large tree (to / for the root) part of the visit. To access the files on the CD-ROM, CD-ROM device needs to be mounted in a hanging file in the tree decorating. If the release is installed automatically mounted package, then this step can be automated. In Linux, if you want to use the hard drive, optical drive and other storage devices, it must first load, when the storage device hung up, you can put it as a directory to visit. A device using the mount command mount. Use this command in the mount, at least three types of information must first know the following: To load object file system types, equipment to load the object name and you want to load the equipment to which directory.

(1) Linux file system can be identified

◆ Windows 95/98 FAT 32 file system commonly used: vfat;

◆ Win NT/2000 File System: ntfs;

◆ OS / 2 with the file system: hpfs;

◆ Linux file system used: ext2, ext3;

◆ CD-ROM CD-ROM file system used: iso9660.

Although the FAT 32 vfat is the system, but in fact it is also compatible with FAT 16 file system type.

(2) determine the name of the device

In Linux, the device name usually exist / dev in. The naming of these devices are all the rules, you can use "reasoning" approach to find out the device name. For example, / dev/hda1 the IDE device, hd is the Hard Disk (HDD) in, sd is the SCSI Device, fd is a Floppy Device (or Floppy Disk?). a representative of the first device, usually IDE interface can be connected to four IDE devices (such as four hard drives). Therefore, the method to identify each IDE hard disk is hda, hdb, hdc, hdd. hda1 in the "1" represents the first hard disk partition hda (partition), hda2 hda representative of the second primary partition, the first logical partition start from hda5, and so on. In addition, you can directly check the / var / log / messages file, the file can be found in the computer boot up after the system has identified the device code.

(3) to find mount point

Before the device mounted in the decision, first check the computer is not there a / mnt empty directory, the directory is specifically designed as a mount point (Mount Point) in the directory. Proposed / mnt in the construction of several / mnt / cdrom, / mnt / floppy, / mnt / mo and other directories, as a special mount point directory. For example, if we mount the following five devices, the implementation of the directive may be as follows (assuming all of the ext2 Linux system, if it is Windows XX Please change ext2 vfat):

Floppy ===> mount-t ext2 / dev/fd0 / mnt / floppy
cdrom ===> mount-t iso9660 / dev / hdc / mnt / cdrom
SCSI cdrom ===> mount-t iso9660 / dev / sdb / mnt / scdrom
SCSI cdr ===> mount-t iso9660 / dev / sdc / mnt / scdr

But now most of the newer Linux distributions (including Red Flag Linux, CS Linux, Mandrake Linux, etc.) can be automatically mounted file system, but except for Red Hat Linux.


1. Role

umount command role is to uninstall a file system, it is the super user permissions or / etc / fstab that allows the users.

2. Format

unmount-a [-fFnrsvw] [-t vfstype] [-n] [-rw] [-F] device dir

3. Use

mount command umount command is the inverse operation, its parameters and methods and use the same mount command. Linux mounted CD-ROM, it will lock the CD-ROM, CD-ROM that can not be used on the front panel Eject button to eject it. However, when no longer needed the disc, If you have / cdrom as a symbolic link, use the umount / cdrom to uninstall it. Only when no users are using the CD, the command to succeed. The command includes the current working directory with the CD in the directory as the terminal window.


1. Role

chsh command's role is to change the user shell configuration, it is all the user permissions.

2. Format

chsh [-s] [-list] [- help] [-v] [username]

3. The main parameters

-L: all Shell type display system.

-V: Display Shell version number.

4. Application Skills

Introduced in front of a variety of Linux, Shell, the general default is Bash, if you want to change the type you can use the chsh command Shell. Input account password, then enter the new Shell type, if done correctly, the system will display "Shell change". The interface generally as follows:

Changing fihanging shell for cao
New shell [/ bin / bash]: / bin / tcsh

The code above, [] is currently used within Shell. Ordinary users can only modify its own Shell, super-user can modify all the user's Shell. To check system which Shell, you can use the chsh-l command, as shown in Figure 1.

Figure 1 system can use the Shell Type

As can be seen from Figure 1, the author can use the Shell system, there are bash (the default), csh, sh, tcsh of four.


1. Role

The role of exit command exit the system, its permissions are all users.

2. Format


3. Parameters

exit command with no arguments, running out of the system into the login screen.


1. Role

last command of the role is to show the recent situation of the user or the end of the log, it is all the user permissions. Through the last command to see the program's log, the administrator can be informed who have or attempt to access the system.

2. Format

1ast [-n] [-f file] [-t tty] [-h node] [-I-IP] [-1] [-y] [1D]

3. The main parameters

-N: specify the output number of records.

-F file: specify the file with a file used as the query log file.

-T tty: only these virtual console login situation.

-H node: select only the login node situation.

-I IP: display only the specified IP log situation.

-1: Use to display the remote IP address.

-Y: Display record year, month, day.

-ID: to know the user name query.

-X: display system closed, users log in and out of history.

分类:OS 时间:2010-04-05 人气:255
blog comments powered by Disqus


  • Ubuntu Linux change ROOT password to modify the IP and other command 2011-03-05

    Ubuntu installation is no default root password, because you have not set a password to the root, your first user is in admin group, he can give root password, so we do not charge their brains like the original set their own password is the number of

  • How to modify the openSUSE Linux's root password? 2010-09-07

    Question: Forgotten openSUSE Linux's root user password, how to do? Solution: a. Restart the machine, in the event of grub boot interface, the boot Linux "boot option" in with init = / bin / bash, pass through to the kernel init = / bin / bash p

  • Forget linux (ubuntu) root password modification method 2010-09-08

    1, according to shift into the grub boot 2 changes by e 3 modify the penultimate line of linux / boot / quiet splash as the linux / boot / single init = / bin / bash 4 Press ctrl + X, etc. After running still enter a pas

  • under linux mysql root password forgotten solution 2011-10-08

    1, close Mysql: If MySQL is running, the first kill killall-TERM mysqld 2, another way to start MySQL: bin / safe_mysqld - skip-grant-tables & 3, may not need a password to access the MySQL. Then is > Use mysql > Update user set password = passw

  • Linux (VMware) root or user password forgotten 2011-08-23

    Start the VMware of linux: 1 color screen to enter the GRUB after three seconds for you. Enter into GRUB, there have been: Red Hat Enterprise Linux Server (2.6.18-8.e15xen) 2 type e occur: root (hd0, 0) kernel / xen.gz-2.6.28-8.e15 module / vmlinux-2

  • How to change mysql root password? 2011-05-11

    If you forget your mysql root password, do not worry, you only need four steps will be able to solve the problem! -------------------------------------------------- -------------------------------------------------- ----------------------------- Spec

  • Transfer must have the eight [cmd command line] 2010-03-11

    Transfer must have the cmd command line eight [] Articles Category: Operating system Must have the cmd command line eight [] 1, ping It is used to check whether the network or Internet connection speed smooth order. As a living network administrator

  • Doctrine2 use command line tools 2010-05-09

    Doctrine2 compressed package tools catalog is used to do some command line work. But must be downloaded from the SVN Doctrine2 to use them. Suppose you use the svn on doctrine2, depending on your server's configuration, if the operation for the mysql

  • Java command line summary 2010-11-21

    Reference: javac command java command Javac command: Used to compile the source file into a binary bytecode file. *. Java file that is compiled into *. class, *. java and *. class name is one to one correspondence, that is, the file is compiled Test.

  • Windows command line based (on) 2011-01-14

    Windows command-line based Go to the original HTML file Download . Directory 1. Introduction : Why use the command line 2. The basis of the file system 2.1 Partition and drive letter 2.2 File with the name 2.3 Fil

iOS 开发

Android 开发

Python 开发



PHP 开发

Ruby 开发






Javascript 开发

.NET 开发



Copyright (C), All Rights Reserved. 版权所有 闽ICP备15018612号

processed in 0.389 (s). 13 q(s)